Bug 161455 - Align proto getter / setter behavior with other browsers
Summary: Align proto getter / setter behavior with other browsers
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Chris Dumez
URL:
Keywords: WebExposed
: 161508 (view as bug list)
Depends on: 161558 161982
Blocks:
  Show dependency treegraph
 
Reported: 2016-08-31 13:43 PDT by Chris Dumez
Modified: 2016-09-14 13:19 PDT (History)
13 users (show)

See Also:


Attachments
Patch (9.73 KB, patch)
2016-08-31 14:07 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff
Patch (53.56 KB, patch)
2016-09-01 21:21 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff
Patch (51.99 KB, patch)
2016-09-01 22:13 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from ews101 for mac-yosemite (871.01 KB, application/zip)
2016-09-01 23:14 PDT, Build Bot
no flags Details
Archive of layout-test-results from ews106 for mac-yosemite-wk2 (917.45 KB, application/zip)
2016-09-01 23:20 PDT, Build Bot
no flags Details
Archive of layout-test-results from ews114 for mac-yosemite (1.51 MB, application/zip)
2016-09-01 23:23 PDT, Build Bot
no flags Details
Archive of layout-test-results from ews122 for ios-simulator-elcapitan-wk2 (4.24 MB, application/zip)
2016-09-01 23:55 PDT, Build Bot
no flags Details
Patch (59.70 KB, patch)
2016-09-02 08:51 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff
Patch (59.83 KB, patch)
2016-09-02 10:34 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff
Follow-up fix (1.66 KB, patch)
2016-09-02 14:15 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff
Follow-up fix (1.66 KB, patch)
2016-09-02 14:25 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff
Patch (60.42 KB, patch)
2016-09-07 08:54 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff
Patch (56.35 KB, patch)
2016-09-07 09:34 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from ews102 for mac-yosemite (1.07 MB, application/zip)
2016-09-07 10:40 PDT, Build Bot
no flags Details
Archive of layout-test-results from ews105 for mac-yosemite-wk2 (1.02 MB, application/zip)
2016-09-07 10:46 PDT, Build Bot
no flags Details
Archive of layout-test-results from ews115 for mac-yosemite (1.49 MB, application/zip)
2016-09-07 10:50 PDT, Build Bot
no flags Details
Archive of layout-test-results from ews123 for ios-simulator-elcapitan-wk2 (9.12 MB, application/zip)
2016-09-07 10:55 PDT, Build Bot
no flags Details
Patch (60.44 KB, patch)
2016-09-07 11:54 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff
Patch (60.75 KB, patch)
2016-09-07 13:17 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff
Patch (61.08 KB, patch)
2016-09-08 14:30 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff
Patch (61.07 KB, patch)
2016-09-08 14:40 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff
Patch (61.08 KB, patch)
2016-09-08 14:43 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Comment 1 Chris Dumez 2016-08-31 14:07:53 PDT
Created attachment 287541 [details]
Patch
Comment 3 Mark Lam 2016-09-01 09:57:14 PDT
Comment on attachment 287541 [details]
Patch

r=me
Comment 4 Chris Dumez 2016-09-01 10:50:20 PDT
Comment on attachment 287541 [details]
Patch

Clearing flags on attachment: 287541

Committed r205297: <http://trac.webkit.org/changeset/205297>
Comment 5 Chris Dumez 2016-09-01 10:50:28 PDT
All reviewed patches have been landed.  Closing bug.
Comment 6 Chris Dumez 2016-09-01 11:36:07 PDT
Reverted r205297 for reason:

Caused some JSC test failures

Committed r205301: <http://trac.webkit.org/changeset/205301>
Comment 7 Chris Dumez 2016-09-01 21:21:41 PDT
Created attachment 287728 [details]
Patch
Comment 8 Chris Dumez 2016-09-01 22:13:18 PDT
Created attachment 287730 [details]
Patch
Comment 9 Chris Dumez 2016-09-01 22:17:36 PDT
Comment on attachment 287730 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=287730&action=review

