Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DOM iterables #488

Closed
classilla opened this issue Mar 19, 2018 · 9 comments
Closed

DOM iterables #488

classilla opened this issue Mar 19, 2018 · 9 comments

Comments

@classilla
Copy link
Owner

Bugzilla keeps spamming error logs with

JavaScript error: https://bugzilla.mozilla.org/static/v20180306.4/js/global.js, line 209: TypeError: document.querySelectorAll(...).forEach is not a function

We need https://bugzilla.mozilla.org/show_bug.cgi?id=1290636, but this requires https://bugzilla.mozilla.org/show_bug.cgi?id=1216751 to actually implement the plumbing in the DOM bindings and webIDL. However, this is quite doable. The patches should "just work" since the basic support landed in Fx47.

@classilla
Copy link
Owner Author

@classilla
Copy link
Owner Author

classilla commented Mar 21, 2018

Implemented.
NodeList passes https://w3c-test.org/dom/nodes/NodeList-Iterable.html
DOMTokenList only fails one test https://w3c-test.org/dom/lists/DOMTokenList-Iterable.html but it is not a regression. It would be nice to see if we could get DOMTokenList fully working.

@classilla
Copy link
Owner Author

I think we need https://bugzilla.mozilla.org/show_bug.cgi?id=869788 based on the test:

<!doctype html>
<meta charset="utf-8">
<title>DOMTokenList Iterable Test</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<span class="foo   Foo foo   "></span>
<script>
    var elementClasses;
    setup(function() {
        elementClasses = document.querySelector("span").classList;
    })
    test(function() {
        assert_true('length' in elementClasses);
    }, 'DOMTokenList has length method.');
    test(function() {
        assert_true('values' in elementClasses);
    }, 'DOMTokenList has values method.');
    test(function() {
        assert_true('entries' in elementClasses);
    }, 'DOMTokenList has entries method.');
    test(function() {
        assert_true('forEach' in elementClasses);
    }, 'DOMTokenList has forEach method.');
    test(function() {
        assert_true(Symbol.iterator in elementClasses);
    }, 'DOMTokenList has Symbol.iterator.');
    test(function() {
        var classList = [];
        for (var className of elementClasses){
            classList.push(className);
        }
        assert_array_equals(classList, ['foo', 'Foo']);
    }, 'DOMTokenList is iterable via for-of loop.');
</script>

Notice the spaces and duplicate names.

classilla added a commit that referenced this issue Mar 21, 2018
@classilla
Copy link
Owner Author

Also doing https://bugzilla.mozilla.org/show_bug.cgi?id=1257849 since I'm already in there and I'm all for stuff that facilitates better auto-detection of features.

@classilla
Copy link
Owner Author

Aaaand that needs bug 1244328. https://hg.mozilla.org/mozilla-central/rev/aac070f65cc7

@classilla
Copy link
Owner Author

Passes tests, doesn't assert, job well done.

@roytam1
Copy link

roytam1 commented May 11, 2023

This cause browser crash when accessing apple.com

@roytam1
Copy link

roytam1 commented Aug 25, 2023

hmm, trying to do a debug build to debug apple.com crash, and it asserts within JSOP_SUPERBASE.
it won't crash with following hack:

diff --git a/js/src/vm/Interpreter.cpp b/js/src/vm/Interpreter.cpp
index 4bf6e96cf..526e17e34 100644
--- a/js/src/vm/Interpreter.cpp
+++ b/js/src/vm/Interpreter.cpp
@@ -3851,6 +3851,7 @@ END_CASE(JSOP_INITHOMEOBJECT)
 CASE(JSOP_SUPERBASE)
 {
     JSFunction& superEnvFunc = GetSuperEnvFunction(cx, REGS);
+    if(!superEnvFunc.allowSuperProperty()) goto error;
     MOZ_ASSERT(superEnvFunc.allowSuperProperty());
     MOZ_ASSERT(superEnvFunc.nonLazyScript()->needsHomeObject());
     const Value& homeObjVal = superEnvFunc.getExtendedSlot(FunctionExtended::METHOD_HOMEOBJECT_SLOT);

@classilla
Copy link
Owner Author

It's probably as good a fix as any since it's likely throwing anyhow.

classilla added a commit that referenced this issue Aug 31, 2023
…; update usrsctp; security pullup; more comprehensive nuisance script blocking; fixes for #488, #566
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants