| 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>
|
|
|