WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
159020
JSDOMIterator forEach should support second optional parameter
https://bugs.webkit.org/show_bug.cgi?id=159020
Summary
JSDOMIterator forEach should support second optional parameter
youenn fablet
Reported
2016-06-22 02:36:14 PDT
The second optional parameter should be the thisValue when calling the callback.
Attachments
Patch
(5.15 KB, patch)
2016-06-22 02:42 PDT
,
youenn fablet
no flags
Details
Formatted Diff
Diff
View All
Add attachment
proposed patch, testcase, etc.
youenn fablet
Comment 1
2016-06-22 02:42:04 PDT
Created
attachment 281830
[details]
Patch
Chris Dumez
Comment 2
2016-06-22 08:50:38 PDT
I am working on confirming that this fixes yahoo.jp.
youenn fablet
Comment 3
2016-06-22 08:52:37 PDT
Thanks!
Chris Dumez
Comment 4
2016-06-22 09:33:33 PDT
Hmm, yahoo.co.jp is still broken with this patch but the JS error is different: [Error] TypeError: undefined is not an object (evaluating 'o.removeClass') (anonymous function) (mtop-page-top.js:662:1513) f (mtop-page-top.js:14:886)
youenn fablet
Comment 5
2016-06-22 09:38:22 PDT
(In reply to
comment #4
)
> Hmm, yahoo.co.jp is still broken with this patch but the JS error is > different: > > [Error] TypeError: undefined is not an object (evaluating 'o.removeClass') > (anonymous function) (mtop-page-top.js:662:1513) > f (mtop-page-top.js:14:886)
Do you have a link to mtop-page-top.js?
Chris Dumez
Comment 6
2016-06-22 09:41:40 PDT
(In reply to
comment #5
)
> (In reply to
comment #4
) > > Hmm, yahoo.co.jp is still broken with this patch but the JS error is > > different: > > > > [Error] TypeError: undefined is not an object (evaluating 'o.removeClass') > > (anonymous function) (mtop-page-top.js:662:1513) > > f (mtop-page-top.js:14:886) > > Do you have a link to mtop-page-top.js?
Full URL:
http://i.yimg.jp/images/mtop/4.5.38/js/standalone/mtop-page-top.js
Note that commenting out the "iterable<Node>;" in NodeList.idl does not seem to help either :/
Chris Dumez
Comment 7
2016-06-22 09:49:48 PDT
(In reply to
comment #6
)
> (In reply to
comment #5
) > > (In reply to
comment #4
) > > > Hmm, yahoo.co.jp is still broken with this patch but the JS error is > > > different: > > > > > > [Error] TypeError: undefined is not an object (evaluating 'o.removeClass') > > > (anonymous function) (mtop-page-top.js:662:1513) > > > f (mtop-page-top.js:14:886) > > > > Do you have a link to mtop-page-top.js? > > Full URL: >
http://i.yimg.jp/images/mtop/4.5.38/js/standalone/mtop-page-top.js
> > Note that commenting out the "iterable<Node>;" in NodeList.idl does not seem > to help either :/
Commenting out "iterable<FontFace>;" on FontFaceSet does not unbreak yahoo.co.jp either :( So I believe I have commented out all the iterables and the site is still broken. It is possible that: 1. There are several bugs and the iterable one hid another one that landed later on. 2. The patch for iterable support changed the behavior of code not strictly related to iterable
youenn fablet
Comment 8
2016-06-22 09:50:46 PDT
(In reply to
comment #6
)
> (In reply to
comment #5
) > > (In reply to
comment #4
) > > > Hmm, yahoo.co.jp is still broken with this patch but the JS error is > > > different: > > > > > > [Error] TypeError: undefined is not an object (evaluating 'o.removeClass') > > > (anonymous function) (mtop-page-top.js:662:1513) > > > f (mtop-page-top.js:14:886) > > > > Do you have a link to mtop-page-top.js? > > Full URL: >
http://i.yimg.jp/images/mtop/4.5.38/js/standalone/mtop-page-top.js
> > Note that commenting out the "iterable<Node>;" in NodeList.idl does not seem > to help either :/
Is the page working if only forEach property is removed from JSNodeListPrototypeTableValues in JSNodeList.cpp?
Chris Dumez
Comment 9
2016-06-22 09:54:41 PDT
(In reply to
comment #8
)
> (In reply to
comment #6
) > > (In reply to
comment #5
) > > > (In reply to
comment #4
) > > > > Hmm, yahoo.co.jp is still broken with this patch but the JS error is > > > > different: > > > > > > > > [Error] TypeError: undefined is not an object (evaluating 'o.removeClass') > > > > (anonymous function) (mtop-page-top.js:662:1513) > > > > f (mtop-page-top.js:14:886) > > > > > > Do you have a link to mtop-page-top.js? > > > > Full URL: > >
http://i.yimg.jp/images/mtop/4.5.38/js/standalone/mtop-page-top.js
> > > > Note that commenting out the "iterable<Node>;" in NodeList.idl does not seem > > to help either :/ > > Is the page working if only forEach property is removed from > JSNodeListPrototypeTableValues in JSNodeList.cpp?
Not sure I understand the question, I commented out the whole "iterable<Node>;" in NodeList so there is no forEach property in JSNodeList.cpp already.
youenn fablet
Comment 10
2016-06-22 09:56:52 PDT
> Not sure I understand the question, I commented out the whole > "iterable<Node>;" in NodeList so there is no forEach property in > JSNodeList.cpp already.
iterable<Node> also triggers methods like keys, values which may or may not be used in the code.
Chris Dumez
Comment 11
2016-06-22 09:59:33 PDT
(In reply to
comment #10
)
> > Not sure I understand the question, I commented out the whole > > "iterable<Node>;" in NodeList so there is no forEach property in > > JSNodeList.cpp already. > > iterable<Node> also triggers methods like keys, values which may or may not > be used in the code.
Hmm, ok but the site was working before <
http://trac.webkit.org/changeset/200619
> where you added iterable<> on NodeList.
youenn fablet
Comment 12
2016-06-22 10:03:06 PDT
(In reply to
comment #11
)
> (In reply to
comment #10
) > > > Not sure I understand the question, I commented out the whole > > > "iterable<Node>;" in NodeList so there is no forEach property in > > > JSNodeList.cpp already. > > > > iterable<Node> also triggers methods like keys, values which may or may not > > be used in the code. > > Hmm, ok but the site was working before > <
http://trac.webkit.org/changeset/200619
> where you added iterable<> on > NodeList.
Can you describe what means "the site is working" vs "the site is not working"? That might help me trying to investigate further the issue on my local machine.
Chris Dumez
Comment 13
2016-06-22 10:06:53 PDT
(In reply to
comment #12
)
> (In reply to
comment #11
) > > (In reply to
comment #10
) > > > > Not sure I understand the question, I commented out the whole > > > > "iterable<Node>;" in NodeList so there is no forEach property in > > > > JSNodeList.cpp already. > > > > > > iterable<Node> also triggers methods like keys, values which may or may not > > > be used in the code. > > > > Hmm, ok but the site was working before > > <
http://trac.webkit.org/changeset/200619
> where you added iterable<> on > > NodeList. > > Can you describe what means "the site is working" vs "the site is not > working"? > That might help me trying to investigate further the issue on my local > machine.
This was explained on the other bug. The site content at the bottom of the page no longer loads, we just see a spinner. You may be able to reproduce in a simulator.
Chris Dumez
Comment 14
2016-06-22 10:08:33 PDT
(In reply to
comment #9
)
> (In reply to
comment #8
) > > (In reply to
comment #6
) > > > (In reply to
comment #5
) > > > > (In reply to
comment #4
) > > > > > Hmm, yahoo.co.jp is still broken with this patch but the JS error is > > > > > different: > > > > > > > > > > [Error] TypeError: undefined is not an object (evaluating 'o.removeClass') > > > > > (anonymous function) (mtop-page-top.js:662:1513) > > > > > f (mtop-page-top.js:14:886) > > > > > > > > Do you have a link to mtop-page-top.js? > > > > > > Full URL: > > >
http://i.yimg.jp/images/mtop/4.5.38/js/standalone/mtop-page-top.js
> > > > > > Note that commenting out the "iterable<Node>;" in NodeList.idl does not seem > > > to help either :/ > > > > Is the page working if only forEach property is removed from > > JSNodeListPrototypeTableValues in JSNodeList.cpp? > > Not sure I understand the question, I commented out the whole > "iterable<Node>;" in NodeList so there is no forEach property in > JSNodeList.cpp already.
I tried dropping just the forEach property and it did not help.
youenn fablet
Comment 15
2016-06-22 10:18:32 PDT
(In reply to
comment #13
)
> (In reply to
comment #12
) > > (In reply to
comment #11
) > > > (In reply to
comment #10
) > > > > > Not sure I understand the question, I commented out the whole > > > > > "iterable<Node>;" in NodeList so there is no forEach property in > > > > > JSNodeList.cpp already. > > > > > > > > iterable<Node> also triggers methods like keys, values which may or may not > > > > be used in the code. > > > > > > Hmm, ok but the site was working before > > > <
http://trac.webkit.org/changeset/200619
> where you added iterable<> on > > > NodeList. > > > > Can you describe what means "the site is working" vs "the site is not > > working"? > > That might help me trying to investigate further the issue on my local > > machine. > > This was explained on the other bug. The site content at the bottom of the > page no longer loads, we just see a spinner. You may be able to reproduce in > a simulator.
I tried on mini browser this morning but was not sure what to search for. I will try again.
Chris Dumez
Comment 16
2016-06-22 10:20:19 PDT
(In reply to
comment #15
)
> (In reply to
comment #13
) > > (In reply to
comment #12
) > > > (In reply to
comment #11
) > > > > (In reply to
comment #10
) > > > > > > Not sure I understand the question, I commented out the whole > > > > > > "iterable<Node>;" in NodeList so there is no forEach property in > > > > > > JSNodeList.cpp already. > > > > > > > > > > iterable<Node> also triggers methods like keys, values which may or may not > > > > > be used in the code. > > > > > > > > Hmm, ok but the site was working before > > > > <
http://trac.webkit.org/changeset/200619
> where you added iterable<> on > > > > NodeList. > > > > > > Can you describe what means "the site is working" vs "the site is not > > > working"? > > > That might help me trying to investigate further the issue on my local > > > machine. > > > > This was explained on the other bug. The site content at the bottom of the > > page no longer loads, we just see a spinner. You may be able to reproduce in > > a simulator. > > I tried on mini browser this morning but was not sure what to search for. > I will try again.
FYI, I am doing more testing. It seems I can no longer reproduce for some reason. Trying to figure out what I changed.
Chris Dumez
Comment 17
2016-06-22 10:22:13 PDT
(In reply to
comment #15
)
> (In reply to
comment #13
) > > (In reply to
comment #12
) > > > (In reply to
comment #11
) > > > > (In reply to
comment #10
) > > > > > > Not sure I understand the question, I commented out the whole > > > > > > "iterable<Node>;" in NodeList so there is no forEach property in > > > > > > JSNodeList.cpp already. > > > > > > > > > > iterable<Node> also triggers methods like keys, values which may or may not > > > > > be used in the code. > > > > > > > > Hmm, ok but the site was working before > > > > <
http://trac.webkit.org/changeset/200619
> where you added iterable<> on > > > > NodeList. > > > > > > Can you describe what means "the site is working" vs "the site is not > > > working"? > > > That might help me trying to investigate further the issue on my local > > > machine. > > > > This was explained on the other bug. The site content at the bottom of the > > page no longer loads, we just see a spinner. You may be able to reproduce in > > a simulator. > > I tried on mini browser this morning but was not sure what to search for. > I will try again.
This is on iOS with the mobile site.
Chris Dumez
Comment 18
2016-06-22 10:32:02 PDT
So I cannot reproduce the bottom of the site not loading anymore. However, I can confirm that the forEach() JS exceptions are present without the patch attached to this bug and that they're gone with the patch. Therefore, I think yahoo.co.jp does require the support for the second parameter on forEach and we should land your patch.
Chris Dumez
Comment 19
2016-06-22 10:34:15 PDT
Comment on
attachment 281830
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=281830&action=review
> LayoutTests/fast/dom/nodeListIterator.html:51 > + shouldBe('thisValue', 'window');
Looking at the spec (
http://heycam.github.io/webidl/#es-forEach
), shouldn't this be undefined rather than window?
Chris Dumez
Comment 20
2016-06-22 10:34:45 PDT
Comment on
attachment 281830
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=281830&action=review
>> LayoutTests/fast/dom/nodeListIterator.html:51 >> + shouldBe('thisValue', 'window'); > > Looking at the spec (
http://heycam.github.io/webidl/#es-forEach
), shouldn't this be undefined rather than window?
Referring to step 4.4 Invoke callback with thisArg (or undefined, if the argument was not supplied) as the callback this value and value, key and O as its arguments.
Chris Dumez
Comment 21
2016-06-22 10:36:34 PDT
Comment on
attachment 281830
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=281830&action=review
>>> LayoutTests/fast/dom/nodeListIterator.html:51 >>> + shouldBe('thisValue', 'window'); >> >> Looking at the spec (
http://heycam.github.io/webidl/#es-forEach
), shouldn't this be undefined rather than window? > > Referring to step 4.4 Invoke callback with thisArg (or undefined, if the argument was not supplied) as the callback this value and value, key and O as its arguments.
Hmm, Chrome seems to agree with you though..
Chris Dumez
Comment 22
2016-06-22 10:42:05 PDT
Comment on
attachment 281830
[details]
Patch Nevermind, I am mis-interpreting the spec. You do call JSC::call() with undefined as thisValue in this case.
Chris Dumez
Comment 23
2016-06-22 10:49:53 PDT
Note that on Chrome, a few checks are failing: FAIL iterator.next().value should be [object HTMLDivElement] (of type object). Was 0 (of type number). FAIL iterator.next().value should be [object HTMLOListElement] (of type object). Was 1 (of type number). I have checked yet who is right.
Chris Dumez
Comment 24
2016-06-22 10:50:27 PDT
Comment on
attachment 281830
[details]
Patch Clearing flags on attachment: 281830 Committed
r202334
: <
http://trac.webkit.org/changeset/202334
>
Chris Dumez
Comment 25
2016-06-22 10:50:32 PDT
All reviewed patches have been landed. Closing bug.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug