зеркало из https://github.com/mozilla/pjs.git
Bug 521889 - browser_461743.js is randomly timing out, r=zeniko
This commit is contained in:
Родитель
61ff54c6a0
Коммит
6aa5d9168b
|
@ -42,14 +42,14 @@ function test() {
|
|||
let testURL = "http://localhost:8888/browser/" +
|
||||
"browser/components/sessionstore/test/browser/browser_461743_sample.html";
|
||||
|
||||
let frameCount = 0;
|
||||
let tab = gBrowser.addTab(testURL);
|
||||
info("New tab added");
|
||||
tab.linkedBrowser.addEventListener("load", function(aEvent) {
|
||||
info("New tab loaded");
|
||||
// Wait for all frames to load completely.
|
||||
if (frameCount++ < 2)
|
||||
return;
|
||||
tab.linkedBrowser.removeEventListener("load", arguments.callee, true);
|
||||
executeSoon(function() {
|
||||
let tab2 = gBrowser.duplicateTab(tab);
|
||||
info("Duplicated tab");
|
||||
tab2.linkedBrowser.addEventListener("461743", function(aEvent) {
|
||||
tab2.linkedBrowser.removeEventListener("461743", arguments.callee, true);
|
||||
is(aEvent.data, "done", "XSS injection was attempted");
|
||||
|
@ -60,13 +60,12 @@ function test() {
|
|||
isnot(innerHTML, Components.utils.reportError.toString(),
|
||||
"chrome access denied!");
|
||||
|
||||
// clean up
|
||||
// Clean up.
|
||||
gBrowser.removeTab(tab2);
|
||||
gBrowser.removeTab(tab);
|
||||
|
||||
finish();
|
||||
});
|
||||
}, true, true);
|
||||
});
|
||||
}, true);
|
||||
}
|
||||
|
|
|
@ -11,7 +11,15 @@
|
|||
var chromeUrl = "chrome://global/content/mozilla.xhtml";
|
||||
var exploitUrl = "javascript:try { document.body.innerHTML = Components.utils.reportError; } catch (ex) { }";
|
||||
|
||||
window.onload = function() {
|
||||
var loadCount = 0;
|
||||
frames[0].addEventListener("DOMContentLoaded", handleLoad, false);
|
||||
frames[1].addEventListener("DOMContentLoaded", handleLoad, false);
|
||||
function handleLoad() {
|
||||
if (++loadCount < 2)
|
||||
return;
|
||||
frames[0].removeEventListener("DOMContentLoaded", handleLoad, false);
|
||||
frames[1].removeEventListener("DOMContentLoaded", handleLoad, false);
|
||||
|
||||
var flip = 0;
|
||||
MutationEvent.prototype.toString = function() {
|
||||
return flip++ == 0 ? chromeUrl : exploitUrl;
|
||||
|
|
Загрузка…
Ссылка в новой задаче