зеркало из https://github.com/mozilla/pjs.git
Bug 421245: A javascript error in an extension's progress listener shouldn't interfere with normal operation of tabbed browsing. r=Callek, sr=Neil
This commit is contained in:
Родитель
efc0fbcbf2
Коммит
aac8bc82a1
|
@ -344,10 +344,15 @@
|
||||||
if (!this.mBlank && this.mTabBrowser.mCurrentTab == this.mTab) {
|
if (!this.mBlank && this.mTabBrowser.mCurrentTab == this.mTab) {
|
||||||
for (var i = 0; i < this.mTabBrowser.mProgressListeners.length; i++) {
|
for (var i = 0; i < this.mTabBrowser.mProgressListeners.length; i++) {
|
||||||
var p = this.mTabBrowser.mProgressListeners[i];
|
var p = this.mTabBrowser.mProgressListeners[i];
|
||||||
if (p)
|
if (p) {
|
||||||
p.onProgressChange(aWebProgress, aRequest,
|
try {
|
||||||
aCurSelfProgress, aMaxSelfProgress,
|
p.onProgressChange(aWebProgress, aRequest,
|
||||||
aCurTotalProgress, aMaxTotalProgress);
|
aCurSelfProgress, aMaxSelfProgress,
|
||||||
|
aCurTotalProgress, aMaxTotalProgress);
|
||||||
|
} catch (e) {
|
||||||
|
Components.utils.reportError(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -438,8 +443,14 @@
|
||||||
if (!oldBlank && this.mTabBrowser.mCurrentTab == this.mTab) {
|
if (!oldBlank && this.mTabBrowser.mCurrentTab == this.mTab) {
|
||||||
for (var i = 0; i < this.mTabBrowser.mProgressListeners.length; i++) {
|
for (var i = 0; i < this.mTabBrowser.mProgressListeners.length; i++) {
|
||||||
var p = this.mTabBrowser.mProgressListeners[i];
|
var p = this.mTabBrowser.mProgressListeners[i];
|
||||||
if (p)
|
if (p) {
|
||||||
p.onStateChange(aWebProgress, aRequest, aStateFlags, aStatus);
|
try {
|
||||||
|
p.onStateChange(aWebProgress, aRequest, aStateFlags,
|
||||||
|
aStatus);
|
||||||
|
} catch (e) {
|
||||||
|
Components.utils.reportError(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -471,8 +482,13 @@
|
||||||
if (!this.mBlank && this.mTabBrowser.mCurrentTab == this.mTab) {
|
if (!this.mBlank && this.mTabBrowser.mCurrentTab == this.mTab) {
|
||||||
for (var i = 0; i < this.mTabBrowser.mProgressListeners.length; i++) {
|
for (var i = 0; i < this.mTabBrowser.mProgressListeners.length; i++) {
|
||||||
var p = this.mTabBrowser.mProgressListeners[i];
|
var p = this.mTabBrowser.mProgressListeners[i];
|
||||||
if (p)
|
if (p) {
|
||||||
p.onLocationChange(aWebProgress, aRequest, aLocation);
|
try {
|
||||||
|
p.onLocationChange(aWebProgress, aRequest, aLocation);
|
||||||
|
} catch (e) {
|
||||||
|
Components.utils.reportError(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -485,8 +501,14 @@
|
||||||
if (this.mTabBrowser.mCurrentTab == this.mTab) {
|
if (this.mTabBrowser.mCurrentTab == this.mTab) {
|
||||||
for (var i = 0; i < this.mTabBrowser.mProgressListeners.length; i++) {
|
for (var i = 0; i < this.mTabBrowser.mProgressListeners.length; i++) {
|
||||||
var p = this.mTabBrowser.mProgressListeners[i];
|
var p = this.mTabBrowser.mProgressListeners[i];
|
||||||
if (p)
|
if (p) {
|
||||||
p.onStatusChange(aWebProgress, aRequest, aStatus, aMessage);
|
try {
|
||||||
|
p.onStatusChange(aWebProgress, aRequest, aStatus,
|
||||||
|
aMessage);
|
||||||
|
} catch (e) {
|
||||||
|
Components.utils.reportError(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -496,8 +518,13 @@
|
||||||
if (this.mTabBrowser.mCurrentTab == this.mTab) {
|
if (this.mTabBrowser.mCurrentTab == this.mTab) {
|
||||||
for (var i = 0; i < this.mTabBrowser.mProgressListeners.length; i++) {
|
for (var i = 0; i < this.mTabBrowser.mProgressListeners.length; i++) {
|
||||||
var p = this.mTabBrowser.mProgressListeners[i];
|
var p = this.mTabBrowser.mProgressListeners[i];
|
||||||
if (p)
|
if (p) {
|
||||||
p.onSecurityChange(aWebProgress, aRequest, aState);
|
try {
|
||||||
|
p.onSecurityChange(aWebProgress, aRequest, aState);
|
||||||
|
} catch (e) {
|
||||||
|
Components.utils.reportError(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -589,7 +616,8 @@
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
try {
|
try {
|
||||||
aURI = this.mURIFixup.createExposableURI(aURI);
|
aURI = this.mURIFixup.createExposableURI(aURI);
|
||||||
} catch(ex) { }
|
} catch (e) {
|
||||||
|
}
|
||||||
return aURI.resolve("/favicon.ico");
|
return aURI.resolve("/favicon.ico");
|
||||||
]]>
|
]]>
|
||||||
</body>
|
</body>
|
||||||
|
@ -601,7 +629,8 @@
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
try {
|
try {
|
||||||
aURI = this.mURIFixup.createExposableURI(aURI);
|
aURI = this.mURIFixup.createExposableURI(aURI);
|
||||||
} catch(ex) { }
|
} catch (e) {
|
||||||
|
}
|
||||||
return (aURI && this.mPrefs.getBoolPref("browser.chrome.site_icons") &&
|
return (aURI && this.mPrefs.getBoolPref("browser.chrome.site_icons") &&
|
||||||
this.mPrefs.getBoolPref("browser.chrome.favicons") &&
|
this.mPrefs.getBoolPref("browser.chrome.favicons") &&
|
||||||
("schemeIs" in aURI) && (aURI.schemeIs("http") || aURI.schemeIs("https")));
|
("schemeIs" in aURI) && (aURI.schemeIs("http") || aURI.schemeIs("https")));
|
||||||
|
@ -696,7 +725,8 @@
|
||||||
else if (uri.host)
|
else if (uri.host)
|
||||||
newTitle = uri.prePath + sep + newTitle;
|
newTitle = uri.prePath + sep + newTitle;
|
||||||
}
|
}
|
||||||
} catch (e) {}
|
} catch (e) {
|
||||||
|
}
|
||||||
|
|
||||||
this.ownerDocument.title = newTitle;
|
this.ownerDocument.title = newTitle;
|
||||||
]]>
|
]]>
|
||||||
|
@ -784,15 +814,20 @@
|
||||||
for (i = 0; i < this.mProgressListeners.length; i++) {
|
for (i = 0; i < this.mProgressListeners.length; i++) {
|
||||||
p = this.mProgressListeners[i];
|
p = this.mProgressListeners[i];
|
||||||
if (p) {
|
if (p) {
|
||||||
p.onLocationChange(webProgress, null, loc);
|
try {
|
||||||
if (securityUI)
|
p.onLocationChange(webProgress, null, loc);
|
||||||
p.onSecurityChange(webProgress, null, securityUI.state);
|
if (securityUI)
|
||||||
var listener = this.mTabListeners[this.mTabContainer.selectedIndex];
|
p.onSecurityChange(webProgress, null, securityUI.state);
|
||||||
if (listener.mIcon && 'onLinkIconAvailable' in p)
|
var listener = this.mTabListeners[this.mTabContainer
|
||||||
p.onLinkIconAvailable(listener.mIcon);
|
.selectedIndex];
|
||||||
if ('onFeedAvailable' in p) {
|
if (listener.mIcon && 'onLinkIconAvailable' in p)
|
||||||
for (var j = 0; j < listener.mFeeds.length; j++)
|
p.onLinkIconAvailable(listener.mIcon);
|
||||||
p.onFeedAvailable(listener.mFeeds[j]);
|
if ('onFeedAvailable' in p) {
|
||||||
|
for (var j = 0; j < listener.mFeeds.length; j++)
|
||||||
|
p.onFeedAvailable(listener.mFeeds[j]);
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
Components.utils.reportError(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -808,8 +843,16 @@
|
||||||
webProgress = this.mCurrentBrowser.webProgress;
|
webProgress = this.mCurrentBrowser.webProgress;
|
||||||
for (i = 0; i < this.mProgressListeners.length; i++) {
|
for (i = 0; i < this.mProgressListeners.length; i++) {
|
||||||
p = this.mProgressListeners[i];
|
p = this.mProgressListeners[i];
|
||||||
if (p)
|
if (p) {
|
||||||
p.onStateChange(webProgress, null, nsIWebProgressListener.STATE_START | nsIWebProgressListener.STATE_IS_NETWORK, 0);
|
try {
|
||||||
|
p.onStateChange(webProgress, null,
|
||||||
|
nsIWebProgressListener.STATE_START |
|
||||||
|
nsIWebProgressListener.STATE_IS_NETWORK,
|
||||||
|
0);
|
||||||
|
} catch (e) {
|
||||||
|
Components.utils.reportError(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -820,8 +863,16 @@
|
||||||
webProgress = this.mCurrentBrowser.webProgress;
|
webProgress = this.mCurrentBrowser.webProgress;
|
||||||
for (i = 0; i < this.mProgressListeners.length; i++) {
|
for (i = 0; i < this.mProgressListeners.length; i++) {
|
||||||
p = this.mProgressListeners[i];
|
p = this.mProgressListeners[i];
|
||||||
if (p)
|
if (p) {
|
||||||
p.onStateChange(webProgress, null, nsIWebProgressListener.STATE_STOP | nsIWebProgressListener.STATE_IS_NETWORK, 0);
|
try {
|
||||||
|
p.onStateChange(webProgress, null,
|
||||||
|
nsIWebProgressListener.STATE_STOP |
|
||||||
|
nsIWebProgressListener.STATE_IS_NETWORK,
|
||||||
|
0);
|
||||||
|
} catch (e) {
|
||||||
|
Components.utils.reportError(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -937,16 +988,23 @@
|
||||||
try {
|
try {
|
||||||
secMan.checkLoadURIWithPrincipal(event.target.nodePrincipal, uri,
|
secMan.checkLoadURIWithPrincipal(event.target.nodePrincipal, uri,
|
||||||
nsIScriptSecurityManager.DISALLOW_SCRIPT);
|
nsIScriptSecurityManager.DISALLOW_SCRIPT);
|
||||||
} catch(e) {
|
} catch (e) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isFeed) {
|
if (isFeed) {
|
||||||
this.mTabListeners[i].addFeed(event.originalTarget);
|
this.mTabListeners[i].addFeed(event.originalTarget);
|
||||||
if (this.browsers[i] == this.mCurrentBrowser)
|
if (this.browsers[i] == this.mCurrentBrowser) {
|
||||||
for each (var p in this.mProgressListeners)
|
for each (var p in this.mProgressListeners) {
|
||||||
if (p && 'onFeedAvailable' in p)
|
if (p && 'onFeedAvailable' in p) {
|
||||||
p.onFeedAvailable(event.originalTarget);
|
try {
|
||||||
|
p.onFeedAvailable(event.originalTarget);
|
||||||
|
} catch (e) {
|
||||||
|
Components.utils.reportError(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isIcon)
|
if (!isIcon)
|
||||||
|
@ -958,7 +1016,7 @@
|
||||||
var contentPolicy =
|
var contentPolicy =
|
||||||
Components.classes['@mozilla.org/layout/content-policy;1']
|
Components.classes['@mozilla.org/layout/content-policy;1']
|
||||||
.getService(nsIContentPolicy);
|
.getService(nsIContentPolicy);
|
||||||
} catch(e) {
|
} catch (e) {
|
||||||
return; // Refuse to load if we can't do a security check.
|
return; // Refuse to load if we can't do a security check.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -969,10 +1027,17 @@
|
||||||
event.target.type,
|
event.target.type,
|
||||||
null) == nsIContentPolicy.ACCEPT) {
|
null) == nsIContentPolicy.ACCEPT) {
|
||||||
this.mTabListeners[i].setIcon(href);
|
this.mTabListeners[i].setIcon(href);
|
||||||
if (this.browsers[i] == this.mCurrentBrowser)
|
if (this.browsers[i] == this.mCurrentBrowser) {
|
||||||
for each (var p in this.mProgressListeners)
|
for each (var p in this.mProgressListeners) {
|
||||||
if (p && 'onLinkIconAvailable' in p)
|
if (p && 'onLinkIconAvailable' in p) {
|
||||||
p.onLinkIconAvailable(href);
|
try {
|
||||||
|
p.onLinkIconAvailable(href);
|
||||||
|
} catch (e) {
|
||||||
|
Components.utils.reportError(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1010,8 +1075,7 @@
|
||||||
if (browser.currentURI.spec) {
|
if (browser.currentURI.spec) {
|
||||||
try {
|
try {
|
||||||
title = this.mURIFixup.createExposableURI(browser.currentURI).spec;
|
title = this.mURIFixup.createExposableURI(browser.currentURI).spec;
|
||||||
}
|
} catch (e) {
|
||||||
catch(ex) {
|
|
||||||
title = browser.currentURI.spec;
|
title = browser.currentURI.spec;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1025,8 +1089,7 @@
|
||||||
const textToSubURI = Components.classes["@mozilla.org/intl/texttosuburi;1"]
|
const textToSubURI = Components.classes["@mozilla.org/intl/texttosuburi;1"]
|
||||||
.getService(Components.interfaces.nsITextToSubURI);
|
.getService(Components.interfaces.nsITextToSubURI);
|
||||||
title = textToSubURI.unEscapeNonAsciiURI(characterSet, title);
|
title = textToSubURI.unEscapeNonAsciiURI(characterSet, title);
|
||||||
}
|
} catch (e) {
|
||||||
catch(ex) {
|
|
||||||
// Do nothing.
|
// Do nothing.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче