[SCM] WebKit Debian packaging branch, debian/experimental, updated. debian/1.3.8-1-1049-g2e11a8e
msaboff at apple.com
msaboff at apple.com
Fri Jan 21 14:36:58 UTC 2011
The following commit has been merged in the debian/experimental branch:
commit 213515946864214fb267d05e86bea8fbc2fd3131
Author: msaboff at apple.com <msaboff at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Thu Dec 23 05:39:21 2010 +0000
2010-12-22 Michael Saboff <msaboff at apple.com>
Reviewed by Sam Weinig.
REGRESSION: Can't shadow/overwrite window.constructor
(causes TypeError exception)
https://bugs.webkit.org/show_bug.cgi?id=48953
Added code in the javascript code generator to create a setter for
a constructor if the new extended attribute ReplaceableConstructor
is present for the interface.
* bindings/scripts/CodeGeneratorJS.pm:
* page/DOMWindow.idl:
2010-12-22 Michael Saboff <msaboff at apple.com>
Reviewed by Sam Weinig.
REGRESSION: Can't shadow/overwrite window.constructor
(causes TypeError exception)
https://bugs.webkit.org/show_bug.cgi?id=48953
Changed cross-frame-access-put test results to reflect that setting
the window constructor will be disallowed due to cross frame security
checking.
Added a new test to check that we can change window.constructor.
* fast/dom/Window/window-constructor-settable-expected.txt: Added.
* fast/dom/Window/window-constructor-settable.html: Added.
* http/tests/security/cross-frame-access-put-expected.txt:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@74537 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 80ad0bb..9fbfc72 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,20 @@
+2010-12-22 Michael Saboff <msaboff at apple.com>
+
+ Reviewed by Sam Weinig.
+
+ REGRESSION: Can't shadow/overwrite window.constructor
+ (causes TypeError exception)
+ https://bugs.webkit.org/show_bug.cgi?id=48953
+
+ Changed cross-frame-access-put test results to reflect that setting
+ the window constructor will be disallowed due to cross frame security
+ checking.
+ Added a new test to check that we can change window.constructor.
+
+ * fast/dom/Window/window-constructor-settable-expected.txt: Added.
+ * fast/dom/Window/window-constructor-settable.html: Added.
+ * http/tests/security/cross-frame-access-put-expected.txt:
+
2010-12-22 Mihai Parparita <mihaip at chromium.org>
Unreviewed test expectations update. fast/canvas/fillText-shadow.html
diff --git a/LayoutTests/fast/dom/Window/window-constructor-settable-expected.txt b/LayoutTests/fast/dom/Window/window-constructor-settable-expected.txt
new file mode 100644
index 0000000..de3b099
--- /dev/null
+++ b/LayoutTests/fast/dom/Window/window-constructor-settable-expected.txt
@@ -0,0 +1,3 @@
+Test for bug 48953: Can't shadow/overwrite window.constructor.
+
+Can replace window constructor: PASS
diff --git a/LayoutTests/fast/dom/Window/window-constructor-settable.html b/LayoutTests/fast/dom/Window/window-constructor-settable.html
new file mode 100644
index 0000000..10ab75c
--- /dev/null
+++ b/LayoutTests/fast/dom/Window/window-constructor-settable.html
@@ -0,0 +1,33 @@
+<html>
+<head></head>
+<body>
+<p>Test for <a href="http://bugs.webkit.org/show_bug.cgi?id=48953">bug 48953</a>:
+Can't shadow/overwrite window.constructor.</p>
+<div id="console"></div>
+<script>
+if (window.layoutTestController) {
+ window.layoutTestController.dumpAsText();
+}
+
+function log(message, color)
+{
+ var paragraph = document.createElement("div");
+ paragraph.appendChild(document.createTextNode(message));
+ paragraph.style.fontFamily = "monospace";
+ if (color)
+ paragraph.style.color = color;
+ document.getElementById("console").appendChild(paragraph);
+}
+
+var testName = "Can replace window constructor"
+var newConstructor = "MyConstructor";
+var constructor = newConstructor;
+
+if ((constructor == newConstructor) && (window.constructor == newConstructor))
+ log(testName + ": PASS", "green");
+else
+ log(testName + ": FAIL", "red");
+
+</script>
+</body>
+</html>
diff --git a/LayoutTests/http/tests/security/cross-frame-access-put-expected.txt b/LayoutTests/http/tests/security/cross-frame-access-put-expected.txt
index b18acea..58a0544 100644
--- a/LayoutTests/http/tests/security/cross-frame-access-put-expected.txt
+++ b/LayoutTests/http/tests/security/cross-frame-access-put-expected.txt
@@ -372,6 +372,8 @@ CONSOLE MESSAGE: line 1: Unsafe JavaScript attempt to access frame with URL http
CONSOLE MESSAGE: line 1: Unsafe JavaScript attempt to access frame with URL http://localhost:8000/security/resources/cross-frame-iframe-for-put-test.html from frame with URL http://127.0.0.1:8000/security/cross-frame-access-put.html. Domains, protocols and ports must match.
+CONSOLE MESSAGE: line 1: Unsafe JavaScript attempt to access frame with URL http://localhost:8000/security/resources/cross-frame-iframe-for-put-test.html from frame with URL http://127.0.0.1:8000/security/cross-frame-access-put.html. Domains, protocols and ports must match.
+
ALERT: PASS: window.Attr should be '[object AttrConstructor]' and is.
ALERT: PASS: window.CDATASection should be '[object CDATASectionConstructor]' and is.
ALERT: PASS: window.CharacterData should be '[object CharacterDataConstructor]' and is.
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 527716f..c7cfc4d 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,18 @@
+2010-12-22 Michael Saboff <msaboff at apple.com>
+
+ Reviewed by Sam Weinig.
+
+ REGRESSION: Can't shadow/overwrite window.constructor
+ (causes TypeError exception)
+ https://bugs.webkit.org/show_bug.cgi?id=48953
+
+ Added code in the javascript code generator to create a setter for
+ a constructor if the new extended attribute ReplaceableConstructor
+ is present for the interface.
+
+ * bindings/scripts/CodeGeneratorJS.pm:
+ * page/DOMWindow.idl:
+
2010-12-22 Steve Lacey <sjl at chromium.org>
Reviewed by David Levin.
diff --git a/WebCore/bindings/scripts/CodeGeneratorJS.pm b/WebCore/bindings/scripts/CodeGeneratorJS.pm
index 132518f..cff51e9 100644
--- a/WebCore/bindings/scripts/CodeGeneratorJS.pm
+++ b/WebCore/bindings/scripts/CodeGeneratorJS.pm
@@ -1017,6 +1017,11 @@ sub GenerateHeader
my $getter = "js" . $interfaceName . "Constructor";
push(@headerContent, "JSC::JSValue ${getter}(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&);\n");
}
+
+ if ($dataNode->extendedAttributes->{"ReplaceableConstructor"}) {
+ my $constructorFunctionName = "setJS" . $interfaceName . "Constructor";
+ push(@headerContent, "void ${constructorFunctionName}(JSC::ExecState*, JSC::JSObject*, JSC::JSValue);\n");
+ }
}
if ($numConstants > 0) {
@@ -1095,8 +1100,14 @@ sub GenerateAttributesHashTable($$)
push(@hashKeys, "constructor");
my $getter = "js" . $interfaceName . "Constructor";
push(@hashValue1, $getter);
- push(@hashValue2, "0");
- push(@hashSpecials, "DontEnum | ReadOnly"); # FIXME: Setting the constructor should be possible.
+ if ($dataNode->extendedAttributes->{"ReplaceableConstructor"}) {
+ my $setter = "setJS" . $interfaceName . "Constructor";
+ push(@hashValue2, $setter);
+ push(@hashSpecials, "DontEnum | DontDelete");
+ } else {
+ push(@hashValue2, "0");
+ push(@hashSpecials, "DontEnum | ReadOnly");
+ }
}
$object->GenerateHashTable($hashName, $hashSize,
@@ -1629,6 +1640,7 @@ sub GenerateImplementation
push(@implContent, " return ${className}::getConstructor(exec, domObject->globalObject());\n");
push(@implContent, "}\n");
+ push(@implContent, "\n");
}
}
@@ -1722,7 +1734,11 @@ sub GenerateImplementation
$implIncludes{"JS" . $constructorType . ".h"} = 1;
}
push(@implContent, " // Shadowing a built-in constructor\n");
- push(@implContent, " static_cast<$className*>(thisObject)->putDirect(Identifier(exec, \"$name\"), value);\n");
+ if ($interfaceName eq "DOMWindow" && $className eq "JSblah") {
+ push(@implContent, " static_cast<$className*>(thisObject)->putDirect(exec->propertyNames().constructor, value);\n");
+ } else {
+ push(@implContent, " static_cast<$className*>(thisObject)->putDirect(Identifier(exec, \"$name\"), value);\n");
+ }
} elsif ($attribute->signature->extendedAttributes->{"Replaceable"}) {
push(@implContent, " // Shadowing a built-in object\n");
push(@implContent, " static_cast<$className*>(thisObject)->putDirect(Identifier(exec, \"$name\"), value);\n");
@@ -1790,6 +1806,31 @@ sub GenerateImplementation
}
}
}
+
+ if ($dataNode->extendedAttributes->{"ReplaceableConstructor"}) {
+ my $constructorFunctionName = "setJS" . $interfaceName . "Constructor";
+
+ push(@implContent, "void ${constructorFunctionName}(ExecState* exec, JSObject* thisObject, JSValue value)\n");
+ push(@implContent, "{\n");
+ if ($dataNode->extendedAttributes->{"CheckDomainSecurity"}) {
+ if ($interfaceName eq "DOMWindow") {
+ push(@implContent, " if (!static_cast<$className*>(thisObject)->allowsAccessFrom(exec))\n");
+ } else {
+ push(@implContent, " if (!allowsAccessFromFrame(exec, static_cast<$className*>(thisObject)->impl()->frame()))\n");
+ }
+ push(@implContent, " return;\n");
+ }
+
+ push(@implContent, " // Shadowing a built-in constructor\n");
+
+ if ($interfaceName eq "DOMWindow") {
+ push(@implContent, " static_cast<$className*>(thisObject)->putDirect(exec->propertyNames().constructor, value);\n");
+ } else {
+ push(@implContent, " static_cast<$className*>(thisObject)->putDirect(Identifier(exec, \"$name\"), value);\n");
+ }
+ push(@implContent, "}\n");
+ push(@implContent, "\n");
+ }
}
}
diff --git a/WebCore/page/DOMWindow.idl b/WebCore/page/DOMWindow.idl
index b2f4085..4e7985f 100644
--- a/WebCore/page/DOMWindow.idl
+++ b/WebCore/page/DOMWindow.idl
@@ -40,6 +40,7 @@ module window {
EventTarget,
ExtendsDOMGlobalObject,
GenerateNativeConverter,
+ ReplaceableConstructor,
LegacyParent=JSDOMWindowBase
] DOMWindow {
// DOM Level 0
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list