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

Side by Side Diff: third_party/WebKit/LayoutTests/battery-status/detached-no-crash.html

Issue 2880763002: [Battery] Allow usage from SecureContext or top-level browsing context only. (Closed)
Patch Set: Remove battery-iframe.https-expected.txt and battery-insecure-context-expected.txt Created 3 years, 6 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
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/battery-status/detached-no-crash-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <!DOCTYPE HTML> 1 <!DOCTYPE HTML>
2 <body> 2 <body>
3 <head> 3 <head>
4 <script src="../resources/js-test.js"></script> 4 <script src="../resources/js-test.js"></script>
5 </head> 5 </head>
6 <script> 6 <script>
7 description("Accessing navigator.getBattery() on a closed window."); 7 description("Accessing navigator.getBattery() on a closed window.");
8 8
9 window.jsTestIsAsync = true; 9 window.jsTestIsAsync = true;
10 10
11 var w; 11 var w;
12 var nav; 12 var nav;
13 13
14 function processMessage(event) { 14 function processMessage(event) {
15 if (event.data == "opened") { 15 if (event.data == "opened") {
16 nav = w.navigator; 16 nav = w.navigator;
17 shouldBeTrue("typeof(nav.getBattery()) == 'object'"); 17 shouldBeTrue("typeof(nav.getBattery()) == 'object'");
18 w.close(); 18 w.close();
19 w = null; 19 w = null;
20 } else if (event.data == "closed") { 20 } else if (event.data == "closed") {
21 shouldBeUndefined("nav.getBattery()"); 21 nav.getBattery().then(battery => {
22 finishJSTest(); 22 assert_unreachable('getBattery should reject on a closed window');
23 })
24 .catch(error => {
25 // DOMException.SECURITY_ERR = 18.
26 debug('Error Code is ' + error.code);
27 assert_equals(error.code, DOMException.SECURITY_ERR);
28 });
29 setTimeout(finishJSTest, 0);
23 } 30 }
24 } 31 }
25 32
26 if (window.testRunner) { 33 if (window.testRunner) {
27 testRunner.dumpAsText(); 34 testRunner.dumpAsText();
28 testRunner.setCanOpenWindows(); 35 testRunner.setCanOpenWindows();
29 } 36 }
30 w = window.open('../resources/window-postmessage-open-close.html'); 37 w = window.open('../resources/window-postmessage-open-close.html');
31 window.addEventListener("message", processMessage, false); 38 window.addEventListener("message", processMessage, false);
32 </script> 39 </script>
33 </body> 40 </body>
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/battery-status/detached-no-crash-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698