mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 848935 - Add debug spew for browser_aboutHome.js intermittent failure.
This commit is contained in:
parent
ffc87fde9b
commit
5930035112
@ -31,7 +31,8 @@ let gTests = [
|
|||||||
},
|
},
|
||||||
run: function (aSnippetsMap)
|
run: function (aSnippetsMap)
|
||||||
{
|
{
|
||||||
isnot(aSnippetsMap.get("snippets-last-update"), null);
|
isnot(aSnippetsMap.get("snippets-last-update"), null,
|
||||||
|
"snippets-last-update should have a value");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -116,7 +117,7 @@ let gTests = [
|
|||||||
cm.getCategoryEntry("healthreport-js-provider", "SearchesProvider");
|
cm.getCategoryEntry("healthreport-js-provider", "SearchesProvider");
|
||||||
} catch (ex) {
|
} catch (ex) {
|
||||||
// Health Report disabled, or no SearchesProvider.
|
// Health Report disabled, or no SearchesProvider.
|
||||||
return;
|
return Promise.resolve();
|
||||||
}
|
}
|
||||||
|
|
||||||
let deferred = Promise.defer();
|
let deferred = Promise.defer();
|
||||||
@ -220,9 +221,9 @@ function test()
|
|||||||
let snippetsMap = yield promiseSetupSnippetsMap(tab, test.setup);
|
let snippetsMap = yield promiseSetupSnippetsMap(tab, test.setup);
|
||||||
// Ensure browser has set attributes already, or wait for them.
|
// Ensure browser has set attributes already, or wait for them.
|
||||||
yield promise;
|
yield promise;
|
||||||
|
info("Running test");
|
||||||
yield test.run(snippetsMap);
|
yield test.run(snippetsMap);
|
||||||
|
info("Cleanup");
|
||||||
gBrowser.removeCurrentTab();
|
gBrowser.removeCurrentTab();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -243,8 +244,10 @@ function promiseNewTabLoadEvent(aUrl, aEventType="load")
|
|||||||
{
|
{
|
||||||
let deferred = Promise.defer();
|
let deferred = Promise.defer();
|
||||||
let tab = gBrowser.selectedTab = gBrowser.addTab(aUrl);
|
let tab = gBrowser.selectedTab = gBrowser.addTab(aUrl);
|
||||||
|
info("Wait tab event: " + aEventType);
|
||||||
tab.linkedBrowser.addEventListener(aEventType, function load(event) {
|
tab.linkedBrowser.addEventListener(aEventType, function load(event) {
|
||||||
tab.linkedBrowser.removeEventListener(aEventType, load, true);
|
tab.linkedBrowser.removeEventListener(aEventType, load, true);
|
||||||
|
info("Tab event received: " + aEventType);
|
||||||
deferred.resolve(tab);
|
deferred.resolve(tab);
|
||||||
}, true);
|
}, true);
|
||||||
return deferred.promise;
|
return deferred.promise;
|
||||||
@ -264,7 +267,12 @@ function promiseSetupSnippetsMap(aTab, aSetupFn)
|
|||||||
{
|
{
|
||||||
let deferred = Promise.defer();
|
let deferred = Promise.defer();
|
||||||
let cw = aTab.linkedBrowser.contentWindow.wrappedJSObject;
|
let cw = aTab.linkedBrowser.contentWindow.wrappedJSObject;
|
||||||
|
info("Waiting for snippets map");
|
||||||
cw.ensureSnippetsMapThen(function (aSnippetsMap) {
|
cw.ensureSnippetsMapThen(function (aSnippetsMap) {
|
||||||
|
info("Got snippets map: " +
|
||||||
|
"{ last-update: " + aSnippetsMap.get("snippets-last-update") +
|
||||||
|
", cached-version: " + aSnippetsMap.get("snippets-cached-version") +
|
||||||
|
" }");
|
||||||
// Don't try to update.
|
// Don't try to update.
|
||||||
aSnippetsMap.set("snippets-last-update", Date.now());
|
aSnippetsMap.set("snippets-last-update", Date.now());
|
||||||
aSnippetsMap.set("snippets-cached-version", AboutHomeUtils.snippetsVersion);
|
aSnippetsMap.set("snippets-cached-version", AboutHomeUtils.snippetsVersion);
|
||||||
@ -293,6 +301,8 @@ function promiseBrowserAttributes(aTab)
|
|||||||
//docElt.setAttribute("snippetsURL", "nonexistent://test");
|
//docElt.setAttribute("snippetsURL", "nonexistent://test");
|
||||||
let observer = new MutationObserver(function (mutations) {
|
let observer = new MutationObserver(function (mutations) {
|
||||||
for (let mutation of mutations) {
|
for (let mutation of mutations) {
|
||||||
|
info("Got attribute mutation: " + mutation.attributeName +
|
||||||
|
" from " + mutation.oldValue);
|
||||||
if (mutation.attributeName == "snippetsURL" &&
|
if (mutation.attributeName == "snippetsURL" &&
|
||||||
docElt.getAttribute("snippetsURL") != "nonexistent://test") {
|
docElt.getAttribute("snippetsURL") != "nonexistent://test") {
|
||||||
docElt.setAttribute("snippetsURL", "nonexistent://test");
|
docElt.setAttribute("snippetsURL", "nonexistent://test");
|
||||||
@ -300,6 +310,7 @@ function promiseBrowserAttributes(aTab)
|
|||||||
|
|
||||||
// Now we just have to wait for the last attribute.
|
// Now we just have to wait for the last attribute.
|
||||||
if (mutation.attributeName == "searchEngineURL") {
|
if (mutation.attributeName == "searchEngineURL") {
|
||||||
|
info("Remove attributes observer");
|
||||||
observer.disconnect();
|
observer.disconnect();
|
||||||
// Must be sure to continue after the page mutation observer.
|
// Must be sure to continue after the page mutation observer.
|
||||||
executeSoon(function() deferred.resolve());
|
executeSoon(function() deferred.resolve());
|
||||||
@ -307,6 +318,7 @@ function promiseBrowserAttributes(aTab)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
info("Add attributes observer");
|
||||||
observer.observe(docElt, { attributes: true });
|
observer.observe(docElt, { attributes: true });
|
||||||
|
|
||||||
return deferred.promise;
|
return deferred.promise;
|
||||||
|
Loading…
Reference in New Issue
Block a user