зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1243289 - UITour: Remove never used UrlbarCapture code. r=Gijs
--HG-- extra : commitid : Dr5J0prCZPN
This commit is contained in:
Родитель
6d0cc0097e
Коммит
4406d7d2df
|
@ -220,17 +220,6 @@ if (typeof Mozilla == 'undefined') {
|
|||
});
|
||||
};
|
||||
|
||||
Mozilla.UITour.startUrlbarCapture = function(text, url) {
|
||||
_sendEvent('startUrlbarCapture', {
|
||||
text: text,
|
||||
url: url
|
||||
});
|
||||
};
|
||||
|
||||
Mozilla.UITour.endUrlbarCapture = function() {
|
||||
_sendEvent('endUrlbarCapture');
|
||||
};
|
||||
|
||||
Mozilla.UITour.getConfiguration = function(configName, callback) {
|
||||
_sendEvent('getConfiguration', {
|
||||
callbackID: _waitForCallback(callback),
|
||||
|
|
|
@ -43,7 +43,6 @@ const PREF_SEENPAGEIDS = "browser.uitour.seenPageIDs";
|
|||
const PREF_READERVIEW_TRIGGER = "browser.uitour.readerViewTrigger";
|
||||
|
||||
const BACKGROUND_PAGE_ACTIONS_ALLOWED = new Set([
|
||||
"endUrlbarCapture",
|
||||
"forceShowReaderIcon",
|
||||
"getConfiguration",
|
||||
"getTreatmentTag",
|
||||
|
@ -90,7 +89,6 @@ this.UITour = {
|
|||
pageIDSourceBrowsers: new WeakMap(),
|
||||
/* Map from browser chrome windows to a Set of <browser>s in which a tour is open (both visible and hidden) */
|
||||
tourBrowsersByWindow: new WeakMap(),
|
||||
urlbarCapture: new WeakMap(),
|
||||
appMenuOpenForAnnotation: new Set(),
|
||||
availableTargetsCache: new WeakMap(),
|
||||
clearAvailableTargetsCache() {
|
||||
|
@ -577,41 +575,6 @@ this.UITour = {
|
|||
break;
|
||||
}
|
||||
|
||||
case "startUrlbarCapture": {
|
||||
if (typeof data.text != "string" || !data.text ||
|
||||
typeof data.url != "string" || !data.url) {
|
||||
log.warn("startUrlbarCapture: Text or URL not specified");
|
||||
return false;
|
||||
}
|
||||
|
||||
let uri = null;
|
||||
try {
|
||||
uri = Services.io.newURI(data.url, null, null);
|
||||
} catch (e) {
|
||||
log.warn("startUrlbarCapture: Malformed URL specified");
|
||||
return false;
|
||||
}
|
||||
|
||||
let secman = Services.scriptSecurityManager;
|
||||
let contentDocument = browser.contentWindow.document;
|
||||
let principal = contentDocument.nodePrincipal;
|
||||
let flags = secman.DISALLOW_INHERIT_PRINCIPAL;
|
||||
try {
|
||||
secman.checkLoadURIWithPrincipal(principal, uri, flags);
|
||||
} catch (e) {
|
||||
log.warn("startUrlbarCapture: Orginating page doesn't have permission to open specified URL");
|
||||
return false;
|
||||
}
|
||||
|
||||
this.startUrlbarCapture(window, data.text, data.url);
|
||||
break;
|
||||
}
|
||||
|
||||
case "endUrlbarCapture": {
|
||||
this.endUrlbarCapture(window);
|
||||
break;
|
||||
}
|
||||
|
||||
case "getConfiguration": {
|
||||
if (typeof data.configuration != "string") {
|
||||
log.warn("getConfiguration: No configuration option specified");
|
||||
|
@ -806,14 +769,6 @@ this.UITour = {
|
|||
this.teardownTourForWindow(window);
|
||||
break;
|
||||
}
|
||||
|
||||
case "input": {
|
||||
if (aEvent.target.id == "urlbar") {
|
||||
let window = aEvent.target.ownerDocument.defaultView;
|
||||
this.handleUrlbarInput(window);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -903,7 +858,6 @@ this.UITour = {
|
|||
controlCenterPanel.removeEventListener("popuphidden", this.onPanelHidden);
|
||||
controlCenterPanel.removeEventListener("popuphiding", this.hideControlCenterAnnotations);
|
||||
|
||||
this.endUrlbarCapture(aWindow);
|
||||
this.resetTheme();
|
||||
|
||||
// If there are no more tour tabs left in the window, teardown the tour for the whole window.
|
||||
|
@ -1763,41 +1717,6 @@ this.UITour = {
|
|||
aPanel.hidden = false;
|
||||
},
|
||||
|
||||
startUrlbarCapture: function(aWindow, aExpectedText, aUrl) {
|
||||
let urlbar = aWindow.document.getElementById("urlbar");
|
||||
this.urlbarCapture.set(aWindow, {
|
||||
expected: aExpectedText.toLocaleLowerCase(),
|
||||
url: aUrl
|
||||
});
|
||||
urlbar.addEventListener("input", this);
|
||||
},
|
||||
|
||||
endUrlbarCapture: function(aWindow) {
|
||||
let urlbar = aWindow.document.getElementById("urlbar");
|
||||
urlbar.removeEventListener("input", this);
|
||||
this.urlbarCapture.delete(aWindow);
|
||||
},
|
||||
|
||||
handleUrlbarInput: function(aWindow) {
|
||||
if (!this.urlbarCapture.has(aWindow))
|
||||
return;
|
||||
|
||||
let urlbar = aWindow.document.getElementById("urlbar");
|
||||
|
||||
let {expected, url} = this.urlbarCapture.get(aWindow);
|
||||
|
||||
if (urlbar.value.toLocaleLowerCase().localeCompare(expected) != 0)
|
||||
return;
|
||||
|
||||
urlbar.handleRevert();
|
||||
|
||||
let tab = aWindow.gBrowser.addTab(url, {
|
||||
owner: aWindow.gBrowser.selectedTab,
|
||||
relatedToCurrent: true
|
||||
});
|
||||
aWindow.gBrowser.selectedTab = tab;
|
||||
},
|
||||
|
||||
getConfiguration: function(aMessageManager, aWindow, aConfiguration, aCallbackID) {
|
||||
switch (aConfiguration) {
|
||||
case "appinfo":
|
||||
|
|
Загрузка…
Ссылка в новой задаче