> Source/JavaScriptCore/runtime/JSObject.cpp:1382
> +        // if (UNLIKELY(asObject(nextPrototype)->methodTable(vm)->getPrototype != JSObject::getPrototype))

I am proposing to comment this out for now. There are a lot of places in the code base where we iterate over the prototype chain and do not handle cycles. Allowing for cycles would be a significant amount of work.
Comment 10 Build Bot 2016-09-01 23:14:11 PDT
Comment on attachment 287730 [details]
Patch

Attachment 287730 [details] did not pass mac-ews (mac):
Output: http://webkit-queues.webkit.org/results/1991935

New failing tests:
fast/dom/Window/window-custom-prototype.html
js/object-literal-shorthand-construction.html
js/sloppy-getter-setter-global-object.html
fast/dom/Window/window-custom-prototype-crash.html
Comment 11 Build Bot 2016-09-01 23:14:16 PDT
Created attachment 287737 [details]
Archive of layout-test-results from ews101 for mac-yosemite

The attached test failures were seen while running run-webkit-tests on the mac-ews.
Bot: ews101  Port: mac-yosemite  Platform: Mac OS X 10.10.5
Comment 12 Build Bot 2016-09-01 23:19:54 PDT
Comment on attachment 287730 [details]
Patch

Attachment 287730 [details] did not pass mac-wk2-ews (mac-wk2):
Output: http://webkit-queues.webkit.org/results/1991946

New failing tests:
fast/dom/Window/window-custom-prototype.html
js/object-literal-shorthand-construction.html
js/sloppy-getter-setter-global-object.html
fast/dom/Window/window-custom-prototype-crash.html
Comment 13 Build Bot 2016-09-01 23:20:00 PDT
Created attachment 287739 [details]
Archive of layout-test-results from ews106 for mac-yosemite-wk2

The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews.
Bot: ews106  Port: mac-yosemite-wk2  Platform: Mac OS X 10.10.5
Comment 14 Build Bot 2016-09-01 23:23:08 PDT
Comment on attachment 287730 [details]
Patch

Attachment 287730 [details] did not pass mac-debug-ews (mac):
Output: http://webkit-queues.webkit.org/results/1991940

New failing tests:
fast/dom/Window/window-custom-prototype.html
js/object-literal-shorthand-construction.html
js/sloppy-getter-setter-global-object.html
fast/dom/Window/window-custom-prototype-crash.html
Comment 15 Build Bot 2016-09-01 23:23:15 PDT
Created attachment 287740 [details]
Archive of layout-test-results from ews114 for mac-yosemite

The attached test failures were seen while running run-webkit-tests on the mac-debug-ews.
Bot: ews114  Port: mac-yosemite  Platform: Mac OS X 10.10.5
Comment 16 Build Bot 2016-09-01 23:55:05 PDT
Comment on attachment 287730 [details]
Patch

Attachment 287730 [details] did not pass ios-sim-ews (ios-simulator-wk2):
Output: http://webkit-queues.webkit.org/results/1991980

New failing tests:
fast/dom/Window/window-custom-prototype.html
js/object-literal-shorthand-construction.html
js/sloppy-getter-setter-global-object.html
fast/dom/Window/window-custom-prototype-crash.html
Comment 17 Build Bot 2016-09-01 23:55:10 PDT
Created attachment 287745 [details]
Archive of layout-test-results from ews122 for ios-simulator-elcapitan-wk2

The attached test failures were seen while running run-webkit-tests on the ios-sim-ews.
Bot: ews122  Port: ios-simulator-elcapitan-wk2  Platform: Mac OS X 10.11.5
Comment 18 Chris Dumez 2016-09-02 08:51:43 PDT
Created attachment 287762 [details]
Patch
Comment 19 Chris Dumez 2016-09-02 09:47:33 PDT
Comment on attachment 287762 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=287762&action=review

> Source/JavaScriptCore/runtime/JSObject.cpp:1380
> +        // FIXME: The specification says we should do this but this allows for cycles and our

I filed https://bugs.webkit.org/show_bug.cgi?id=161534 to track this.
Comment 20 Mark Lam 2016-09-02 10:21:23 PDT
Comment on attachment 287762 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=287762&action=review

