Bug 1166269, e10s, fix and reenable browser_bug503832, r=felipe

This commit is contained in:
Neil Deakin 2015-05-19 21:20:49 -04:00
parent 64a7a40bf2
commit 1b08c3f007
2 changed files with 49 additions and 59 deletions

View File

@ -80,7 +80,7 @@ skip-if = e10s # Bug ?????? - obscure test failures (shistory has a new entry -
[browser_bug441169.js]
skip-if = buildapp == 'mulet'
[browser_bug503832.js]
skip-if = buildapp == 'mulet' || e10s # Bug 933103 - mochitest's EventUtils.synthesizeMouse functions not e10s friendly
skip-if = buildapp == 'mulet'
[browser_bug554155.js]
[browser_bug655270.js]
skip-if = e10s # Bug ?????? - PlacesUtils.history.addObserver notifications don't seem to fire

View File

@ -2,53 +2,51 @@
* https://bugzilla.mozilla.org/show_bug.cgi?id=503832
*/
function test() {
waitForExplicitFinish();
add_task(function* () {
var pagetitle = "Page Title for Bug 503832";
var pageurl = "http://mochi.test:8888/browser/docshell/test/browser/file_bug503832.html";
var fragmenturl = "http://mochi.test:8888/browser/docshell/test/browser/file_bug503832.html#firefox";
/* Global history observer that triggers for the two test URLs above. */
var historyObserver = {
onBeginUpdateBatch: function() {},
onEndUpdateBatch: function() {},
onVisit: function(aURI, aVisitID, aTime, aSessionId, aReferringId,
aTransitionType, _added) {},
onTitleChanged: function(aURI, aPageTitle) {
aURI = aURI.spec;
switch (aURI) {
case pageurl:
is(aPageTitle, pagetitle, "Correct page title for " + aURI);
return;
case fragmenturl:
is(aPageTitle, pagetitle, "Correct page title for " + aURI);
// If titles for fragment URLs aren't set, this code
// branch won't be called and the test will timeout,
// resulting in a failure
historyService.removeObserver(historyObserver, false);
gBrowser.removeCurrentTab();
finish();
}
},
onDeleteURI: function(aURI) {},
onClearHistory: function() {},
onPageChanged: function(aURI, aWhat, aValue) {},
onDeleteVisits: function () {},
QueryInterface: function(iid) {
if (iid.equals(Ci.nsINavHistoryObserver) ||
iid.equals(Ci.nsISupports)) {
return this;
}
throw Cr.NS_ERROR_NO_INTERFACE;
}
};
var historyService = Cc["@mozilla.org/browser/nav-history-service;1"]
.getService(Ci.nsINavHistoryService);
historyService.addObserver(historyObserver, false);
let fragmentPromise = new Promise(resolve => {
/* Global history observer that triggers for the two test URLs above. */
var historyObserver = {
onBeginUpdateBatch: function() {},
onEndUpdateBatch: function() {},
onVisit: function(aURI, aVisitID, aTime, aSessionId, aReferringId,
aTransitionType, _added) {},
onTitleChanged: function(aURI, aPageTitle) {
aURI = aURI.spec;
switch (aURI) {
case pageurl:
is(aPageTitle, pagetitle, "Correct page title for " + aURI);
return;
case fragmenturl:
is(aPageTitle, pagetitle, "Correct page title for " + aURI);
// If titles for fragment URLs aren't set, this code
// branch won't be called and the test will timeout,
// resulting in a failure
historyService.removeObserver(historyObserver, false);
resolve();
}
},
onDeleteURI: function(aURI) {},
onClearHistory: function() {},
onPageChanged: function(aURI, aWhat, aValue) {},
onDeleteVisits: function () {},
QueryInterface: function(iid) {
if (iid.equals(Ci.nsINavHistoryObserver) ||
iid.equals(Ci.nsISupports)) {
return this;
}
throw Cr.NS_ERROR_NO_INTERFACE;
}
};
historyService.addObserver(historyObserver, false);
});
/* Queries nsINavHistoryService and returns a single history entry
* for a given URI */
@ -71,18 +69,6 @@ function test() {
return node;
}
function onPageLoad() {
gBrowser.selectedBrowser.removeEventListener(
"DOMContentLoaded", onPageLoad, true);
// Now that the page is loaded, click on fragment link
EventUtils.sendMouseEvent({type:'click'}, 'firefox-link',
gBrowser.selectedBrowser.contentWindow);
// Test finishes in historyObserver.onTitleChanged() above
}
// Make sure neither of the test pages haven't been loaded before.
var info = getNavHistoryEntry(makeURI(pageurl));
ok(!info, "The test page must not have been visited already.");
@ -90,8 +76,12 @@ function test() {
ok(!info, "The fragment test page must not have been visited already.");
// Now open the test page in a new tab
gBrowser.selectedTab = gBrowser.addTab();
gBrowser.selectedBrowser.addEventListener(
"DOMContentLoaded", onPageLoad, true);
content.location = pageurl;
}
yield BrowserTestUtils.openNewForegroundTab(gBrowser, pageurl);
// Now that the page is loaded, click on fragment link
yield BrowserTestUtils.synthesizeMouseAtCenter("#firefox-link", {},
gBrowser.selectedBrowser);
yield fragmentPromise;
gBrowser.removeCurrentTab();
});