1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
let tests = {}, hiddenFrames, HiddenFrame;
tests.testFrame = function(test) {
let url = "data:text/html,<!DOCTYPE%20html>";
test.waitUntilDone();
let hiddenFrame = hiddenFrames.add(HiddenFrame({
onReady: function () {
test.assertEqual(this.element.contentWindow.location, "about:blank",
"HiddenFrame loads about:blank by default.");
function onDOMReady() {
hiddenFrame.element.removeEventListener("DOMContentLoaded", onDOMReady,
false);
test.assertEqual(hiddenFrame.element.contentWindow.location, url,
"HiddenFrame loads the specified content.");
test.done();
}
this.element.addEventListener("DOMContentLoaded", onDOMReady, false);
this.element.setAttribute("src", url);
}
}));
};
let hiddenFrameSupported = true;
try {
hiddenFrames = require("hidden-frame");
HiddenFrame = hiddenFrames.HiddenFrame;
}
catch(ex if ex.message == [
"The hidden-frame module currently supports only Firefox and Thunderbird. ",
"In the future, we would like it to support other applications, however. ",
"Please see https://bugzilla.mozilla.org/show_bug.cgi?id=546740 for more ",
"information."
].join("")) {
hiddenFrameSupported = false;
}
if (hiddenFrameSupported) {
for (let test in tests)
exports[test] = tests[test];
}
else {
exports.testHiddenFrameNotSupported = function(test) {
test.pass("The hidden-frame module is not supported on this app.");
}
}
|