Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(49)

Unified Diff: third_party/WebKit/LayoutTests/fast/dom/global-constructors.html

Issue 1667653002: V8-binding: Use v8::Template::SetNativeDataProperty without setter for [Replaceable]. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Moved the [LenientThis] test to http/tests/. Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/fast/dom/global-constructors.html
diff --git a/third_party/WebKit/LayoutTests/fast/dom/global-constructors.html b/third_party/WebKit/LayoutTests/fast/dom/global-constructors.html
index 25c56e07eab0a3f4a2b382f53ecf1df38c41ed64..304f9953257fe84b2ed0f1d28328eb134eabc52d 100644
--- a/third_party/WebKit/LayoutTests/fast/dom/global-constructors.html
+++ b/third_party/WebKit/LayoutTests/fast/dom/global-constructors.html
@@ -6,7 +6,7 @@
}
</style>
<script>
-function print(message, color)
+function print(message, color)
{
var paragraph = document.createElement("div");
paragraph.appendChild(document.createTextNode(message));
@@ -28,34 +28,34 @@ function shouldBe(a, b)
print("FAIL: " + a + " should be " + b + " but instead is " + evalA, "red");
}
-function test()
+function test()
{
if (window.testRunner)
testRunner.dumpAsText();
domParser = new DOMParser();
shouldBe("DOMParser.prototype.isPrototypeOf(domParser)", true);
-
+
xmlHttpRequest = new XMLHttpRequest();
shouldBe("XMLHttpRequest.prototype.isPrototypeOf(xmlHttpRequest)", true);
-
+
xmlSerializer = new XMLSerializer();
shouldBe("XMLSerializer.prototype.isPrototypeOf(xmlSerializer)", true);
-
+
xsltProcessor = new XSLTProcessor();
shouldBe("XSLTProcessor.prototype.isPrototypeOf(xsltProcessor)", true);
shouldBe("window.Document.prototype.isPrototypeOf(document)", true);
shouldBe("window.HTMLDocument.prototype.isPrototypeOf(document)", true);
-
+
element = document.body;
shouldBe("window.Node.prototype.isPrototypeOf(element)", true);
shouldBe("window.Element.prototype.isPrototypeOf(element)", true);
shouldBe("window.HTMLElement.prototype.isPrototypeOf(element)", true);
-
+
range = document.createRange();
shouldBe("window.Range.prototype.isPrototypeOf(range)", true);
-
+
cssRule = document.styleSheets[0].cssRules[0];
shouldBe("window.CSSRule.prototype.isPrototypeOf(cssRule)", true);
@@ -68,46 +68,53 @@ function test()
xmldoc = document.implementation.createDocument(null, null, null);
shouldBe("window.XMLDocument.prototype.isPrototypeOf(xmldoc)", true);
-
+
fragment = document.createDocumentFragment();
shouldBe("window.DocumentFragment.prototype.isPrototypeOf(fragment)", true);
-
+
xpathevaluator = new XPathEvaluator();
shouldBe("window.XPathEvaluator.prototype.isPrototypeOf(xpathevaluator)", true);
-
+
xpathresult = xpathevaluator.evaluate('/', document, null, 0, null);
shouldBe("window.XPathResult.prototype.isPrototypeOf(xpathresult)", true);
-
+
try {
nodeFilter = document.createNodeIterator(document, NodeFilter.SHOW_ELEMENT, function () {}, false).filter;
} catch(e) {}
shouldBe("window.NodeFilter.prototype.isPrototypeOf(nodeFilter)", true);
originalNodePrototype = window.Node.prototype;
-
- delete window.Node.prototype;
+
+ deleteResult = delete window.Node.prototype;
print("[Deleted window.Node.prototype]");
shouldBe("window.Node.prototype", originalNodePrototype);
-
- originalNodeConstructor = window.Node;
+ shouldBe("deleteResult", false);
- // Shadow window.Node
- window.Node = 1;
- print("[Set window.Node = 1]");
- shouldBe("window.Node", 1);
-
- // Unshadow window.Node
- delete window.Node;
- print("[Deleted window.Node]");
- shouldBe("window.Node", originalNodeConstructor);
+ originalNodeConstructor = window.Node;
// Attempt to shadow window.Node with a frame named 'Node'
var iframe = document.createElement('iframe');
- iframe.setAttribute('name', "Node");
+ iframe.setAttribute('name', 'Node');
document.body.appendChild(iframe);
print("[Added an iframe named 'Node']");
shouldBe("window.Node", originalNodeConstructor);
-
+
+ // Shadow window.Node
+ window.Node = 1;
+ print("[Set window.Node = 1]");
+ shouldBe("window.Node", 1);
+
+ // Delete window.Node
+ deleteResult = delete window.Node;
+ print("[Deleted window.Node]");
+ shouldBe("window.Node", iframe.contentWindow);
+ shouldBe("deleteResult", true);
+
+ // Delete window.Element
+ deleteResult = delete window.Element;
+ print("[Deleted window.Element]");
+ shouldBe("window.Element", undefined);
+ shouldBe("deleteResult", true);
}
</script>
</head>

Powered by Google App Engine
This is Rietveld 408576698