mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 802026, r=dao
--HG-- extra : transplant_source : _%DEr6%3A%8A%40%AF%FE%5E/%C6N%82%00%0B%0FtU%DD
This commit is contained in:
parent
f873ee8c33
commit
e01d3ab507
@ -2321,6 +2321,10 @@ function URLBarSetURI(aURI) {
|
||||
|
||||
if (value == null) {
|
||||
let uri = aURI || gBrowser.currentURI;
|
||||
// Strip off "wyciwyg://" and passwords for the location bar
|
||||
try {
|
||||
uri = Services.uriFixup.createExposableURI(uri);
|
||||
} catch (e) {}
|
||||
|
||||
// Replace initial page URIs with an empty string
|
||||
// only if there's no opener (bug 370555).
|
||||
@ -3801,11 +3805,6 @@ var XULBrowserWindow = {
|
||||
delete this.isImage;
|
||||
return this.isImage = document.getElementById("isImage");
|
||||
},
|
||||
get _uriFixup () {
|
||||
delete this._uriFixup;
|
||||
return this._uriFixup = Cc["@mozilla.org/docshell/urifixup;1"]
|
||||
.getService(Ci.nsIURIFixup);
|
||||
},
|
||||
|
||||
init: function () {
|
||||
this.throbberElement = document.getElementById("navigator-throbber");
|
||||
@ -4099,12 +4098,7 @@ var XULBrowserWindow = {
|
||||
}
|
||||
|
||||
if (gURLBar) {
|
||||
// Strip off "wyciwyg://" and passwords for the location bar
|
||||
let uri = aLocationURI;
|
||||
try {
|
||||
uri = this._uriFixup.createExposableURI(uri);
|
||||
} catch (e) {}
|
||||
URLBarSetURI(uri);
|
||||
URLBarSetURI(aLocationURI);
|
||||
|
||||
// Update starring UI
|
||||
PlacesStarButton.updateState();
|
||||
|
@ -289,6 +289,7 @@ _BROWSER_FILES = \
|
||||
browser_utilityOverlay.js \
|
||||
browser_bug676619.js \
|
||||
download_page.html \
|
||||
browser_URLBarSetURI.js \
|
||||
$(NULL)
|
||||
|
||||
ifneq (cocoa,$(MOZ_WIDGET_TOOLKIT))
|
||||
|
82
browser/base/content/test/browser_URLBarSetURI.js
Normal file
82
browser/base/content/test/browser_URLBarSetURI.js
Normal file
@ -0,0 +1,82 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* 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();
|
||||
|
||||
// avoid prompting about phishing
|
||||
Services.prefs.setIntPref(phishyUserPassPref, 32);
|
||||
registerCleanupFunction(function () {
|
||||
Services.prefs.clearUserPref(phishyUserPassPref);
|
||||
});
|
||||
|
||||
nextTest();
|
||||
}
|
||||
|
||||
const phishyUserPassPref = "network.http.phishy-userpass-length";
|
||||
|
||||
function nextTest() {
|
||||
let test = tests.shift();
|
||||
if (test) {
|
||||
test(function () {
|
||||
executeSoon(nextTest);
|
||||
});
|
||||
} else {
|
||||
executeSoon(finish);
|
||||
}
|
||||
}
|
||||
|
||||
let tests = [
|
||||
function revert(next) {
|
||||
loadTabInWindow(window, function (tab) {
|
||||
gURLBar.handleRevert();
|
||||
is(gURLBar.value, "example.com", "URL bar had user/pass stripped after reverting");
|
||||
gBrowser.removeTab(tab);
|
||||
next();
|
||||
});
|
||||
},
|
||||
function customize(next) {
|
||||
whenNewWindowLoaded(null, function (win) {
|
||||
// Need to wait for delayedStartup for the customization part of the test,
|
||||
// since that's where BrowserToolboxCustomizeDone is set.
|
||||
whenDelayedStartupFinished(win, function () {
|
||||
loadTabInWindow(win, function () {
|
||||
openToolbarCustomizationUI(function () {
|
||||
closeToolbarCustomizationUI(function () {
|
||||
is(win.gURLBar.value, "example.com", "URL bar had user/pass stripped after customize");
|
||||
win.close();
|
||||
next();
|
||||
}, win);
|
||||
}, win);
|
||||
});
|
||||
});
|
||||
});
|
||||
},
|
||||
function pageloaderror(next) {
|
||||
loadTabInWindow(window, function (tab) {
|
||||
// Load a new URL and then immediately stop it, to simulate a page load
|
||||
// error.
|
||||
tab.linkedBrowser.loadURI("http://test1.example.com");
|
||||
tab.linkedBrowser.stop();
|
||||
is(gURLBar.value, "example.com", "URL bar had user/pass stripped after load error");
|
||||
gBrowser.removeTab(tab);
|
||||
next();
|
||||
});
|
||||
}
|
||||
];
|
||||
|
||||
function loadTabInWindow(win, callback) {
|
||||
info("Loading tab");
|
||||
let url = "http://user:pass@example.com/";
|
||||
let tab = win.gBrowser.selectedTab = win.gBrowser.addTab(url);
|
||||
tab.linkedBrowser.addEventListener("load", function listener() {
|
||||
info("Tab loaded");
|
||||
if (tab.linkedBrowser.currentURI.spec != url)
|
||||
return;
|
||||
tab.linkedBrowser.removeEventListener("load", listener, true);
|
||||
|
||||
is(win.gURLBar.value, "example.com", "URL bar had user/pass stripped initially");
|
||||
callback(tab);
|
||||
}, true);
|
||||
}
|
@ -63,6 +63,7 @@ let initTable = [
|
||||
["clipboard", "@mozilla.org/widget/clipboard;1", "nsIClipboard"],
|
||||
["DOMRequest", "@mozilla.org/dom/dom-request-service;1", "nsIDOMRequestService"],
|
||||
["focus", "@mozilla.org/focus-manager;1", "nsIFocusManager"],
|
||||
["uriFixup", "@mozilla.org/docshell/urifixup;1", "nsIURIFixup"],
|
||||
];
|
||||
|
||||
initTable.forEach(function ([name, contract, intf])
|
||||
|
@ -53,4 +53,5 @@ function checkServices() {
|
||||
checkService("DOMRequest", Ci.nsIDOMRequestService);
|
||||
checkService("downloads", Ci.nsIDownloadManager);
|
||||
checkService("focus", Ci.nsIFocusManager);
|
||||
checkService("uriFixup", Ci.nsIURIFixup);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user