Gitweb links:
...log
http://git.netsurf-browser.org/netsurf.git/shortlog/310247ef82a99512d7f3302b149a1bae0736b34f
...commit
http://git.netsurf-browser.org/netsurf.git/commit/310247ef82a99512d7f3302b149a1bae0736b34f
...tree
http://git.netsurf-browser.org/netsurf.git/tree/310247ef82a99512d7f3302b149a1bae0736b34f
The branch, master has been updated
via 310247ef82a99512d7f3302b149a1bae0736b34f (commit)
via 61fdb8fda690d6b4dbdf8802af2a7341b03cccd3 (commit)
via fa520638fa0d3bed48171b78655639a0baf0a962 (commit)
from 2f8868309af93a15131e3564320760c432f6daae (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff
http://git.netsurf-browser.org/netsurf.git/commit/?id=310247ef82a99512d7f3302b149a1bae0736b34f
commit 310247ef82a99512d7f3302b149a1bae0736b34f
Author: Daniel Silverstone <[email protected]>
Commit: Daniel Silverstone <[email protected]>
test: Bring corestring test count up to date
Signed-off-by: Daniel Silverstone <[email protected]>
diff --git a/test/corestrings.c b/test/corestrings.c
index 02640c9..8690d82 100644
--- a/test/corestrings.c
+++ b/test/corestrings.c
@@ -40,7 +40,7 @@
*
* This is used to test all the out of memory paths in initialisation.
*/
-#define CORESTRING_TEST_COUNT 435
+#define CORESTRING_TEST_COUNT 480
START_TEST(corestrings_test)
{
@@ -53,8 +53,12 @@ START_TEST(corestrings_test)
res = corestrings_fini();
malloc_limit(UINT_MAX);
-
- ck_assert_int_eq(ires, NSERROR_NOMEM);
+
+ if (_i < CORESTRING_TEST_COUNT) {
+ ck_assert_int_eq(ires, NSERROR_NOMEM);
+ } else {
+ ck_assert_int_eq(ires, NSERROR_OK);
+ }
ck_assert_int_eq(res, NSERROR_OK);
}
END_TEST
@@ -65,7 +69,7 @@ static TCase *corestrings_case_create(void)
TCase *tc;
tc = tcase_create("corestrings");
- tcase_add_loop_test(tc, corestrings_test, 0, CORESTRING_TEST_COUNT);
+ tcase_add_loop_test(tc, corestrings_test, 0, CORESTRING_TEST_COUNT + 1);
return tc;
}
commitdiff
http://git.netsurf-browser.org/netsurf.git/commit/?id=61fdb8fda690d6b4dbdf8802af2a7341b03cccd3
commit 61fdb8fda690d6b4dbdf8802af2a7341b03cccd3
Author: Daniel Silverstone <[email protected]>
Commit: Daniel Silverstone <[email protected]>
JS: Add DOMImplementation::createHTMLDocument
This was the last major thing blocking basic jQuery support
Signed-off-by: Daniel Silverstone <[email protected]>
diff --git a/content/handlers/javascript/duktape/DOMImplementation.bnd
b/content/handlers/javascript/duktape/DOMImplementation.bnd
new file mode 100644
index 0000000..05c481d
--- /dev/null
+++ b/content/handlers/javascript/duktape/DOMImplementation.bnd
@@ -0,0 +1,120 @@
+/* DOMImplementation binding for browser using duktape and libdom
+ *
+ * Copyright 2020 Daniel Silverstone <[email protected]>
+ *
+ * This file is part of NetSurf, http://www.netsurf-browser.org/
+ *
+ * Released under the terms of the MIT License,
+ * http://www.opensource.org/licenses/mit-license
+ */
+
+prologue DOMImplementation ()
+%{
+#include "utils/corestrings.h"
+%}
+
+method DOMImplemention::hasFeature ()
+%{
+ /* Always return true */
+ duk_push_bool(ctx, true);
+ return 1;
+%}
+
+method DOMImplementation::createHTMLDocument ()
+%{
+ duk_size_t text_len;
+ const char *text = duk_safe_to_lstring(ctx, 0, &text_len);
+ struct dom_document *doc = NULL, *ret = NULL;
+ struct dom_document_type *doctype = NULL;
+ struct dom_html_element *html = NULL, *head = NULL, *title = NULL,
*body = NULL;
+ struct dom_node *spare_ref = NULL;
+ dom_string *text_str = NULL;
+ dom_exception exc;
+
+ exc = dom_string_create((const uint8_t*)text, text_len, &text_str);
+ if (exc != DOM_NO_ERR) goto out;
+
+ exc = dom_implementation_create_document(
+ DOM_IMPLEMENTATION_HTML,
+ NULL, NULL,
+ NULL,
+ NULL, NULL,
+ &doc
+ );
+ if (exc != DOM_NO_ERR) goto out;
+
+ exc = dom_implementation_create_document_type(
+ "html", NULL, NULL, &doctype);
+ if (exc != DOM_NO_ERR) goto out;
+
+ exc = dom_node_append_child(doc, doctype, &spare_ref);
+ if (exc != DOM_NO_ERR) goto out;
+ if (spare_ref != NULL) { dom_node_unref(spare_ref); spare_ref = NULL; }
+
+ exc = dom_document_create_element_ns(doc, corestring_dom_html_namespace,
+ corestring_dom_HTML, &html);
+ if (exc != DOM_NO_ERR) goto out;
+
+ exc = dom_document_create_element_ns(doc, corestring_dom_html_namespace,
+ corestring_dom_HEAD, &head);
+ if (exc != DOM_NO_ERR) goto out;
+
+ exc = dom_document_create_element_ns(doc, corestring_dom_html_namespace,
+ corestring_dom_TITLE, &title);
+ if (exc != DOM_NO_ERR) goto out;
+
+ exc = dom_document_create_element_ns(doc, corestring_dom_html_namespace,
+ corestring_dom_BODY, &body);
+ if (exc != DOM_NO_ERR) goto out;
+
+ exc = dom_node_set_text_content(title, text_str);
+ if (exc != DOM_NO_ERR) goto out;
+
+ exc = dom_node_append_child(head, title, &spare_ref);
+ if (exc != DOM_NO_ERR) goto out;
+ if (spare_ref != NULL) { dom_node_unref(spare_ref); spare_ref = NULL; }
+
+ exc = dom_node_append_child(html, head, &spare_ref);
+ if (exc != DOM_NO_ERR) goto out;
+ if (spare_ref != NULL) { dom_node_unref(spare_ref); spare_ref = NULL; }
+
+ exc = dom_node_append_child(html, body, &spare_ref);
+ if (exc != DOM_NO_ERR) goto out;
+ if (spare_ref != NULL) { dom_node_unref(spare_ref); spare_ref = NULL; }
+
+ exc = dom_node_append_child(doc, html, &spare_ref);
+ if (exc != DOM_NO_ERR) goto out;
+ if (spare_ref != NULL) { dom_node_unref(spare_ref); spare_ref = NULL; }
+
+ ret = doc;
+ doc = NULL;
+
+out:
+ if (text_str != NULL) {
+ dom_string_unref(text_str);
+ }
+ if (doc != NULL) {
+ dom_node_unref(doc);
+ }
+ if (html != NULL) {
+ dom_node_unref(html);
+ }
+ if (head != NULL) {
+ dom_node_unref(head);
+ }
+ if (title != NULL) {
+ dom_node_unref(title);
+ }
+ if (body != NULL) {
+ dom_node_unref(body);
+ }
+ if (doctype != NULL) {
+ dom_node_unref(doctype);
+ }
+ if (ret != NULL) {
+ dukky_push_node(ctx, (struct dom_node *)ret);
+ dom_node_unref(ret);
+ return 1;
+ }
+ return 0; /* Coerced to undefined */
+%}
diff --git a/content/handlers/javascript/duktape/Document.bnd
b/content/handlers/javascript/duktape/Document.bnd
index d9bff0a..de96cd8 100644
--- a/content/handlers/javascript/duktape/Document.bnd
+++ b/content/handlers/javascript/duktape/Document.bnd
@@ -433,6 +433,27 @@ method Document::createEvent ()
return 1;
%}
+getter Document::implementation ()
+%{
+ /* Create a new DOMImplementation instance */
+ duk_push_this(ctx);
+ duk_get_prop_string(ctx, -1, MAGIC(DOMImplementation));
+ if (duk_is_undefined(ctx, -1)) {
+ duk_pop(ctx);
+
+ if (dukky_create_object(ctx,
+ PROTO_NAME(DOMIMPLEMENTATION),
+ 0) != DUK_EXEC_SUCCESS) {
+ return duk_error(ctx,
+ DUK_ERR_ERROR,
+ "Unable to create dom implementation object");
+ }
+ duk_dup(ctx, -1);
+ duk_put_prop_string(ctx, -3, MAGIC(DOMImplementation));
+ }
+ return 1;
+%}
+
getter Document::onabort();
setter Document::onabort();
getter Document::onautocompleteerror();
diff --git a/content/handlers/javascript/duktape/netsurf.bnd
b/content/handlers/javascript/duktape/netsurf.bnd
index 628b2a3..30b3d4a 100644
--- a/content/handlers/javascript/duktape/netsurf.bnd
+++ b/content/handlers/javascript/duktape/netsurf.bnd
@@ -64,6 +64,7 @@ struct dom_html_br_element;
#include "HTMLCollection.bnd"
#include "Location.bnd"
#include "Navigator.bnd"
+#include "DOMImplementation.bnd"
/* events */
diff --git a/utils/corestringlist.h b/utils/corestringlist.h
index 53774ba..c9d0749 100644
--- a/utils/corestringlist.h
+++ b/utils/corestringlist.h
@@ -327,9 +327,11 @@ CORESTRING_DOM_STRING(waiting);
CORESTRING_DOM_STRING(width);
/* DOM node names, not really CSS */
CORESTRING_DOM_STRING(BUTTON);
+CORESTRING_DOM_STRING(HTML);
CORESTRING_DOM_STRING(INPUT);
CORESTRING_DOM_STRING(SELECT);
CORESTRING_DOM_STRING(TEXTAREA);
+CORESTRING_DOM_STRING(TITLE);
CORESTRING_DOM_STRING(BODY);
CORESTRING_DOM_STRING(HEAD);
CORESTRING_DOM_STRING(SCRIPT);
commitdiff
http://git.netsurf-browser.org/netsurf.git/commit/?id=fa520638fa0d3bed48171b78655639a0baf0a962
commit fa520638fa0d3bed48171b78655639a0baf0a962
Author: Daniel Silverstone <[email protected]>
Commit: Daniel Silverstone <[email protected]>
HTML: Ignore LOADING status in html_proceed_to_done()
Signed-off-by: Daniel Silverstone <[email protected]>
diff --git a/content/handlers/html/html.c b/content/handlers/html/html.c
index c7a9afe..d9fe904 100644
--- a/content/handlers/html/html.c
+++ b/content/handlers/html/html.c
@@ -285,9 +285,11 @@ html_proceed_to_done(html_content *html)
}
break;
case CONTENT_STATUS_DONE:
+ /* fallthrough */
+ case CONTENT_STATUS_LOADING:
return NSERROR_OK;
default:
- NSLOG(netsurf, ERROR, "Content status unexpectedly not
READY/DONE");
+ NSLOG(netsurf, ERROR, "Content status unexpectedly not
LOADING/READY/DONE");
break;
}
return NSERROR_UNKNOWN;
-----------------------------------------------------------------------
Summary of changes:
content/handlers/html/html.c | 4 +-
.../javascript/duktape/DOMImplementation.bnd | 120 ++++++++++++++++++++
content/handlers/javascript/duktape/Document.bnd | 21 ++++
content/handlers/javascript/duktape/netsurf.bnd | 1 +
test/corestrings.c | 12 +-
utils/corestringlist.h | 2 +
6 files changed, 155 insertions(+), 5 deletions(-)
create mode 100644 content/handlers/javascript/duktape/DOMImplementation.bnd
diff --git a/content/handlers/html/html.c b/content/handlers/html/html.c
index c7a9afe..d9fe904 100644
--- a/content/handlers/html/html.c
+++ b/content/handlers/html/html.c
@@ -285,9 +285,11 @@ html_proceed_to_done(html_content *html)
}
break;
case CONTENT_STATUS_DONE:
+ /* fallthrough */
+ case CONTENT_STATUS_LOADING:
return NSERROR_OK;
default:
- NSLOG(netsurf, ERROR, "Content status unexpectedly not
READY/DONE");
+ NSLOG(netsurf, ERROR, "Content status unexpectedly not
LOADING/READY/DONE");
break;
}
return NSERROR_UNKNOWN;
diff --git a/content/handlers/javascript/duktape/DOMImplementation.bnd
b/content/handlers/javascript/duktape/DOMImplementation.bnd
new file mode 100644
index 0000000..05c481d
--- /dev/null
+++ b/content/handlers/javascript/duktape/DOMImplementation.bnd
@@ -0,0 +1,120 @@
+/* DOMImplementation binding for browser using duktape and libdom
+ *
+ * Copyright 2020 Daniel Silverstone <[email protected]>
+ *
+ * This file is part of NetSurf, http://www.netsurf-browser.org/
+ *
+ * Released under the terms of the MIT License,
+ * http://www.opensource.org/licenses/mit-license
+ */
+
+prologue DOMImplementation ()
+%{
+#include "utils/corestrings.h"
+%}
+
+method DOMImplemention::hasFeature ()
+%{
+ /* Always return true */
+ duk_push_bool(ctx, true);
+ return 1;
+%}
+
+method DOMImplementation::createHTMLDocument ()
+%{
+ duk_size_t text_len;
+ const char *text = duk_safe_to_lstring(ctx, 0, &text_len);
+ struct dom_document *doc = NULL, *ret = NULL;
+ struct dom_document_type *doctype = NULL;
+ struct dom_html_element *html = NULL, *head = NULL, *title = NULL,
*body = NULL;
+ struct dom_node *spare_ref = NULL;
+ dom_string *text_str = NULL;
+ dom_exception exc;
+
+ exc = dom_string_create((const uint8_t*)text, text_len, &text_str);
+ if (exc != DOM_NO_ERR) goto out;
+
+ exc = dom_implementation_create_document(
+ DOM_IMPLEMENTATION_HTML,
+ NULL, NULL,
+ NULL,
+ NULL, NULL,
+ &doc
+ );
+ if (exc != DOM_NO_ERR) goto out;
+
+ exc = dom_implementation_create_document_type(
+ "html", NULL, NULL, &doctype);
+ if (exc != DOM_NO_ERR) goto out;
+
+ exc = dom_node_append_child(doc, doctype, &spare_ref);
+ if (exc != DOM_NO_ERR) goto out;
+ if (spare_ref != NULL) { dom_node_unref(spare_ref); spare_ref = NULL; }
+
+ exc = dom_document_create_element_ns(doc, corestring_dom_html_namespace,
+ corestring_dom_HTML, &html);
+ if (exc != DOM_NO_ERR) goto out;
+
+ exc = dom_document_create_element_ns(doc, corestring_dom_html_namespace,
+ corestring_dom_HEAD, &head);
+ if (exc != DOM_NO_ERR) goto out;
+
+ exc = dom_document_create_element_ns(doc, corestring_dom_html_namespace,
+ corestring_dom_TITLE, &title);
+ if (exc != DOM_NO_ERR) goto out;
+
+ exc = dom_document_create_element_ns(doc, corestring_dom_html_namespace,
+ corestring_dom_BODY, &body);
+ if (exc != DOM_NO_ERR) goto out;
+
+ exc = dom_node_set_text_content(title, text_str);
+ if (exc != DOM_NO_ERR) goto out;
+
+ exc = dom_node_append_child(head, title, &spare_ref);
+ if (exc != DOM_NO_ERR) goto out;
+ if (spare_ref != NULL) { dom_node_unref(spare_ref); spare_ref = NULL; }
+
+ exc = dom_node_append_child(html, head, &spare_ref);
+ if (exc != DOM_NO_ERR) goto out;
+ if (spare_ref != NULL) { dom_node_unref(spare_ref); spare_ref = NULL; }
+
+ exc = dom_node_append_child(html, body, &spare_ref);
+ if (exc != DOM_NO_ERR) goto out;
+ if (spare_ref != NULL) { dom_node_unref(spare_ref); spare_ref = NULL; }
+
+ exc = dom_node_append_child(doc, html, &spare_ref);
+ if (exc != DOM_NO_ERR) goto out;
+ if (spare_ref != NULL) { dom_node_unref(spare_ref); spare_ref = NULL; }
+
+ ret = doc;
+ doc = NULL;
+
+out:
+ if (text_str != NULL) {
+ dom_string_unref(text_str);
+ }
+ if (doc != NULL) {
+ dom_node_unref(doc);
+ }
+ if (html != NULL) {
+ dom_node_unref(html);
+ }
+ if (head != NULL) {
+ dom_node_unref(head);
+ }
+ if (title != NULL) {
+ dom_node_unref(title);
+ }
+ if (body != NULL) {
+ dom_node_unref(body);
+ }
+ if (doctype != NULL) {
+ dom_node_unref(doctype);
+ }
+ if (ret != NULL) {
+ dukky_push_node(ctx, (struct dom_node *)ret);
+ dom_node_unref(ret);
+ return 1;
+ }
+ return 0; /* Coerced to undefined */
+%}
diff --git a/content/handlers/javascript/duktape/Document.bnd
b/content/handlers/javascript/duktape/Document.bnd
index d9bff0a..de96cd8 100644
--- a/content/handlers/javascript/duktape/Document.bnd
+++ b/content/handlers/javascript/duktape/Document.bnd
@@ -433,6 +433,27 @@ method Document::createEvent ()
return 1;
%}
+getter Document::implementation ()
+%{
+ /* Create a new DOMImplementation instance */
+ duk_push_this(ctx);
+ duk_get_prop_string(ctx, -1, MAGIC(DOMImplementation));
+ if (duk_is_undefined(ctx, -1)) {
+ duk_pop(ctx);
+
+ if (dukky_create_object(ctx,
+ PROTO_NAME(DOMIMPLEMENTATION),
+ 0) != DUK_EXEC_SUCCESS) {
+ return duk_error(ctx,
+ DUK_ERR_ERROR,
+ "Unable to create dom implementation object");
+ }
+ duk_dup(ctx, -1);
+ duk_put_prop_string(ctx, -3, MAGIC(DOMImplementation));
+ }
+ return 1;
+%}
+
getter Document::onabort();
setter Document::onabort();
getter Document::onautocompleteerror();
diff --git a/content/handlers/javascript/duktape/netsurf.bnd
b/content/handlers/javascript/duktape/netsurf.bnd
index 628b2a3..30b3d4a 100644
--- a/content/handlers/javascript/duktape/netsurf.bnd
+++ b/content/handlers/javascript/duktape/netsurf.bnd
@@ -64,6 +64,7 @@ struct dom_html_br_element;
#include "HTMLCollection.bnd"
#include "Location.bnd"
#include "Navigator.bnd"
+#include "DOMImplementation.bnd"
/* events */
diff --git a/test/corestrings.c b/test/corestrings.c
index 02640c9..8690d82 100644
--- a/test/corestrings.c
+++ b/test/corestrings.c
@@ -40,7 +40,7 @@
*
* This is used to test all the out of memory paths in initialisation.
*/
-#define CORESTRING_TEST_COUNT 435
+#define CORESTRING_TEST_COUNT 480
START_TEST(corestrings_test)
{
@@ -53,8 +53,12 @@ START_TEST(corestrings_test)
res = corestrings_fini();
malloc_limit(UINT_MAX);
-
- ck_assert_int_eq(ires, NSERROR_NOMEM);
+
+ if (_i < CORESTRING_TEST_COUNT) {
+ ck_assert_int_eq(ires, NSERROR_NOMEM);
+ } else {
+ ck_assert_int_eq(ires, NSERROR_OK);
+ }
ck_assert_int_eq(res, NSERROR_OK);
}
END_TEST
@@ -65,7 +69,7 @@ static TCase *corestrings_case_create(void)
TCase *tc;
tc = tcase_create("corestrings");
- tcase_add_loop_test(tc, corestrings_test, 0, CORESTRING_TEST_COUNT);
+ tcase_add_loop_test(tc, corestrings_test, 0, CORESTRING_TEST_COUNT + 1);
return tc;
}
diff --git a/utils/corestringlist.h b/utils/corestringlist.h
index 53774ba..c9d0749 100644
--- a/utils/corestringlist.h
+++ b/utils/corestringlist.h
@@ -327,9 +327,11 @@ CORESTRING_DOM_STRING(waiting);
CORESTRING_DOM_STRING(width);
/* DOM node names, not really CSS */
CORESTRING_DOM_STRING(BUTTON);
+CORESTRING_DOM_STRING(HTML);
CORESTRING_DOM_STRING(INPUT);
CORESTRING_DOM_STRING(SELECT);
CORESTRING_DOM_STRING(TEXTAREA);
+CORESTRING_DOM_STRING(TITLE);
CORESTRING_DOM_STRING(BODY);
CORESTRING_DOM_STRING(HEAD);
CORESTRING_DOM_STRING(SCRIPT);
--
NetSurf Browser
_______________________________________________
netsurf-commits mailing list
[email protected]
http://listmaster.pepperfish.net/cgi-bin/mailman/listinfo/netsurf-commits-netsurf-browser.org