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

Unified Diff: third_party/WebKit/LayoutTests/fast/dom/Window/window-constructor.html

Issue 2306023002: binding: Makes WindowProperties.constructor throw a TypeError. (Closed)
Patch Set: Updated a layout test. Created 4 years, 3 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
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/fast/dom/Window/window-constructor-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/fast/dom/Window/window-constructor.html
diff --git a/third_party/WebKit/LayoutTests/fast/dom/Window/window-constructor.html b/third_party/WebKit/LayoutTests/fast/dom/Window/window-constructor.html
index 7d1f413640a6474c8ab48fd4687c7a873f7f767f..cc043d327a5b8fc1f8074d10ec2f6bc91365d98c 100644
--- a/third_party/WebKit/LayoutTests/fast/dom/Window/window-constructor.html
+++ b/third_party/WebKit/LayoutTests/fast/dom/Window/window-constructor.html
@@ -1,54 +1,24 @@
-<html>
-<head></head>
-<body>
-<p>Test for <a href="http://bugs.webkit.org/show_bug.cgi?id=47422">bug 47422</a>:
-window constructor shouldn't be directly callable.</p>
-<div id="console"></div>
+<!DOCTYPE html>
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
<script>
-if (window.testRunner) {
- window.testRunner.dumpAsText();
-}
+test(() => {
+ assert_equals(window.constructor.prototype, window.__proto__,
+ "Window constructor prototype is window prototype.");
-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);
-}
-
-function testConstructorProto()
-{
- var testName = "Window constructor prototype is window prototype"
- if (window.constructor.prototype === window.__proto__)
- log(testName + ": PASS", "green");
- else
- log(testName + ": FAIL", "red");
-}
+ assert_throws(null, () => { window.constructor(); },
+ "Window constructor must be non-callable.");
+ assert_throws(null, () => { new window.constructor; },
+ "Window constructor must be non-callable.");
-function testConstructorNotCallable()
-{
- var testName = "Window constructor not callable"
-
- var threwExc = false;
-
- try {
- newW = window.constructor()
- } catch(e) {
- threwExc = true;
- }
+ assert_throws(null, () => { window.__proto__.constructor(); },
+ "Window.prototype constructor must be non-callable.");
+ assert_throws(null, () => { new window.__proto__.constructor; },
+ "Window.prototype constructor must be non-callable.");
- if (threwExc) {
- log(testName + ": PASS", "green");
- } else {
- log(testName + ": FAIL", "red");
- }
-}
-
-testConstructorProto();
-testConstructorNotCallable();
+ assert_throws(null, () => { window.__proto__.__proto__.constructor(); },
+ "WindowProperties constructor must be non-callable.");
+ assert_throws(null, () => { new window.__proto__.__proto__.constructor; },
+ "WindowProperties constructor must be non-callable.");
+}, "Test Window and its prototype chain's constructors.");
</script>
-</body>
-</html>
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/fast/dom/Window/window-constructor-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698