Skip to content
This repository has been archived by the owner on Feb 26, 2022. It is now read-only.

Commit

Permalink
Merge pull request #1163 from erikvold/846165p2
Browse files Browse the repository at this point in the history
Bug 846165 - Intermittent tests/test-panel.test Document Reload a=@Gozala
  • Loading branch information
erikvold committed Aug 13, 2013
2 parents a031a55 + 9e80027 commit bf00c41
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions test/test-panel.js
Expand Up @@ -129,11 +129,12 @@ exports["test Show Hide Panel"] = function(assert, done) {
exports["test Document Reload"] = function(assert, done) {
const { Panel } = require('sdk/panel');

let url2 = "data:text/html;charset=utf-8,page2";
let content =
"<script>" +
"window.onload = function() {" +
" setTimeout(function () {" +
" window.location = 'about:blank';" +
" window.location = '" + url2 + "';" +
" }, 0);" +
"}" +
"</script>";
Expand All @@ -144,11 +145,13 @@ exports["test Document Reload"] = function(assert, done) {
contentScript: "self.postMessage(window.location.href)",
onMessage: function (message) {
messageCount++;
assert.notEqual(message, 'about:blank', 'about:blank is not a message ' + messageCount);

if (messageCount == 1) {
assert.ok(/data:text\/html/.test(message), "First document had a content script " + message);
}
else if (messageCount == 2) {
assert.equal(message, "about:blank", "Second document too");
assert.equal(message, url2, "Second document too");
panel.destroy();
done();
}
Expand Down

0 comments on commit bf00c41

Please sign in to comment.