Bug 154120 - [Web IDL] Operations should be on the instance for global objects or if [Unforgeable]
Summary: [Web IDL] Operations should be on the instance for global objects or if [Unfo...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Bindings (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Chris Dumez
URL: http://heycam.github.io/webidl/#es-op...
Keywords: InRadar, WebExposed
Depends on: 154270 154330 154357
Blocks: 154102
  Show dependency treegraph
 
Reported: 2016-02-11 12:06 PST by Chris Dumez
Modified: 2016-02-17 13:52 PST (History)
16 users (show)

See Also:


Attachments
WIP Patch (26.43 KB, patch)
2016-02-11 23:16 PST, Chris Dumez
buildbot: commit-queue-
Details | Formatted Diff | Diff
Archive of layout-test-results from ews102 for mac-yosemite (deleted)
2016-02-12 00:28 PST, Build Bot
no flags Details
Archive of layout-test-results from ews104 for mac-yosemite-wk2 (deleted)
2016-02-12 00:30 PST, Build Bot
no flags Details
Archive of layout-test-results from ews114 for mac-yosemite (deleted)
2016-02-12 00:37 PST, Build Bot
no flags Details
WIP Patch (25.44 KB, patch)
2016-02-12 13:45 PST, Chris Dumez
no flags Details | Formatted Diff | Diff
WIP Patch (25.35 KB, patch)
2016-02-12 13:51 PST, Chris Dumez
buildbot: commit-queue-
Details | Formatted Diff | Diff
Archive of layout-test-results from ews103 for mac-yosemite (1005.28 KB, application/zip)
2016-02-12 14:52 PST, Build Bot
no flags Details
Archive of layout-test-results from ews104 for mac-yosemite-wk2 (890.27 KB, application/zip)
2016-02-12 14:56 PST, Build Bot
no flags Details
Archive of layout-test-results from ews112 for mac-yosemite (836.84 KB, application/zip)
2016-02-12 15:07 PST, Build Bot
no flags Details
WIP Patch (rebaselined) (24.70 KB, patch)
2016-02-15 12:31 PST, Chris Dumez
buildbot: commit-queue-
Details | Formatted Diff | Diff
Archive of layout-test-results from ews100 for mac-yosemite (924.62 KB, application/zip)
2016-02-15 13:25 PST, Build Bot
no flags Details
Archive of layout-test-results from ews107 for mac-yosemite-wk2 (799.36 KB, application/zip)
2016-02-15 13:27 PST, Build Bot
no flags Details
Archive of layout-test-results from ews112 for mac-yosemite (841.20 KB, application/zip)
2016-02-15 13:41 PST, Build Bot
no flags Details
WIP Patch (33.60 KB, patch)
2016-02-15 17:05 PST, Chris Dumez
buildbot: commit-queue-
Details | Formatted Diff | Diff
Archive of layout-test-results from ews103 for mac-yosemite (815.55 KB, application/zip)
2016-02-15 18:38 PST, Build Bot
no flags Details
Archive of layout-test-results from ews105 for mac-yosemite-wk2 (891.49 KB, application/zip)
2016-02-15 18:40 PST, Build Bot
no flags Details
Archive of layout-test-results from ews114 for mac-yosemite (821.13 KB, application/zip)
2016-02-15 18:56 PST, Build Bot
no flags Details
WIP Patch (34.28 KB, patch)
2016-02-15 22:18 PST, Chris Dumez
no flags Details | Formatted Diff | Diff
WIP Patch (28.10 KB, patch)
2016-02-16 08:28 PST, Chris Dumez
no flags Details | Formatted Diff | Diff
Patch (51.27 KB, patch)
2016-02-16 10:36 PST, Chris Dumez
no flags Details | Formatted Diff | Diff
Patch (51.62 KB, patch)
2016-02-16 12:22 PST, 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.
Description Chris Dumez 2016-02-11 12:06:58 PST
Operations should be on the instance for DOMWindow or if [Unforgeable]:
http://heycam.github.io/webidl/#es-operations
Comment 1 Radar WebKit Bug Importer 2016-02-11 12:14:23 PST
<rdar://problem/24613231>
Comment 2 Chris Dumez 2016-02-11 23:16:23 PST
Created attachment 271137 [details]
WIP Patch
Comment 3 WebKit Commit Bot 2016-02-11 23:17:57 PST
Attachment 271137 [details] did not pass style-queue:


ERROR: Source/WebCore/bindings/js/JSDOMWindowCustom.cpp:123:  When wrapping a line, only indent 4 spaces.  [whitespace/indent] [3]
Total errors found: 1 in 7 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 4 Build Bot 2016-02-12 00:27:58 PST
Comment on attachment 271137 [details]
WIP Patch

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

New failing tests:
js/dom/line-column-numbers.html
http/tests/security/postMessage/delivery-order.html
http/tests/security/postMessage/target-origin.html
http/tests/security/postMessage/origin-unaffected-by-base-tag.html
fast/dom/Window/window-postmessage-clone-frames.html
http/tests/security/postMessage/javascript-page-still-sends-origin.html
fast/frames/sandboxed-iframe-close-top-noclose.html
http/tests/security/postMessage/data-url-sends-null-origin.html
sputnik/Unicode/Unicode_320/S7.6_A3.1.html
http/tests/security/cross-frame-access-put.html
http/tests/security/postMessage/origin-unaffected-by-document-domain.html
http/tests/security/isolatedWorld/document-open.html
http/tests/messaging/cross-domain-message-send.html
http/tests/security/postMessage/invalid-origin-throws-exception.html
Comment 5 Build Bot 2016-02-12 00:28:04 PST
Created attachment 271140 [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 6 Build Bot 2016-02-12 00:30:39 PST
Comment on attachment 271137 [details]
WIP Patch

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

New failing tests:
js/dom/line-column-numbers.html
http/tests/security/postMessage/delivery-order.html
http/tests/security/postMessage/data-url-sends-null-origin.html
http/tests/security/postMessage/target-origin.html
http/tests/security/postMessage/origin-unaffected-by-base-tag.html
fast/frames/sandboxed-iframe-close-top-noclose.html
http/tests/security/postMessage/javascript-page-still-sends-origin.html
sputnik/Unicode/Unicode_320/S7.6_A3.1.html
http/tests/security/postMessage/origin-unaffected-by-document-domain.html
http/tests/security/isolatedWorld/document-open.html
http/tests/messaging/cross-domain-message-send.html
http/tests/security/postMessage/invalid-origin-throws-exception.html
Comment 7 Build Bot 2016-02-12 00:30:47 PST
Created attachment 271142 [details]
Archive of layout-test-results from ews104 for mac-yosemite-wk2

The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews.
Bot: ews104  Port: mac-yosemite-wk2  Platform: Mac OS X 10.10.5
Comment 8 Build Bot 2016-02-12 00:37:43 PST
Comment on attachment 271137 [details]
WIP Patch

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

New failing tests:
http/tests/security/postMessage/delivery-order.html
http/tests/security/postMessage/target-origin.html
http/tests/security/postMessage/origin-unaffected-by-base-tag.html
fast/dom/Window/window-postmessage-clone-frames.html
http/tests/security/postMessage/javascript-page-still-sends-origin.html
fast/frames/sandboxed-iframe-close-top-noclose.html
http/tests/security/postMessage/data-url-sends-null-origin.html
sputnik/Unicode/Unicode_320/S7.6_A3.1.html
http/tests/security/cross-frame-access-put.html
http/tests/security/postMessage/origin-unaffected-by-document-domain.html
http/tests/security/isolatedWorld/document-open.html
http/tests/messaging/cross-domain-message-send.html
http/tests/security/postMessage/invalid-origin-throws-exception.html
Comment 9 Build Bot 2016-02-12 00:37:48 PST
Created attachment 271146 [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 10 Chris Dumez 2016-02-12 13:45:05 PST
Created attachment 271215 [details]
WIP Patch
Comment 11 WebKit Commit Bot 2016-02-12 13:46:04 PST
Attachment 271215 [details] did not pass style-queue:


ERROR: Source/WebCore/bindings/js/JSDOMWindowCustom.cpp:264:  An else if statement should be written as an if statement when the prior "if" concludes with a return, break, continue or goto statement.  [readability/control_flow] [4]
Total errors found: 1 in 6 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 12 Chris Dumez 2016-02-12 13:51:32 PST
Created attachment 271219 [details]
WIP Patch
Comment 13 Chris Dumez 2016-02-12 13:55:30 PST
For some reason, with this patch (same origin):
window.open = function() { alert("test" }; };
console.log(window.open);
-> function open() { [native code] }

Unless we have already reified Window, then:
window.open = function() { alert("test" }; };
console.log(window.open);
-> function() { alert("test" }; };

Trying to figure out the reason.
Comment 14 Chris Dumez 2016-02-12 14:43:59 PST
(In reply to comment #13)
> For some reason, with this patch (same origin):
> window.open = function() { alert("test" }; };
> console.log(window.open);
> -> function open() { [native code] }
> 
> Unless we have already reified Window, then:
> window.open = function() { alert("test" }; };
> console.log(window.open);
> -> function() { alert("test" }; };
> 
> Trying to figure out the reason.

Interestingly:
window.open = function() { alert("test" }; };
console.log(window.open);
-> function open() { [native code] }
window.open = function() { alert("test" }; };
console.log(window.open);
-> function() { alert("test" }; };
Comment 15 Build Bot 2016-02-12 14:52:54 PST
Comment on attachment 271219 [details]
WIP Patch

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

New failing tests:
http/tests/security/cross-frame-access-put.html
http/tests/security/isolatedWorld/document-open.html
fast/dom/Window/window-postmessage-clone-frames.html
Comment 16 Build Bot 2016-02-12 14:52:57 PST
Created attachment 271230 [details]
Archive of layout-test-results from ews103 for mac-yosemite

The attached test failures were seen while running run-webkit-tests on the mac-ews.
Bot: ews103  Port: mac-yosemite  Platform: Mac OS X 10.10.5
Comment 17 Build Bot 2016-02-12 14:56:19 PST
Comment on attachment 271219 [details]
WIP Patch

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

New failing tests:
http/tests/security/isolatedWorld/document-open.html
Comment 18 Build Bot 2016-02-12 14:56:22 PST
Created attachment 271231 [details]
Archive of layout-test-results from ews104 for mac-yosemite-wk2

The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews.
Bot: ews104  Port: mac-yosemite-wk2  Platform: Mac OS X 10.10.5
Comment 19 Build Bot 2016-02-12 15:07:00 PST
Comment on attachment 271219 [details]
WIP Patch

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

New failing tests:
http/tests/security/cross-frame-access-put.html
http/tests/security/isolatedWorld/document-open.html
fast/dom/Window/window-postmessage-clone-frames.html
Comment 20 Build Bot 2016-02-12 15:07:03 PST
Created attachment 271232 [details]
Archive of layout-test-results from ews112 for mac-yosemite

The attached test failures were seen while running run-webkit-tests on the mac-debug-ews.
Bot: ews112  Port: mac-yosemite  Platform: Mac OS X 10.10.5
Comment 21 Chris Dumez 2016-02-15 12:31:36 PST
Created attachment 271357 [details]
WIP Patch (rebaselined)
Comment 22 Build Bot 2016-02-15 13:24:58 PST
Comment on attachment 271357 [details]
WIP Patch (rebaselined)

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

New failing tests:
http/tests/security/cross-frame-access-put.html
http/tests/security/isolatedWorld/document-open.html
fast/dom/Window/window-postmessage-clone-frames.html
Comment 23 Build Bot 2016-02-15 13:25:03 PST
Created attachment 271366 [details]
Archive of layout-test-results from ews100 for mac-yosemite

The attached test failures were seen while running run-webkit-tests on the mac-ews.
Bot: ews100  Port: mac-yosemite  Platform: Mac OS X 10.10.5
Comment 24 Build Bot 2016-02-15 13:27:51 PST
Comment on attachment 271357 [details]
WIP Patch (rebaselined)

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

New failing tests:
http/tests/security/isolatedWorld/document-open.html
Comment 25 Build Bot 2016-02-15 13:27:55 PST
Created attachment 271367 [details]
Archive of layout-test-results from ews107 for mac-yosemite-wk2

The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews.
Bot: ews107  Port: mac-yosemite-wk2  Platform: Mac OS X 10.10.5
Comment 26 Build Bot 2016-02-15 13:41:06 PST
Comment on attachment 271357 [details]
WIP Patch (rebaselined)

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

New failing tests:
http/tests/security/cross-frame-access-put.html
http/tests/security/isolatedWorld/document-open.html
fast/dom/Window/window-postmessage-clone-frames.html
Comment 27 Build Bot 2016-02-15 13:41:10 PST
Created attachment 271368 [details]
Archive of layout-test-results from ews112 for mac-yosemite

The attached test failures were seen while running run-webkit-tests on the mac-debug-ews.
Bot: ews112  Port: mac-yosemite  Platform: Mac OS X 10.10.5
Comment 28 Chris Dumez 2016-02-15 17:05:11 PST
Created attachment 271392 [details]
WIP Patch
Comment 29 Build Bot 2016-02-15 18:38:54 PST
Comment on attachment 271392 [details]
WIP Patch

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

New failing tests:
jquery/offset.html
fast/dom/Window/window-postmessage-clone-frames.html
Comment 30 Build Bot 2016-02-15 18:38:58 PST
Created attachment 271401 [details]
Archive of layout-test-results from ews103 for mac-yosemite

The attached test failures were seen while running run-webkit-tests on the mac-ews.
Bot: ews103  Port: mac-yosemite  Platform: Mac OS X 10.10.5
Comment 31 Build Bot 2016-02-15 18:40:04 PST
Comment on attachment 271392 [details]
WIP Patch

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

New failing tests:
jquery/offset.html
Comment 32 Build Bot 2016-02-15 18:40:09 PST
Created attachment 271402 [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 33 Build Bot 2016-02-15 18:56:25 PST
Comment on attachment 271392 [details]
WIP Patch

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

New failing tests:
jquery/offset.html
fast/dom/Window/window-postmessage-clone-frames.html
Comment 34 Build Bot 2016-02-15 18:56:31 PST
Created attachment 271405 [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 35 Chris Dumez 2016-02-15 22:18:39 PST
Created attachment 271417 [details]
WIP Patch
Comment 36 Chris Dumez 2016-02-16 08:28:39 PST
Created attachment 271429 [details]
WIP Patch
Comment 37 Chris Dumez 2016-02-16 10:36:35 PST
Created attachment 271434 [details]
Patch
Comment 38 Gavin Barraclough 2016-02-16 12:03:59 PST
Comment on attachment 271434 [details]
Patch

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

> Source/JavaScriptCore/runtime/Lookup.h:270
>  

Please add a comment above putEntry, explaining that:
(1) base means the object holding the property (possibly in the prototype chain of the object put was called on).
(2) thisValue is the object that put is being applied to (in the case of a proxy, the proxy target).
(3) slot.thisValue() is the object the put was originally performed on (in the case of a proxy, the proxy itself).

> Source/JavaScriptCore/runtime/Lookup.h:281
> +        JSValue updateThisValue = entry->attributes() & CustomAccessor ? thisValue : JSValue(base);

Please switch thisValue -> slot.thisValue().
Comment 39 Chris Dumez 2016-02-16 12:22:12 PST
Created attachment 271466 [details]
Patch
Comment 40 Chris Dumez 2016-02-16 12:23:00 PST
Comment on attachment 271466 [details]
Patch

Clearing flags on attachment: 271466

Committed r196648: <http://trac.webkit.org/changeset/196648>
Comment 41 Chris Dumez 2016-02-16 12:23:12 PST
All reviewed patches have been landed.  Closing bug.