mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
39 lines
1.0 KiB
JavaScript
39 lines
1.0 KiB
JavaScript
Cu.import("resource://gre/modules/Services.jsm");
|
|
|
|
function test() {
|
|
waitForExplicitFinish();
|
|
|
|
let openedWindows = 0;
|
|
|
|
let winObserver = function(win, topic) {
|
|
if (topic == "domwindowopened") {
|
|
win.addEventListener("load", function onLoadWindow() {
|
|
win.removeEventListener("load", onLoadWindow, false);
|
|
openedWindows++;
|
|
if (openedWindows == 2) {
|
|
win.close();
|
|
}
|
|
}, false);
|
|
}
|
|
}
|
|
|
|
Services.ww.registerNotification(winObserver);
|
|
|
|
let mutObserver = null;
|
|
|
|
loadWebapp("getUserMedia.webapp", undefined, function onLoad() {
|
|
let msg = gAppBrowser.contentDocument.getElementById("msg");
|
|
mutObserver = new MutationObserver(function(mutations) {
|
|
is(msg.textContent, "PERMISSION_DENIED", "getUserMedia permission denied.");
|
|
is(openedWindows, 2, "Prompt shown.");
|
|
finish();
|
|
});
|
|
mutObserver.observe(msg, { childList: true });
|
|
});
|
|
|
|
registerCleanupFunction(function() {
|
|
Services.ww.unregisterNotification(winObserver);
|
|
mutObserver.disconnect();
|
|
});
|
|
}
|