mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-16 23:05:42 +00:00
Bug 1214174 - Prevent out of memory exception on accessing window.sidebar/window.external in a windowless browser. r=billm
--HG-- extra : histedit_source : 86ca0e336d4a31e23cb9c35302f12673dafbd09a
This commit is contained in:
parent
bbaf1760b9
commit
1a13d63ee8
@ -16,10 +16,14 @@ function nsSidebar() {
|
||||
nsSidebar.prototype = {
|
||||
init: function(window) {
|
||||
this.window = window;
|
||||
this.mm = window.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIDocShell)
|
||||
.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIContentFrameMessageManager);
|
||||
try {
|
||||
this.mm = window.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIDocShell)
|
||||
.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIContentFrameMessageManager);
|
||||
} catch(e) {
|
||||
Cu.reportError(e);
|
||||
}
|
||||
},
|
||||
|
||||
// Deprecated, only left here to avoid breaking old browser-detection scripts.
|
||||
@ -36,6 +40,11 @@ nsSidebar.prototype = {
|
||||
// The capitalization, although nonstandard here, is to match other browsers'
|
||||
// APIs and is therefore important.
|
||||
AddSearchProvider: function(engineURL) {
|
||||
if (!this.mm) {
|
||||
Cu.reportError(`Installing a search provider from this context is not currently supported: ${Error().stack}.`);
|
||||
return;
|
||||
}
|
||||
|
||||
this.mm.sendAsyncMessage("Search:AddEngine", {
|
||||
pageURL: this.window.document.documentURIObject.spec,
|
||||
engineURL
|
||||
|
Loading…
Reference in New Issue
Block a user