Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: chrome/content/tests/popupBlocker.js

Issue 5745141503492096: Issue 1561 - Move unit tests out of the browser`s content area (Closed)
Patch Set: Created Nov. 14, 2014, 11:11 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/content/tests/popupBlocker.js
===================================================================
--- a/chrome/content/tests/popupBlocker.js
+++ b/chrome/content/tests/popupBlocker.js
@@ -12,43 +12,46 @@
server = new nsHttpServer();
server.start(1234);
server.registerPathHandler("/test", function(metadata, response)
{
response.setStatusLine("1.1", "200", "OK");
response.setHeader("Content-Type", "text/html; charset=utf-8");
- let body = '<html><body><a id="link" href="/redirect" target="_blank">link</a></body></html>';
+ let body =
+ '<body onload="document.dispatchEvent(new CustomEvent(\'frameready\', {bubbles: true}));">' +
+ '<a id="link" href="/redirect" target="_blank">link</a>' +
+ '</body>';
response.bodyOutputStream.write(body, body.length);
});
server.registerPathHandler("/redirect", function(metadata, response)
{
response.setStatusLine("1.1", "302", "Moved Temporarily");
response.setHeader("Location", "http://127.0.0.1:1234/target");
});
server.registerPathHandler("/target", function(metadata, response)
{
- response.setStatusLine("1.1", "302", "Moved Temporarily");
response.setHeader("Content-Type", "text/html; charset=utf-8");
let body = '<html><body>OK</body></html>';
response.bodyOutputStream.write(body, body.length);
});
- frame = document.createElement("iframe");
+ frame = document.createElementNS("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul", "iframe");
+ frame.setAttribute("type", "content");
frame.setAttribute("src", "http://127.0.0.1:1234/test");
frame.style.visibility = "collapse";
document.body.appendChild(frame);
stop();
- frame.addEventListener("load", function(event)
+ frame.addEventListener("frameready", function(event)
{
start();
- }, false);
+ }, false, true);
},
teardown: function()
{
restoreFilterComponents.call(this);
restorePrefs.call(this);
stop();
server.stop(function()

Powered by Google App Engine
This is Rietveld