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

Side by Side Diff: LayoutTests/http/tests/security/xssAuditor/resources/utilities.js

Issue 19095003: Throw 'SecurityError' upon cross-origin Location access. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebaseline. Created 7 years, 5 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 | Annotate | Revision Log
OLDNEW
1 function checkIfFrameLocationMatchesSrcAndCallDone(frameId) 1 function checkIfFrameLocationMatchesSrcAndCallDone(frameId)
2 { 2 {
3 if (!window.testRunner) 3 if (!window.testRunner)
4 return; 4 return;
5 5
6 var actualURL = 'unavailable', frame = document.getElementById(frameId); 6 var actualURL = 'unavailable', frame = document.getElementById(frameId);
7 try { 7 try {
8 actualURL = frame.contentWindow.location.href; 8 actualURL = frame.contentWindow.location.href;
9 } 9 }
10 catch (e) {} 10 catch (e) {
11 11 actualURL = '[Location object access threw exception]';
12 }
13
12 if (actualURL != frame.src) 14 if (actualURL != frame.src)
13 alert('URL mismatch: ' + actualURL + ' vs. ' + frame.src); 15 alert('URL mismatch: \'' + actualURL + '\' vs. \'' + frame.src + '\'');
14 16
15 testRunner.notifyDone(); 17 testRunner.notifyDone();
16 } 18 }
17 19
18 function sendRequestFromIFrame(url, params, HTTPMethod, callbackWhenDone) 20 function sendRequestFromIFrame(url, params, HTTPMethod, callbackWhenDone)
19 { 21 {
20 if (!params || !params.length) 22 if (!params || !params.length)
21 return; 23 return;
22 24
23 if (!HTTPMethod) 25 if (!HTTPMethod)
(...skipping 29 matching lines...) Expand all
53 var index = ids.indexOf(event.data); 55 var index = ids.indexOf(event.data);
54 if (index == -1) 56 if (index == -1)
55 return; 57 return;
56 58
57 loadAttempted = loadAttempted | (1 << index); 59 loadAttempted = loadAttempted | (1 << index);
58 if (loadAttempted == (1 << ids.length) - 1) 60 if (loadAttempted == (1 << ids.length) - 1)
59 testRunner.notifyDone(); 61 testRunner.notifyDone();
60 }, false); 62 }, false);
61 } 63 }
62 64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698