mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-28 04:35:33 +00:00
Bug 496309 - remove focusElement and getBrowserFromContentWindow. r=enn, sr=mconnor
This commit is contained in:
parent
adf94907af
commit
ec55ae8b0f
@ -91,35 +91,6 @@ function getBoolPref ( prefname, def )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Change focus for this browser window to |aElement|, without focusing the
|
|
||||||
// window itself.
|
|
||||||
function focusElement(aElement)
|
|
||||||
{
|
|
||||||
var msg;
|
|
||||||
|
|
||||||
// if a content window, focus the <browser> instead as window.focus()
|
|
||||||
// raises the window
|
|
||||||
if (aElement instanceof Window) {
|
|
||||||
var browser = getBrowserFromContentWindow(aElement);
|
|
||||||
if (!browser)
|
|
||||||
throw "aElement is not a content window";
|
|
||||||
browser.focus();
|
|
||||||
msg = "focusElement(content) is deprecated. Use gBrowser.selectedBrowser.focus() instead.";
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
aElement.focus();
|
|
||||||
msg = "focusElement(element) is deprecated. Use element.focus() instead.";
|
|
||||||
}
|
|
||||||
|
|
||||||
var scriptError = Components.classes["@mozilla.org/scripterror;1"]
|
|
||||||
.createInstance(Components.interfaces.nsIScriptError);
|
|
||||||
scriptError.init(msg, document.location.href, null, null,
|
|
||||||
null, scriptError.warningFlag, "chrome javascript");
|
|
||||||
Components.classes["@mozilla.org/consoleservice;1"]
|
|
||||||
.getService(Components.interfaces.nsIConsoleService)
|
|
||||||
.logMessage(scriptError);
|
|
||||||
}
|
|
||||||
|
|
||||||
// openUILink handles clicks on UI elements that cause URLs to load.
|
// openUILink handles clicks on UI elements that cause URLs to load.
|
||||||
function openUILink( url, e, ignoreButton, ignoreAlt, allowKeywordFixup, postData, referrerUrl )
|
function openUILink( url, e, ignoreButton, ignoreAlt, allowKeywordFixup, postData, referrerUrl )
|
||||||
{
|
{
|
||||||
@ -560,16 +531,6 @@ function makeURLAbsolute(aBase, aUrl)
|
|||||||
return makeURI(aUrl, null, makeURI(aBase)).spec;
|
return makeURI(aUrl, null, makeURI(aBase)).spec;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getBrowserFromContentWindow(aContentWindow)
|
|
||||||
{
|
|
||||||
var browsers = gBrowser.browsers;
|
|
||||||
for (var i = 0; i < browsers.length; i++) {
|
|
||||||
if (browsers[i].contentWindow == aContentWindow)
|
|
||||||
return browsers[i];
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* openNewTabWith: opens a new tab with the given URL.
|
* openNewTabWith: opens a new tab with the given URL.
|
||||||
|
Loading…
Reference in New Issue
Block a user