mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
50f707b73c
* browser_426329.js - Fix exception in popupshowing event listener causing search history dropdown to remain open on subsequent tests. * browser_contextmenu.js - Add some debug messages. - Move |doOnloadOnce(checkSearchURL);| just before the search tab opens so there is less interference with later tests. - Add nsISelectionListener to know when selection has finished. * head.js - Consolidate duplicated doOnloadOnce function. * test.html - Fix character set warning.
52 lines
1.7 KiB
JavaScript
52 lines
1.7 KiB
JavaScript
/* Any copyright is dedicated to the Public Domain.
|
|
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
|
|
|
/**
|
|
* Recursively compare two objects and check that every property of expectedObj has the same value
|
|
* on actualObj.
|
|
*/
|
|
function isSubObjectOf(expectedObj, actualObj, name) {
|
|
for (let prop in expectedObj) {
|
|
if (typeof expectedObj[prop] == 'function')
|
|
continue;
|
|
if (expectedObj[prop] instanceof Object) {
|
|
is(actualObj[prop].length, expectedObj[prop].length, name + "[" + prop + "]");
|
|
isSubObjectOf(expectedObj[prop], actualObj[prop], name + "[" + prop + "]");
|
|
} else {
|
|
is(actualObj[prop], expectedObj[prop], name + "[" + prop + "]");
|
|
}
|
|
}
|
|
}
|
|
|
|
function waitForPopupShown(aPopupId, aCallback) {
|
|
let popup = document.getElementById(aPopupId);
|
|
info("waitForPopupShown: got popup: " + popup.id);
|
|
function onPopupShown() {
|
|
info("onPopupShown");
|
|
removePopupShownListener();
|
|
SimpleTest.executeSoon(aCallback);
|
|
}
|
|
function removePopupShownListener() {
|
|
popup.removeEventListener("popupshown", onPopupShown);
|
|
}
|
|
popup.addEventListener("popupshown", onPopupShown);
|
|
registerCleanupFunction(removePopupShownListener);
|
|
}
|
|
|
|
function waitForBrowserContextMenu(aCallback) {
|
|
waitForPopupShown(gBrowser.selectedBrowser.contextMenu, aCallback);
|
|
}
|
|
|
|
function doOnloadOnce(aCallback) {
|
|
function doOnloadOnceListener(aEvent) {
|
|
info("doOnloadOnce: " + aEvent.originalTarget.location);
|
|
removeDoOnloadOnceListener();
|
|
aCallback(aEvent);
|
|
}
|
|
function removeDoOnloadOnceListener() {
|
|
gBrowser.removeEventListener("DOMContentLoaded", doOnloadOnceListener);
|
|
}
|
|
gBrowser.addEventListener("DOMContentLoaded", doOnloadOnceListener);
|
|
registerCleanupFunction(removeDoOnloadOnceListener);
|
|
}
|