mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1155348, e10s, rewrite and reenable browser_bug304198, r=felipe
This commit is contained in:
parent
caa48ba6e4
commit
4cd9545406
@ -144,7 +144,6 @@ skip-if = e10s # bug 967873 means permitUnload doesn't work in e10s mode
|
||||
[browser_bookmark_titles.js]
|
||||
skip-if = buildapp == 'mulet' || toolkit == "windows" # Disabled on Windows due to frequent failures (bugs 825739, 841341)
|
||||
[browser_bug304198.js]
|
||||
skip-if = e10s
|
||||
[browser_bug321000.js]
|
||||
skip-if = true # browser_bug321000.js is disabled because newline handling is shaky (bug 592528)
|
||||
[browser_bug329212.js]
|
||||
|
@ -2,9 +2,7 @@
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
function test() {
|
||||
waitForExplicitFinish();
|
||||
|
||||
add_task(function* () {
|
||||
let charsToDelete, deletedURLTab, fullURLTab, partialURLTab, testPartialURL, testURL;
|
||||
|
||||
charsToDelete = 5;
|
||||
@ -13,112 +11,96 @@ function test() {
|
||||
partialURLTab = gBrowser.addTab();
|
||||
testURL = "http://example.org/browser/browser/base/content/test/general/dummy_page.html";
|
||||
|
||||
let loaded1 = BrowserTestUtils.browserLoaded(deletedURLTab.linkedBrowser, testURL);
|
||||
let loaded2 = BrowserTestUtils.browserLoaded(fullURLTab.linkedBrowser, testURL);
|
||||
let loaded3 = BrowserTestUtils.browserLoaded(partialURLTab.linkedBrowser, testURL);
|
||||
deletedURLTab.linkedBrowser.loadURI(testURL);
|
||||
fullURLTab.linkedBrowser.loadURI(testURL);
|
||||
partialURLTab.linkedBrowser.loadURI(testURL);
|
||||
yield Promise.all([loaded1, loaded2, loaded3]);
|
||||
|
||||
testURL = gURLBar.trimValue(testURL);
|
||||
testPartialURL = testURL.substr(0, (testURL.length - charsToDelete));
|
||||
|
||||
function cleanUp() {
|
||||
gBrowser.removeTab(fullURLTab);
|
||||
gBrowser.removeTab(partialURLTab);
|
||||
gBrowser.removeTab(deletedURLTab);
|
||||
}
|
||||
|
||||
function cycleTabs() {
|
||||
gBrowser.selectedTab = fullURLTab;
|
||||
function* cycleTabs() {
|
||||
yield BrowserTestUtils.switchTab(gBrowser, fullURLTab);
|
||||
is(gURLBar.textValue, testURL, 'gURLBar.textValue should be testURL after switching back to fullURLTab');
|
||||
|
||||
gBrowser.selectedTab = partialURLTab;
|
||||
yield BrowserTestUtils.switchTab(gBrowser, partialURLTab);
|
||||
is(gURLBar.textValue, testPartialURL, 'gURLBar.textValue should be testPartialURL after switching back to partialURLTab');
|
||||
gBrowser.selectedTab = deletedURLTab;
|
||||
yield BrowserTestUtils.switchTab(gBrowser, deletedURLTab);
|
||||
is(gURLBar.textValue, '', 'gURLBar.textValue should be "" after switching back to deletedURLTab');
|
||||
|
||||
gBrowser.selectedTab = fullURLTab;
|
||||
yield BrowserTestUtils.switchTab(gBrowser, fullURLTab);
|
||||
is(gURLBar.textValue, testURL, 'gURLBar.textValue should be testURL after switching back to fullURLTab');
|
||||
}
|
||||
|
||||
// function borrowed from browser_bug386835.js
|
||||
function load(tab, url, cb) {
|
||||
tab.linkedBrowser.addEventListener("load", function (event) {
|
||||
event.currentTarget.removeEventListener("load", arguments.callee, true);
|
||||
cb();
|
||||
}, true);
|
||||
tab.linkedBrowser.loadURI(url);
|
||||
}
|
||||
|
||||
function urlbarBackspace(cb) {
|
||||
gBrowser.selectedBrowser.focus();
|
||||
gURLBar.addEventListener("focus", function () {
|
||||
gURLBar.removeEventListener("focus", arguments.callee, false);
|
||||
function urlbarBackspace() {
|
||||
return new Promise((resolve, reject) => {
|
||||
gBrowser.selectedBrowser.focus();
|
||||
gURLBar.addEventListener("input", function () {
|
||||
gURLBar.removeEventListener("input", arguments.callee, false);
|
||||
cb();
|
||||
resolve();
|
||||
}, false);
|
||||
executeSoon(function () {
|
||||
EventUtils.synthesizeKey("VK_BACK_SPACE", {});
|
||||
});
|
||||
}, false);
|
||||
gURLBar.focus();
|
||||
gURLBar.focus();
|
||||
EventUtils.synthesizeKey("VK_BACK_SPACE", {});
|
||||
});
|
||||
}
|
||||
|
||||
function prepareDeletedURLTab(cb) {
|
||||
gBrowser.selectedTab = deletedURLTab;
|
||||
function* prepareDeletedURLTab() {
|
||||
yield BrowserTestUtils.switchTab(gBrowser, deletedURLTab);
|
||||
is(gURLBar.textValue, testURL, 'gURLBar.textValue should be testURL after initial switch to deletedURLTab');
|
||||
|
||||
// simulate the user removing the whole url from the location bar
|
||||
gPrefService.setBoolPref("browser.urlbar.clickSelectsAll", true);
|
||||
|
||||
urlbarBackspace(function () {
|
||||
is(gURLBar.textValue, "", 'gURLBar.textValue should be "" (just set)');
|
||||
if (gPrefService.prefHasUserValue("browser.urlbar.clickSelectsAll"))
|
||||
gPrefService.clearUserPref("browser.urlbar.clickSelectsAll");
|
||||
cb();
|
||||
});
|
||||
yield urlbarBackspace();
|
||||
is(gURLBar.textValue, "", 'gURLBar.textValue should be "" (just set)');
|
||||
if (gPrefService.prefHasUserValue("browser.urlbar.clickSelectsAll")) {
|
||||
gPrefService.clearUserPref("browser.urlbar.clickSelectsAll");
|
||||
}
|
||||
}
|
||||
|
||||
function prepareFullURLTab(cb) {
|
||||
gBrowser.selectedTab = fullURLTab;
|
||||
function* prepareFullURLTab() {
|
||||
yield BrowserTestUtils.switchTab(gBrowser, fullURLTab);
|
||||
is(gURLBar.textValue, testURL, 'gURLBar.textValue should be testURL after initial switch to fullURLTab');
|
||||
cb();
|
||||
}
|
||||
|
||||
function preparePartialURLTab(cb) {
|
||||
gBrowser.selectedTab = partialURLTab;
|
||||
function* preparePartialURLTab() {
|
||||
yield BrowserTestUtils.switchTab(gBrowser, partialURLTab);
|
||||
is(gURLBar.textValue, testURL, 'gURLBar.textValue should be testURL after initial switch to partialURLTab');
|
||||
|
||||
// simulate the user removing part of the url from the location bar
|
||||
gPrefService.setBoolPref("browser.urlbar.clickSelectsAll", false);
|
||||
|
||||
var deleted = 0;
|
||||
urlbarBackspace(function () {
|
||||
let deleted = 0;
|
||||
while (deleted < charsToDelete) {
|
||||
yield urlbarBackspace(arguments.callee);
|
||||
deleted++;
|
||||
if (deleted < charsToDelete) {
|
||||
urlbarBackspace(arguments.callee);
|
||||
} else {
|
||||
is(gURLBar.textValue, testPartialURL, "gURLBar.textValue should be testPartialURL (just set)");
|
||||
if (gPrefService.prefHasUserValue("browser.urlbar.clickSelectsAll"))
|
||||
gPrefService.clearUserPref("browser.urlbar.clickSelectsAll");
|
||||
cb();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
is(gURLBar.textValue, testPartialURL, "gURLBar.textValue should be testPartialURL (just set)");
|
||||
if (gPrefService.prefHasUserValue("browser.urlbar.clickSelectsAll")) {
|
||||
gPrefService.clearUserPref("browser.urlbar.clickSelectsAll");
|
||||
}
|
||||
}
|
||||
|
||||
function runTests() {
|
||||
testURL = gURLBar.trimValue(testURL);
|
||||
testPartialURL = testURL.substr(0, (testURL.length - charsToDelete));
|
||||
// prepare the three tabs required by this test
|
||||
|
||||
// prepare the three tabs required by this test
|
||||
prepareFullURLTab(function () {
|
||||
preparePartialURLTab(function () {
|
||||
prepareDeletedURLTab(function () {
|
||||
// now cycle the tabs and make sure everything looks good
|
||||
cycleTabs();
|
||||
cleanUp();
|
||||
finish();
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
// First tab
|
||||
yield* prepareFullURLTab();
|
||||
yield* preparePartialURLTab();
|
||||
yield* prepareDeletedURLTab();
|
||||
|
||||
// now cycle the tabs and make sure everything looks good
|
||||
yield* cycleTabs();
|
||||
cleanUp();
|
||||
});
|
||||
|
||||
load(deletedURLTab, testURL, function() {
|
||||
load(fullURLTab, testURL, function() {
|
||||
load(partialURLTab, testURL, runTests);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user