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

Side by Side Diff: third_party/WebKit/LayoutTests/http/tests/security/rel-noopener/window-open.html

Issue 2379313002: Fix 'noopener' targeting and return value. (Closed)
Patch Set: Rebase Created 4 years, 2 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 unified diff | Download patch
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <script src="/resources/testharness.js"></script>
3 <script src="/resources/testharnessreport.js"></script>
4 <script>
5 if (window.testRunner)
6 testRunner.setCanOpenWindows();
7
8 var windowsInThisProcess = 1; // This window counts.
9
10 test(t => {
11 var w = window.open("", "", "noopener");
12 assert_equals(w, null);
13 if (window.testRunner)
14 assert_equals(testRunner.windowCount(), windowsInThisProcess, "Shoul d have opened a window in a new process.");
15 }, "window.open returns 'null' when 'noopener' present.");
16
17 test(t => {
18 var w1 = window.open("", "windowname1", "noopener");
19 if (window.testRunner)
20 assert_equals(testRunner.windowCount(), windowsInThisProcess, "Shoul d have opened a window in a new process.");
21 var w2 = window.open("", "windowname1");
22 if (window.testRunner)
23 assert_equals(testRunner.windowCount(), ++windowsInThisProcess, "Sho uld have opened a window in this process.");
24 assert_equals(w1, null);
25 assert_not_equals(w2, null);
26 }, "Opening a named window as noopener, then normally should work.");
27
28 test(t => {
29 var w1 = window.open("", "windowname2");
30 if (window.testRunner)
31 assert_equals(testRunner.windowCount(), ++windowsInThisProcess, "Sho uld have opened a window in this process.");
32 var w2 = window.open("", "windowname2", "noopener");
33 if (window.testRunner)
34 assert_equals(testRunner.windowCount(), windowsInThisProcess, "Shoul d have opened a window a new process.");
35 assert_not_equals(w1, null);
36 assert_equals(w2, null);
37 }, "Opening a named window normally, then as noopener should work.");
38 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698