<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[196690] trunk</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/196690">196690</a></dd>
<dt>Author</dt> <dd>cdumez@apple.com</dd>
<dt>Date</dt> <dd>2016-02-17 00:38:27 -0800 (Wed, 17 Feb 2016)</dd>
</dl>
<h3>Log Message</h3>
<pre>Window should have its 'constructor' property on the prototype
https://bugs.webkit.org/show_bug.cgi?id=154037
<rdar://problem/24689078>
Reviewed by Gavin Barraclough.
LayoutTests/imported/w3c:
Rebaseline W3C test now that one more check is passing.
* web-platform-tests/html/dom/interfaces-expected.txt:
Source/WebCore:
Window should have its 'constructor' property on the prototype as per
the Web IDL specification:
http://heycam.github.io/webidl/#interface-prototype-object
Firefox and Chrome already match the specification.
No new tests, covered by:
- fast/dom/Window/window-constructor-settable.html
- fast/dom/Window/window-constructor.html
- http/tests/security/cross-origin-window-property-access.html
- imported/w3c/web-platform-tests/html/dom/interfaces.html
* bindings/scripts/CodeGeneratorJS.pm:
(ConstructorShouldBeOnInstance): Deleted.
Drop this routine as all constructors are now on the prototype.
(InstancePropertyCount):
Do not account for constructor properties as these can only be
on the prototype now.
(PrototypePropertyCount):
Increment the property count by 1 if the interface has a constructor
property (e.g. [NoInterfaceObject] interfaces do not have one).
(GeneratePropertiesHashTable):
Stop calling ConstructorShouldBeOnInstance() as it no longer exists.
Always generated the "constructor" property if:
1. We are generating the prototype hash table.
and
2. The interface needs a constructor (i.e. not marked as
[NoInterfaceObject]).
(GenerateImplementation):
- Drop code handling the case where ConstructorShouldBeOnInstance()
returns true as constructors are not always on the prototype and
the ConstructorShouldBeOnInstance() routine has been dropped.
- Drop code handling [CustomProxyToJSObject]. Now that the constructor
is always on the prototype, we never need to cast thisValue to a
JSDOMWindow (by calling toJSDOMWindow). In the Window case, thisValue
is now casted to a JSDOMWindowPrototype*, similarly to other interfaces
so we don't need a special casting function anymore.
- Stop generating security checks. This only impacts Window as it is the
only interface marked as [CheckSecurity]. The cross-origin checking code
as it was would not work when "constructor" is on the prototype because
thisValue is a JSDOMWindowPrototype, not a JSDOMWindow and we have no
way of getting the wrapped window. Also, the security check is no longer
needed because:
1. Accessing crossOriginWindow.constructor will not work now that
constructor is on the prototype because
JSDOMWindow::getOwnPropertySlot() already prevents access to the
prototype in the cross-origin case.
2. "constructor" is a value property, not a getter/setter. Therefore,
it is no possible to use the getter/setter from a same origin window
instance and call it on a cross origin window.
LayoutTests:
* http/tests/security/cross-origin-window-property-access-expected.txt:
* http/tests/security/cross-origin-window-property-access.html:
Add checks to make sure it still is not possible to access
window.constructor cross-origin.
* js/getOwnPropertyDescriptor-window-attributes-expected.txt:
* js/getOwnPropertyDescriptor-window-attributes.html:
Update test now that window has it's "constructor" attribute
on the prototype.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestshttptestssecuritycrossoriginwindowpropertyaccessexpectedtxt">trunk/LayoutTests/http/tests/security/cross-origin-window-property-access-expected.txt</a></li>
<li><a href="#trunkLayoutTestshttptestssecuritycrossoriginwindowpropertyaccesshtml">trunk/LayoutTests/http/tests/security/cross-origin-window-property-access.html</a></li>
<li><a href="#trunkLayoutTestsimportedw3cChangeLog">trunk/LayoutTests/imported/w3c/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestshtmldominterfacesexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/html/dom/interfaces-expected.txt</a></li>
<li><a href="#trunkLayoutTestsjsgetOwnPropertyDescriptorwindowattributesexpectedtxt">trunk/LayoutTests/js/getOwnPropertyDescriptor-window-attributes-expected.txt</a></li>
<li><a href="#trunkLayoutTestsjsgetOwnPropertyDescriptorwindowattributeshtml">trunk/LayoutTests/js/getOwnPropertyDescriptor-window-attributes.html</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptsCodeGeneratorJSpm">trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptstestJSJSTestActiveDOMObjectcpp">trunk/Source/WebCore/bindings/scripts/test/JS/JSTestActiveDOMObject.cpp</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (196689 => 196690)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2016-02-17 07:18:34 UTC (rev 196689)
+++ trunk/LayoutTests/ChangeLog        2016-02-17 08:38:27 UTC (rev 196690)
</span><span class="lines">@@ -1,3 +1,21 @@
</span><ins>+2016-02-17 Chris Dumez <cdumez@apple.com>
+
+ Window should have its 'constructor' property on the prototype
+ https://bugs.webkit.org/show_bug.cgi?id=154037
+ <rdar://problem/24689078>
+
+ Reviewed by Gavin Barraclough.
+
+ * http/tests/security/cross-origin-window-property-access-expected.txt:
+ * http/tests/security/cross-origin-window-property-access.html:
+ Add checks to make sure it still is not possible to access
+ window.constructor cross-origin.
+
+ * js/getOwnPropertyDescriptor-window-attributes-expected.txt:
+ * js/getOwnPropertyDescriptor-window-attributes.html:
+ Update test now that window has it's "constructor" attribute
+ on the prototype.
+
</ins><span class="cx"> 2016-02-16 Carlos Garcia Campos <cgarcia@igalia.com>
</span><span class="cx">
</span><span class="cx"> Add a way to test ScrollAnimator
</span></span></pre></div>
<a id="trunkLayoutTestshttptestssecuritycrossoriginwindowpropertyaccessexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/http/tests/security/cross-origin-window-property-access-expected.txt (196689 => 196690)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/security/cross-origin-window-property-access-expected.txt        2016-02-17 07:18:34 UTC (rev 196689)
+++ trunk/LayoutTests/http/tests/security/cross-origin-window-property-access-expected.txt        2016-02-17 08:38:27 UTC (rev 196690)
</span><span class="lines">@@ -3,6 +3,8 @@
</span><span class="cx"> CONSOLE MESSAGE: line 1: Blocked a frame with origin "http://127.0.0.1:8000" from accessing a frame with origin "http://localhost:8000". Protocols, domains, and ports must match.
</span><span class="cx"> CONSOLE MESSAGE: line 1: Blocked a frame with origin "http://127.0.0.1:8000" from accessing a frame with origin "http://localhost:8000". Protocols, domains, and ports must match.
</span><span class="cx"> CONSOLE MESSAGE: line 1: Blocked a frame with origin "http://127.0.0.1:8000" from accessing a frame with origin "http://localhost:8000". Protocols, domains, and ports must match.
</span><ins>+CONSOLE MESSAGE: line 15: Blocked a frame with origin "http://127.0.0.1:8000" from accessing a frame with origin "http://localhost:8000". Protocols, domains, and ports must match.
+CONSOLE MESSAGE: line 15: Blocked a frame with origin "http://127.0.0.1:8000" from accessing a frame with origin "http://localhost:8000". Protocols, domains, and ports must match.
</ins><span class="cx"> Tests that using another window's property getter does not bypass cross-origin checks.
</span><span class="cx">
</span><span class="cx"> On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
</span><span class="lines">@@ -14,6 +16,10 @@
</span><span class="cx"> PASS Object.getOwnPropertyDescriptor(window, "scrollbars").get.call(crossOriginWindow) returned undefined.
</span><span class="cx"> PASS Object.getOwnPropertyDescriptor(window, "navigator").get.call(crossOriginWindow) returned undefined.
</span><span class="cx"> PASS Object.getOwnPropertyDescriptor(window, "screenX").get.call(crossOriginWindow) returned undefined.
</span><ins>+PASS Object.getOwnPropertyDescriptor(window.__proto__, "constructor").get.call(crossOriginWindow) threw exception TypeError: undefined is not an object (evaluating 'Object.getOwnPropertyDescriptor(window.__proto__, "constructor").get.call').
+PASS Object.getOwnPropertyDescriptor(window.__proto__, "constructor").get.call(crossOriginWindow.__proto__) threw exception TypeError: undefined is not an object (evaluating 'Object.getOwnPropertyDescriptor(window.__proto__, "constructor").get.call').
+PASS crossOriginWindow.constructor returned undefined.
+PASS Object.getOwnPropertyDescriptor(crossOriginWindow.__proto__, "constructor").value threw exception TypeError: undefined is not an object (evaluating 'Object.getOwnPropertyDescriptor(crossOriginWindow.__proto__, "constructor")').
</ins><span class="cx"> PASS Object.getOwnPropertyDescriptor(window, "location").get.call(crossOriginWindow) === crossOriginWindow.location is true
</span><span class="cx"> PASS successfullyParsed is true
</span><span class="cx">
</span></span></pre></div>
<a id="trunkLayoutTestshttptestssecuritycrossoriginwindowpropertyaccesshtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/http/tests/security/cross-origin-window-property-access.html (196689 => 196690)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/security/cross-origin-window-property-access.html        2016-02-17 07:18:34 UTC (rev 196689)
+++ trunk/LayoutTests/http/tests/security/cross-origin-window-property-access.html        2016-02-17 08:38:27 UTC (rev 196690)
</span><span class="lines">@@ -32,6 +32,10 @@
</span><span class="cx"> shouldThrowOrReturnUndefined('Object.getOwnPropertyDescriptor(window, "scrollbars").get.call(crossOriginWindow)');
</span><span class="cx"> shouldThrowOrReturnUndefined('Object.getOwnPropertyDescriptor(window, "navigator").get.call(crossOriginWindow)');
</span><span class="cx"> shouldThrowOrReturnUndefined('Object.getOwnPropertyDescriptor(window, "screenX").get.call(crossOriginWindow)');
</span><ins>+ shouldThrowOrReturnUndefined('Object.getOwnPropertyDescriptor(window.__proto__, "constructor").get.call(crossOriginWindow)');
+ shouldThrowOrReturnUndefined('Object.getOwnPropertyDescriptor(window.__proto__, "constructor").get.call(crossOriginWindow.__proto__)');
+ shouldThrowOrReturnUndefined('crossOriginWindow.constructor');
+ shouldThrowOrReturnUndefined('Object.getOwnPropertyDescriptor(crossOriginWindow.__proto__, "constructor").value');
</ins><span class="cx"> shouldBeTrue('Object.getOwnPropertyDescriptor(window, "location").get.call(crossOriginWindow) === crossOriginWindow.location');
</span><span class="cx"> finishJSTest();
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/ChangeLog (196689 => 196690)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/ChangeLog        2016-02-17 07:18:34 UTC (rev 196689)
+++ trunk/LayoutTests/imported/w3c/ChangeLog        2016-02-17 08:38:27 UTC (rev 196690)
</span><span class="lines">@@ -1,3 +1,15 @@
</span><ins>+2016-02-17 Chris Dumez <cdumez@apple.com>
+
+ Window should have its 'constructor' property on the prototype
+ https://bugs.webkit.org/show_bug.cgi?id=154037
+ <rdar://problem/24689078>
+
+ Reviewed by Gavin Barraclough.
+
+ Rebaseline W3C test now that one more check is passing.
+
+ * web-platform-tests/html/dom/interfaces-expected.txt:
+
</ins><span class="cx"> 2016-02-16 Chris Dumez <cdumez@apple.com>
</span><span class="cx">
</span><span class="cx"> Navigator.geolocation should not be marked a [Replaceable] and should be on the prototype
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestshtmldominterfacesexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/dom/interfaces-expected.txt (196689 => 196690)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/dom/interfaces-expected.txt        2016-02-17 07:18:34 UTC (rev 196689)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/dom/interfaces-expected.txt        2016-02-17 08:38:27 UTC (rev 196690)
</span><span class="lines">@@ -3811,7 +3811,7 @@
</span><span class="cx"> PASS Window interface object length
</span><span class="cx"> PASS Window interface object name
</span><span class="cx"> FAIL Window interface: existence and properties of interface prototype object assert_equals: Class name for prototype of Window.prototype is not "WindowProperties" expected "[object WindowProperties]" but got "[object EventTargetPrototype]"
</span><del>-FAIL Window interface: existence and properties of interface prototype object's "constructor" property assert_own_property: Window.prototype does not have own property "constructor" expected property "constructor" missing
</del><ins>+PASS Window interface: existence and properties of interface prototype object's "constructor" property
</ins><span class="cx"> PASS Window interface: attribute self
</span><span class="cx"> PASS Window interface: attribute name
</span><span class="cx"> FAIL Window interface: attribute history assert_equals: setter must be undefined for readonly attributes expected (undefined) undefined but got (function) function "function history() {
</span></span></pre></div>
<a id="trunkLayoutTestsjsgetOwnPropertyDescriptorwindowattributesexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/js/getOwnPropertyDescriptor-window-attributes-expected.txt (196689 => 196690)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/getOwnPropertyDescriptor-window-attributes-expected.txt        2016-02-17 07:18:34 UTC (rev 196689)
+++ trunk/LayoutTests/js/getOwnPropertyDescriptor-window-attributes-expected.txt        2016-02-17 08:38:27 UTC (rev 196690)
</span><span class="lines">@@ -54,7 +54,7 @@
</span><span class="cx"> PASS descriptor.configurable is true
</span><span class="cx"> PASS descriptor.value is window.Node
</span><span class="cx">
</span><del>-* window.constructor
</del><ins>+* window.__proto__.constructor
</ins><span class="cx"> PASS descriptor.enumerable is false
</span><span class="cx"> PASS descriptor.writable is true
</span><span class="cx"> PASS descriptor.configurable is true
</span></span></pre></div>
<a id="trunkLayoutTestsjsgetOwnPropertyDescriptorwindowattributeshtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/js/getOwnPropertyDescriptor-window-attributes.html (196689 => 196690)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/getOwnPropertyDescriptor-window-attributes.html        2016-02-17 07:18:34 UTC (rev 196689)
+++ trunk/LayoutTests/js/getOwnPropertyDescriptor-window-attributes.html        2016-02-17 08:38:27 UTC (rev 196690)
</span><span class="lines">@@ -62,9 +62,8 @@
</span><span class="cx"> shouldBe("descriptor.value", "window.Node");
</span><span class="cx">
</span><span class="cx"> debug("");
</span><del>-// FIXME: 'constructor' should be on the prototype.
-debug("* window.constructor");
-descriptor = Object.getOwnPropertyDescriptor(window, "constructor");
</del><ins>+debug("* window.__proto__.constructor");
+descriptor = Object.getOwnPropertyDescriptor(window.__proto__, "constructor");
</ins><span class="cx"> shouldBeFalse("descriptor.enumerable");
</span><span class="cx"> shouldBeTrue("descriptor.writable");
</span><span class="cx"> shouldBeTrue("descriptor.configurable");
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (196689 => 196690)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-02-17 07:18:34 UTC (rev 196689)
+++ trunk/Source/WebCore/ChangeLog        2016-02-17 08:38:27 UTC (rev 196690)
</span><span class="lines">@@ -1,3 +1,66 @@
</span><ins>+2016-02-17 Chris Dumez <cdumez@apple.com>
+
+ Window should have its 'constructor' property on the prototype
+ https://bugs.webkit.org/show_bug.cgi?id=154037
+ <rdar://problem/24689078>
+
+ Reviewed by Gavin Barraclough.
+
+ Window should have its 'constructor' property on the prototype as per
+ the Web IDL specification:
+ http://heycam.github.io/webidl/#interface-prototype-object
+
+ Firefox and Chrome already match the specification.
+
+ No new tests, covered by:
+ - fast/dom/Window/window-constructor-settable.html
+ - fast/dom/Window/window-constructor.html
+ - http/tests/security/cross-origin-window-property-access.html
+ - imported/w3c/web-platform-tests/html/dom/interfaces.html
+
+ * bindings/scripts/CodeGeneratorJS.pm:
+ (ConstructorShouldBeOnInstance): Deleted.
+ Drop this routine as all constructors are now on the prototype.
+
+ (InstancePropertyCount):
+ Do not account for constructor properties as these can only be
+ on the prototype now.
+
+ (PrototypePropertyCount):
+ Increment the property count by 1 if the interface has a constructor
+ property (e.g. [NoInterfaceObject] interfaces do not have one).
+
+ (GeneratePropertiesHashTable):
+ Stop calling ConstructorShouldBeOnInstance() as it no longer exists.
+ Always generated the "constructor" property if:
+ 1. We are generating the prototype hash table.
+ and
+ 2. The interface needs a constructor (i.e. not marked as
+ [NoInterfaceObject]).
+
+ (GenerateImplementation):
+ - Drop code handling the case where ConstructorShouldBeOnInstance()
+ returns true as constructors are not always on the prototype and
+ the ConstructorShouldBeOnInstance() routine has been dropped.
+ - Drop code handling [CustomProxyToJSObject]. Now that the constructor
+ is always on the prototype, we never need to cast thisValue to a
+ JSDOMWindow (by calling toJSDOMWindow). In the Window case, thisValue
+ is now casted to a JSDOMWindowPrototype*, similarly to other interfaces
+ so we don't need a special casting function anymore.
+ - Stop generating security checks. This only impacts Window as it is the
+ only interface marked as [CheckSecurity]. The cross-origin checking code
+ as it was would not work when "constructor" is on the prototype because
+ thisValue is a JSDOMWindowPrototype, not a JSDOMWindow and we have no
+ way of getting the wrapped window. Also, the security check is no longer
+ needed because:
+ 1. Accessing crossOriginWindow.constructor will not work now that
+ constructor is on the prototype because
+ JSDOMWindow::getOwnPropertySlot() already prevents access to the
+ prototype in the cross-origin case.
+ 2. "constructor" is a value property, not a getter/setter. Therefore,
+ it is no possible to use the getter/setter from a same origin window
+ instance and call it on a cross origin window.
+
</ins><span class="cx"> 2016-02-16 Carlos Garcia Campos <cgarcia@igalia.com>
</span><span class="cx">
</span><span class="cx"> Add a way to test ScrollAnimator
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptsCodeGeneratorJSpm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (196689 => 196690)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm        2016-02-17 07:18:34 UTC (rev 196689)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm        2016-02-17 08:38:27 UTC (rev 196690)
</span><span class="lines">@@ -681,16 +681,6 @@
</span><span class="cx"> return 0;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-sub ConstructorShouldBeOnInstance
-{
- my $interface = shift;
-
- # FIXME: constructor should always be on the prototype:
- # http://www.w3.org/TR/WebIDL/#interface-prototype-object
- return 1 if $interface->extendedAttributes->{"CheckSecurity"};
- return 0;
-}
-
</del><span class="cx"> sub AttributeShouldBeOnInstanceForCompatibility
</span><span class="cx"> {
</span><span class="cx"> my $interface = shift;
</span><span class="lines">@@ -790,7 +780,6 @@
</span><span class="cx"> $count++ if AttributeShouldBeOnInstance($interface, $attribute);
</span><span class="cx"> }
</span><span class="cx"> $count += InstanceFunctionCount($interface);
</span><del>- $count++ if ConstructorShouldBeOnInstance($interface);
</del><span class="cx"> return $count;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -802,7 +791,7 @@
</span><span class="cx"> $count++ if !AttributeShouldBeOnInstance($interface, $attribute);
</span><span class="cx"> }
</span><span class="cx"> $count += PrototypeFunctionCount($interface);
</span><del>- $count++ if !ConstructorShouldBeOnInstance($interface);
</del><ins>+ $count++ if NeedsConstructorProperty($interface);
</ins><span class="cx"> return $count;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -1388,18 +1377,15 @@
</span><span class="cx"> # - Add all properties in a hashtable definition
</span><span class="cx"> my $propertyCount = $isInstance ? InstancePropertyCount($interface) : PrototypePropertyCount($interface);
</span><span class="cx">
</span><del>- if (ConstructorShouldBeOnInstance($interface) == $isInstance) {
</del><ins>+ if (!$isInstance && NeedsConstructorProperty($interface)) {
+ die if !$propertyCount;
+ push(@$hashKeys, "constructor");
+ my $getter = "js" . $interfaceName . "Constructor";
+ push(@$hashValue1, $getter);
</ins><span class="cx">
</span><del>- if (NeedsConstructorProperty($interface)) {
- die if !$propertyCount;
- push(@$hashKeys, "constructor");
- my $getter = "js" . $interfaceName . "Constructor";
- push(@$hashValue1, $getter);
-
- my $setter = "setJS" . $interfaceName . "Constructor";
- push(@$hashValue2, $setter);
- push(@$hashSpecials, "DontEnum");
- }
</del><ins>+ my $setter = "setJS" . $interfaceName . "Constructor";
+ push(@$hashValue2, $setter);
+ push(@$hashSpecials, "DontEnum");
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> return 0 if !$propertyCount;
</span><span class="lines">@@ -2523,28 +2509,12 @@
</span><span class="cx"> if (NeedsConstructorProperty($interface)) {
</span><span class="cx"> my $constructorFunctionName = "js" . $interfaceName . "Constructor";
</span><span class="cx">
</span><del>- if ($interface->extendedAttributes->{"CustomProxyToJSObject"}) {
- push(@implContent, "EncodedJSValue ${constructorFunctionName}(ExecState* state, EncodedJSValue thisValue, PropertyName)\n");
- push(@implContent, "{\n");
- push(@implContent, " ${className}* domObject = to${className}(JSValue::decode(thisValue));\n");
- } elsif (ConstructorShouldBeOnInstance($interface)) {
- push(@implContent, "EncodedJSValue ${constructorFunctionName}(ExecState* state, EncodedJSValue thisValue, PropertyName)\n");
- push(@implContent, "{\n");
- push(@implContent, " ${className}* domObject = " . GetCastingHelperForThisObject($interface) . "(JSValue::decode(thisValue));\n");
- } else {
- push(@implContent, "EncodedJSValue ${constructorFunctionName}(ExecState* state, EncodedJSValue thisValue, PropertyName)\n");
- push(@implContent, "{\n");
- push(@implContent, " ${className}Prototype* domObject = jsDynamicCast<${className}Prototype*>(JSValue::decode(thisValue));\n");
- }
</del><ins>+ push(@implContent, "EncodedJSValue ${constructorFunctionName}(ExecState* state, EncodedJSValue thisValue, PropertyName)\n");
+ push(@implContent, "{\n");
+ push(@implContent, " ${className}Prototype* domObject = jsDynamicCast<${className}Prototype*>(JSValue::decode(thisValue));\n");
</ins><span class="cx"> push(@implContent, " if (!domObject)\n");
</span><span class="cx"> push(@implContent, " return throwVMTypeError(state);\n");
</span><span class="cx">
</span><del>- if ($interface->extendedAttributes->{"CheckSecurity"}) {
- die if !ConstructorShouldBeOnInstance($interface);
- push(@implContent, " if (!BindingSecurity::shouldAllowAccessToDOMWindow(state, domObject->wrapped()))\n");
- push(@implContent, " return JSValue::encode(jsUndefined());\n");
- }
-
</del><span class="cx"> if (!$interface->extendedAttributes->{"NoInterfaceObject"}) {
</span><span class="cx"> push(@implContent, " return JSValue::encode(${className}::getConstructor(state->vm(), domObject->globalObject()));\n");
</span><span class="cx"> } else {
</span><span class="lines">@@ -2561,25 +2531,11 @@
</span><span class="cx"> push(@implContent, "void ${constructorFunctionName}(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)\n");
</span><span class="cx"> push(@implContent, "{\n");
</span><span class="cx"> push(@implContent, " JSValue value = JSValue::decode(encodedValue);\n");
</span><del>- if ($interface->extendedAttributes->{"CustomProxyToJSObject"}) {
- push(@implContent, " ${className}* domObject = to${className}(JSValue::decode(thisValue));\n");
- } elsif (ConstructorShouldBeOnInstance($interface)) {
- push(@implContent, " ${className}* domObject = " . GetCastingHelperForThisObject($interface) . "(JSValue::decode(thisValue));\n");
- } else {
- push(@implContent, " ${className}Prototype* domObject = jsDynamicCast<${className}Prototype*>(JSValue::decode(thisValue));\n");
- }
</del><ins>+ push(@implContent, " ${className}Prototype* domObject = jsDynamicCast<${className}Prototype*>(JSValue::decode(thisValue));\n");
</ins><span class="cx"> push(@implContent, " if (UNLIKELY(!domObject)) {\n");
</span><span class="cx"> push(@implContent, " throwVMTypeError(state);\n");
</span><span class="cx"> push(@implContent, " return;\n");
</span><span class="cx"> push(@implContent, " }\n");
</span><del>- if ($interface->extendedAttributes->{"CheckSecurity"}) {
- if ($interfaceName eq "DOMWindow") {
- push(@implContent, " if (!BindingSecurity::shouldAllowAccessToDOMWindow(state, domObject->wrapped()))\n");
- } else {
- push(@implContent, " if (!shouldAllowAccessToFrame(state, domObject->wrapped().frame()))\n");
- }
- push(@implContent, " return;\n");
- }
</del><span class="cx">
</span><span class="cx"> push(@implContent, " // Shadowing a built-in constructor\n");
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptstestJSJSTestActiveDOMObjectcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestActiveDOMObject.cpp (196689 => 196690)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestActiveDOMObject.cpp        2016-02-17 07:18:34 UTC (rev 196689)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestActiveDOMObject.cpp        2016-02-17 08:38:27 UTC (rev 196690)
</span><span class="lines">@@ -73,21 +73,18 @@
</span><span class="cx">
</span><span class="cx"> /* Hash table */
</span><span class="cx">
</span><del>-static const struct CompactHashIndex JSTestActiveDOMObjectTableIndex[4] = {
- { 1, -1 },
</del><ins>+static const struct CompactHashIndex JSTestActiveDOMObjectTableIndex[2] = {
</ins><span class="cx"> { 0, -1 },
</span><span class="cx"> { -1, -1 },
</span><del>- { -1, -1 },
</del><span class="cx"> };
</span><span class="cx">
</span><span class="cx">
</span><span class="cx"> static const HashTableValue JSTestActiveDOMObjectTableValues[] =
</span><span class="cx"> {
</span><del>- { "constructor", DontEnum, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestActiveDOMObjectConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestActiveDOMObjectConstructor) } },
</del><span class="cx"> { "excitingAttr", ReadOnly | CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestActiveDOMObjectExcitingAttr), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
</span><span class="cx"> };
</span><span class="cx">
</span><del>-static const HashTable JSTestActiveDOMObjectTable = { 2, 3, true, JSTestActiveDOMObjectTableValues, JSTestActiveDOMObjectTableIndex };
</del><ins>+static const HashTable JSTestActiveDOMObjectTable = { 1, 1, true, JSTestActiveDOMObjectTableValues, JSTestActiveDOMObjectTableIndex };
</ins><span class="cx"> template<> JSValue JSTestActiveDOMObjectConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject)
</span><span class="cx"> {
</span><span class="cx"> UNUSED_PARAM(vm);
</span><span class="lines">@@ -107,6 +104,7 @@
</span><span class="cx">
</span><span class="cx"> static const HashTableValue JSTestActiveDOMObjectPrototypeTableValues[] =
</span><span class="cx"> {
</span><ins>+ { "constructor", DontEnum, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestActiveDOMObjectConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestActiveDOMObjectConstructor) } },
</ins><span class="cx"> { "excitingFunction", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestActiveDOMObjectPrototypeFunctionExcitingFunction), (intptr_t) (1) } },
</span><span class="cx"> { "postMessage", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestActiveDOMObjectPrototypeFunctionPostMessage), (intptr_t) (1) } },
</span><span class="cx"> };
</span><span class="lines">@@ -170,24 +168,20 @@
</span><span class="cx">
</span><span class="cx"> EncodedJSValue jsTestActiveDOMObjectConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName)
</span><span class="cx"> {
</span><del>- JSTestActiveDOMObject* domObject = jsDynamicCast<JSTestActiveDOMObject*>(JSValue::decode(thisValue));
</del><ins>+ JSTestActiveDOMObjectPrototype* domObject = jsDynamicCast<JSTestActiveDOMObjectPrototype*>(JSValue::decode(thisValue));
</ins><span class="cx"> if (!domObject)
</span><span class="cx"> return throwVMTypeError(state);
</span><del>- if (!BindingSecurity::shouldAllowAccessToDOMWindow(state, domObject->wrapped()))
- return JSValue::encode(jsUndefined());
</del><span class="cx"> return JSValue::encode(JSTestActiveDOMObject::getConstructor(state->vm(), domObject->globalObject()));
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void setJSTestActiveDOMObjectConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
</span><span class="cx"> {
</span><span class="cx"> JSValue value = JSValue::decode(encodedValue);
</span><del>- JSTestActiveDOMObject* domObject = jsDynamicCast<JSTestActiveDOMObject*>(JSValue::decode(thisValue));
</del><ins>+ JSTestActiveDOMObjectPrototype* domObject = jsDynamicCast<JSTestActiveDOMObjectPrototype*>(JSValue::decode(thisValue));
</ins><span class="cx"> if (UNLIKELY(!domObject)) {
</span><span class="cx"> throwVMTypeError(state);
</span><span class="cx"> return;
</span><span class="cx"> }
</span><del>- if (!shouldAllowAccessToFrame(state, domObject->wrapped().frame()))
- return;
</del><span class="cx"> // Shadowing a built-in constructor
</span><span class="cx"> domObject->putDirect(state->vm(), state->propertyNames().constructor, value);
</span><span class="cx"> }
</span></span></pre>
</div>
</div>
</body>
</html>