r=me

> Source/JavaScriptCore/ChangeLog:52
> +        html/browsers/history/the-location-interface/allow_prototype_cycle_through_location.sub.html

Please add the https://bugs.webkit.org/show_bug.cgi?id=161534 url after this for reference.

>> Source/JavaScriptCore/runtime/JSObject.cpp:1380
>> +        // FIXME: The specification says we should do this but this allows for cycles and our
> 
> I filed https://bugs.webkit.org/show_bug.cgi?id=161534 to track this.

Please add the bug url in the comment here.
Comment 21 Chris Dumez 2016-09-02 10:34:23 PDT
Created attachment 287773 [details]
Patch
Comment 22 WebKit Commit Bot 2016-09-02 11:06:20 PDT
Comment on attachment 287773 [details]
Patch

Clearing flags on attachment: 287773

Committed r205354: <http://trac.webkit.org/changeset/205354>
Comment 23 WebKit Commit Bot 2016-09-02 11:06:29 PDT
All reviewed patches have been landed.  Closing bug.
Comment 24 Chris Dumez 2016-09-02 11:42:37 PDT
*** Bug 161508 has been marked as a duplicate of this bug. ***
Comment 25 Saam Barati 2016-09-02 13:04:48 PDT
Comment on attachment 287773 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=287773&action=review

> Source/JavaScriptCore/runtime/JSObject.cpp:1384
> +        // if (UNLIKELY(asObject(nextPrototype)->methodTable(vm)->getPrototype != JSObject::getPrototype))
> +        //    break; // We're done. Set the prototype.

I don't think this is how we land changes in JSC. We don't turn things off to allow for other features to be added in WebCore. I think the onus is on your patch to ensure that anything new you're adding is safe.
Comment 26 Geoffrey Garen 2016-09-02 13:07:00 PDT
Comment on attachment 287773 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=287773&action=review

>> Source/JavaScriptCore/runtime/JSObject.cpp:1384
>> +        //    break; // We're done. Set the prototype.
> 
> I don't think this is how we land changes in JSC. We don't turn things off to allow for other features to be added in WebCore. I think the onus is on your patch to ensure that anything new you're adding is safe.

