mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
0f70c4cb90
--HG-- extra : rebase_source : 8419648607fbf9f7acd672cb0f94ce7a05a32d88
60 lines
1.8 KiB
JavaScript
60 lines
1.8 KiB
JavaScript
/* Any copyright is dedicated to the public domain.
|
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
|
|
|
// Bug 742944 - Test that window.open works with <iframe mozbrowser>.
|
|
|
|
"use strict";
|
|
SimpleTest.waitForExplicitFinish();
|
|
|
|
function runTest() {
|
|
browserElementTestHelpers.setEnabledPref(true);
|
|
browserElementTestHelpers.addToWhitelist();
|
|
|
|
var iframe = document.createElement('iframe');
|
|
iframe.mozbrowser = true;
|
|
|
|
var gotPopup = false;
|
|
iframe.addEventListener('mozbrowseropenwindow', function(e) {
|
|
is(gotPopup, false, 'Should get just one popup.');
|
|
gotPopup = true;
|
|
|
|
document.body.appendChild(e.detail.frameElement);
|
|
|
|
ok(/file_browserElement_Open2\.html$/.test(e.detail.url),
|
|
"Popup's URL (got " + e.detail.url + ")");
|
|
is(e.detail.name, "name");
|
|
is(e.detail.features, "features");
|
|
});
|
|
|
|
iframe.addEventListener('mozbrowsershowmodalprompt', function(e) {
|
|
ok(gotPopup, 'Got mozbrowseropenwindow event before showmodalprompt event.');
|
|
if (e.detail.message.indexOf("success:") == 0) {
|
|
ok(true, e.detail.message);
|
|
}
|
|
else if (e.detail.message.indexOf("failure:") == 0) {
|
|
ok(false, e.detail.message);
|
|
}
|
|
else if (e.detail.message == "finish") {
|
|
SimpleTest.finish();
|
|
}
|
|
else {
|
|
ok(false, "Got invalid message: " + e.detail.message);
|
|
}
|
|
});
|
|
|
|
/**
|
|
* file_browserElementOpen1 does
|
|
*
|
|
* window.open('file_browserElement_Open2.html', 'name', 'features')
|
|
*
|
|
* then adds an event listener to the opened window and waits for onload.
|
|
*
|
|
* Onload, we fire a few alerts saying "success:REASON" or "failure:REASON".
|
|
* Finally, we fire a "finish" alert, which ends the test.
|
|
*/
|
|
iframe.src = 'file_browserElement_Open1.html';
|
|
document.body.appendChild(iframe);
|
|
}
|
|
|
|
runTest();
|