Title: [89892] branches/chromium/782

Diff

Copied: branches/chromium/782/LayoutTests/http/tests/security/location-prototype-expected.txt (from rev 89782, trunk/LayoutTests/http/tests/security/location-prototype-expected.txt) (0 => 89892)


--- branches/chromium/782/LayoutTests/http/tests/security/location-prototype-expected.txt	                        (rev 0)
+++ branches/chromium/782/LayoutTests/http/tests/security/location-prototype-expected.txt	2011-06-28 05:13:11 UTC (rev 89892)
@@ -0,0 +1,2 @@
+ALERT: Yay! Calling a function that shouldn't exist threw an exception.
+This test passes if it doesn't alert the string "fail". 

Copied: branches/chromium/782/LayoutTests/http/tests/security/location-prototype.html (from rev 89782, trunk/LayoutTests/http/tests/security/location-prototype.html) (0 => 89892)


--- branches/chromium/782/LayoutTests/http/tests/security/location-prototype.html	                        (rev 0)
+++ branches/chromium/782/LayoutTests/http/tests/security/location-prototype.html	2011-06-28 05:13:11 UTC (rev 89892)
@@ -0,0 +1,22 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<script>
+if (window.layoutTestController)
+    layoutTestController.dumpAsText();
+
+function loaded() {
+  try {
+    window.location.fail();
+  } catch(ex) {
+    alert("Yay! Calling a function that shouldn't exist threw an exception.");
+  }
+}
+
+</script>
+</head>
+<body _onload_="loaded()">
+This test passes if it doesn't alert the string "fail".
+<iframe src=""
+</body>
+</html>

Copied: branches/chromium/782/LayoutTests/http/tests/security/resources/location-prototype-overwrite.html (from rev 89782, trunk/LayoutTests/http/tests/security/resources/location-prototype-overwrite.html) (0 => 89892)


--- branches/chromium/782/LayoutTests/http/tests/security/resources/location-prototype-overwrite.html	                        (rev 0)
+++ branches/chromium/782/LayoutTests/http/tests/security/resources/location-prototype-overwrite.html	2011-06-28 05:13:11 UTC (rev 89892)
@@ -0,0 +1,9 @@
+<!DOCTYPE HTML>
+<script>
+// Make sure touch top window location first, get the hook to inject function.
+window.top.location;
+
+Object.prototype.fail = function() {
+  alert('FAIL!');
+};
+</script>

Modified: branches/chromium/782/LayoutTests/platform/chromium/fast/dom/prototype-inheritance-expected.txt (89891 => 89892)


--- branches/chromium/782/LayoutTests/platform/chromium/fast/dom/prototype-inheritance-expected.txt	2011-06-28 05:08:53 UTC (rev 89891)
+++ branches/chromium/782/LayoutTests/platform/chromium/fast/dom/prototype-inheritance-expected.txt	2011-06-28 05:13:11 UTC (rev 89892)
@@ -713,16 +713,16 @@
 PASS inner.getMatchedCSSRules.constructor.isInner is true
 PASS inner.getSelection.isInner is true
 PASS inner.getSelection.constructor.isInner is true
-FAIL inner.history.isInner should be true. Was false.
-FAIL inner.history.constructor.isInner should be true. Was false.
+PASS inner.history.isInner is true
+PASS inner.history.constructor.isInner is true
 PASS inner.isFinite.isInner is true
 PASS inner.isFinite.constructor.isInner is true
 PASS inner.isNaN.isInner is true
 PASS inner.isNaN.constructor.isInner is true
 FAIL inner.localStorage.isInner should be true. Was false.
 FAIL inner.localStorage.constructor.isInner should be true. Was false.
-FAIL inner.location.isInner should be true. Was false.
-FAIL inner.location.constructor.isInner should be true. Was false.
+PASS inner.location.isInner is true
+PASS inner.location.constructor.isInner is true
 FAIL inner.locationbar.isInner should be true. Was false.
 FAIL inner.locationbar.constructor.isInner should be true. Was false.
 PASS inner.matchMedia.isInner is true

Modified: branches/chromium/782/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm (89891 => 89892)


--- branches/chromium/782/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm	2011-06-28 05:08:53 UTC (rev 89891)
+++ branches/chromium/782/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm	2011-06-28 05:13:11 UTC (rev 89892)
@@ -634,6 +634,12 @@
     return IsSubType($dataNode, "Node");
 }
 
+sub IsVisibleAcrossOrigins
+{
+    my $dataNode = shift;
+    return $dataNode->extendedAttributes->{"CheckDomainSecurity"} && !($dataNode->name eq "DOMWindow");
+}
+
 sub GenerateDomainSafeFunctionGetter
 {
     my $function = shift;
@@ -2505,9 +2511,22 @@
 END
     }
 
-    if (IsNodeSubType($dataNode)) {
+    # FIXME: We need a better way of recovering the correct prototype chain
+    # for every sort of object. For now, we special-case cross-origin visible
+    # objects (i.e., those with CheckDomainSecurity).
+    if (IsVisibleAcrossOrigins($dataNode)) {
         push(@implContent, <<END);
+    if (impl->frame()) {
+        proxy = V8Proxy::retrieve(impl->frame());
+        if (proxy)
+            proxy->windowShell()->initContextIfNeeded();
+    }
+END
+    }
 
+    if (IsNodeSubType($dataNode) || IsVisibleAcrossOrigins($dataNode)) {
+        push(@implContent, <<END);
+
     v8::Handle<v8::Context> context;
     if (proxy)
         context = proxy->context();
@@ -2521,7 +2540,7 @@
     push(@implContent, <<END);
     wrapper = V8DOMWrapper::instantiateV8Object(proxy, &info, impl);
 END
-    if (IsNodeSubType($dataNode)) {
+    if (IsNodeSubType($dataNode) || IsVisibleAcrossOrigins($dataNode)) {
         push(@implContent, <<END);
     // Exit the node's context if it was entered.
     if (!context.IsEmpty())
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to