Behavior decision notwithstanding, we definitely don't want to land a paragraph of commented-out code.
Comment 27 Chris Dumez 2016-09-02 13:08:19 PDT
(In reply to comment #25)
> Comment on attachment 287773 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=287773&action=review
> 
> > Source/JavaScriptCore/runtime/JSObject.cpp:1384
> > +        // if (UNLIKELY(asObject(nextPrototype)->methodTable(vm)->getPrototype != JSObject::getPrototype))
> > +        //    break; // We're done. Set the prototype.
> 
> I don't think this is how we land changes in JSC. We don't turn things off
> to allow for other features to be added in WebCore. I think the onus is on
> your patch to ensure that anything new you're adding is safe.

Updating the code base to properly deal with cycles is not a trivial task and there are performance implications :/
Comment 28 Saam Barati 2016-09-02 13:19:22 PDT
Comment on attachment 287773 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=287773&action=review

>>>> Source/JavaScriptCore/runtime/JSObject.cpp:1384
>>>> +        //    break; // We're done. Set the prototype.
>>> 
>>> I don't think this is how we land changes in JSC. We don't turn things off to allow for other features to be added in WebCore. I think the onus is on your patch to ensure that anything new you're adding is safe.
>> 
>> Behavior decision notwithstanding, we definitely don't want to land a paragraph of commented-out code.
> 
> Updating the code base to properly deal with cycles is not a trivial task and there are performance implications :/

I understand. Maybe this is the correct decision. However, I think we need to have a deeper discussion about this to fully realize all the implications.
Comment 29 Chris Dumez 2016-09-02 14:00:20 PDT
Reopen to deal with JSC test failures.
Comment 30 Chris Dumez 2016-09-02 14:15:56 PDT
Created attachment 287813 [details]
Follow-up fix

Still running the tests locally.
Comment 31 Chris Dumez 2016-09-02 14:25:28 PDT
Reopen to deal with JSC test failures.
Comment 32 Chris Dumez 2016-09-02 14:25:52 PDT
Created attachment 287815 [details]
Follow-up fix
Comment 33 WebKit Commit Bot 2016-09-02 14:28:16 PDT
Attachment 287815 [details] did not pass style-queue:


ERROR: Source/JavaScriptCore/ChangeLog:1:  ChangeLog entry has no bug number  [changelog/bugnumber] [5]
Total errors found: 1 in 2 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 34 Chris Dumez 2016-09-02 14:45:22 PDT
Rolled out in <http://trac.webkit.org/changeset/205372>.
Comment 35 Chris Dumez 2016-09-07 08:54:57 PDT
Created attachment 288139 [details]
Patch
Comment 36 Chris Dumez 2016-09-07 09:34:45 PDT
Created attachment 288146 [details]
Patch
Comment 37 Build Bot 2016-09-07 10:40:43 PDT
Comment on attachment 288146 [details]
Patch

Attachment 288146 [details] did not pass mac-ews (mac):
Output: http://webkit-queues.webkit.org/results/2026461

New failing tests:
js/object-literal-shorthand-construction.html
js/sloppy-getter-setter-global-object.html
Comment 38 Build Bot 2016-09-07 10:40:49 PDT
Created attachment 288157 [details]
Archive of layout-test-results from ews102 for mac-yosemite

The attached test failures were seen while running run-webkit-tests on the mac-ews.
Bot: ews102  Port: mac-yosemite  Platform: Mac OS X 10.10.5
Comment 39 Build Bot 2016-09-07 10:46:38 PDT
Comment on attachment 288146 [details]
Patch

Attachment 288146 [details] did not pass mac-wk2-ews (mac-wk2):
Output: http://webkit-queues.webkit.org/results/2026481

New failing tests:
js/object-literal-shorthand-construction.html
js/sloppy-getter-setter-global-object.html
Comment 40 Build Bot 2016-09-07 10:46:43 PDT
Created attachment 288159 [details]
Archive of layout-test-results from ews105 for mac-yosemite-wk2

The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews.
Bot: ews105  Port: mac-yosemite-wk2  Platform: Mac OS X 10.10.5
Comment 41 Build Bot 2016-09-07 10:50:11 PDT
Comment on attachment 288146 [details]
Patch

Attachment 288146 [details] did not pass mac-debug-ews (mac):
Output: http://webkit-queues.webkit.org/results/2026480

New failing tests:
js/object-literal-shorthand-construction.html
js/sloppy-getter-setter-global-object.html
Comment 42 Build Bot 2016-09-07 10:50:18 PDT
Created attachment 288160 [details]
Archive of layout-test-results from ews115 for mac-yosemite

The attached test failures were seen while running run-webkit-tests on the mac-debug-ews.
Bot: ews115  Port: mac-yosemite  Platform: Mac OS X 10.10.5
Comment 43 Build Bot 2016-09-07 10:55:45 PDT
Comment on attachment 288146 [details]
Patch

Attachment 288146 [details] did not pass ios-sim-ews (ios-simulator-wk2):
Output: http://webkit-queues.webkit.org/results/2026482

New failing tests:
js/object-literal-shorthand-construction.html
js/sloppy-getter-setter-global-object.html
Comment 44 Build Bot 2016-09-07 10:55:51 PDT
Created attachment 288161 [details]
Archive of layout-test-results from ews123 for ios-simulator-elcapitan-wk2

The attached test failures were seen while running run-webkit-tests on the ios-sim-ews.
Bot: ews123  Port: ios-simulator-elcapitan-wk2  Platform: Mac OS X 10.11.5
Comment 45 Chris Dumez 2016-09-07 11:54:29 PDT
Created attachment 288163 [details]
Patch
Comment 46 Chris Dumez 2016-09-07 13:17:19 PDT
Created attachment 288176 [details]
Patch
Comment 47 Chris Dumez 2016-09-07 13:22:13 PDT
I have verified that this passes the JSC tests now that the fix for Bug 161558 has landed.
Comment 48 Chris Dumez 2016-09-07 16:41:21 PDT
Any feedback from JSC people?
Comment 49 Saam Barati 2016-09-07 17:46:48 PDT
Comment on attachment 288176 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=288176&action=review

> Source/JavaScriptCore/runtime/JSObject.cpp:1313
> +        // FIXME: The specification says we should do this but this allows for cycles and our
> +        // code base currently does not deal properly with such cycles.
> +        // https://bugs.webkit.org/show_bug.cgi?id=161534

Any word from the folks who work on the html spec on this?
Comment 50 Chris Dumez 2016-09-07 18:40:40 PDT
(In reply to comment #49)
> Comment on attachment 288176 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=288176&action=review
> 
> > Source/JavaScriptCore/runtime/JSObject.cpp:1313
> > +        // FIXME: The specification says we should do this but this allows for cycles and our
> > +        // code base currently does not deal properly with such cycles.
> > +        // https://bugs.webkit.org/show_bug.cgi?id=161534
> 
> Any word from the folks who work on the html spec on this?

Domenic, an HTML spec editor, already commented on the bug you filed against EcmaScript.
Comment 51 Chris Dumez 2016-09-07 18:51:40 PDT
(In reply to comment #50)
> (In reply to comment #49)
> > Comment on attachment 288176 [details]
> > Patch
> > 
> > View in context:
> > https://bugs.webkit.org/attachment.cgi?id=288176&action=review
> > 
> > > Source/JavaScriptCore/runtime/JSObject.cpp:1313
> > > +        // FIXME: The specification says we should do this but this allows for cycles and our
> > > +        // code base currently does not deal properly with such cycles.
> > > +        // https://bugs.webkit.org/show_bug.cgi?id=161534
> > 
> > Any word from the folks who work on the html spec on this?
> 
> Domenic, an HTML spec editor, already commented on the bug you filed against
> EcmaScript.

That said, I filed https://github.com/whatwg/html/issues/1760 to track the issue on HTML side as well.
Comment 52 Chris Dumez 2016-09-07 19:14:57 PDT
Comment on attachment 288176 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=288176&action=review

>>>> Source/JavaScriptCore/runtime/JSObject.cpp:1313
>>>> +        // https://bugs.webkit.org/show_bug.cgi?id=161534
>>> 
>>> Any word from the folks who work on the html spec on this?
>> 
>> Domenic, an HTML spec editor, already commented on the bug you filed against EcmaScript.
> 
> That said, I filed https://github.com/whatwg/html/issues/1760 to track the issue on HTML side as well.

If you'd prefer, we could do something like:
if (UNLIKELY(nextPrototype->type() == ProxyObjectType))
    break; // We're done. Set the prototype.

to maintain the previous behavior. Only ProxyObject in JSC has a custom [[GetPrototypeOf]] it seems.

What do you think?
Comment 53 Chris Dumez 2016-09-08 14:30:23 PDT
Created attachment 288321 [details]
Patch
Comment 54 Saam Barati 2016-09-08 14:36:29 PDT
Comment on attachment 288321 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=288321&action=review

r=me

> Source/WebCore/bindings/js/JSDOMWindowCustom.cpp:365
> +        throwTypeError(exec, scope, ASCIILiteral("Cannot set prototype of this object"));

Nit: instead of "this object" maybe it's worth having a more detailed error message?

> Source/WebCore/bindings/js/JSLocationCustom.cpp:145
> +        throwTypeError(exec, scope, ASCIILiteral("Cannot set prototype of this object"));

ditto
Comment 55 Chris Dumez 2016-09-08 14:40:25 PDT
Created attachment 288325 [details]
Patch
Comment 56 Chris Dumez 2016-09-08 14:43:32 PDT
Created attachment 288328 [details]
Patch
Comment 57 WebKit Commit Bot 2016-09-08 15:32:28 PDT
Comment on attachment 288328 [details]
Patch

Clearing flags on attachment: 288328

Committed r205670: <http://trac.webkit.org/changeset/205670>
Comment 58 WebKit Commit Bot 2016-09-08 15:32:36 PDT
All reviewed patches have been landed.  Closing bug.