зеркало из 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) {
|
||||||
|
try {
|
||||||
p.onProgressChange(aWebProgress, aRequest,
|
p.onProgressChange(aWebProgress, aRequest,
|
||||||
aCurSelfProgress, aMaxSelfProgress,
|
aCurSelfProgress, aMaxSelfProgress,
|
||||||
aCurTotalProgress, aMaxTotalProgress);
|
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) {
|
||||||
|
try {
|
||||||
p.onLocationChange(aWebProgress, aRequest, aLocation);
|
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) {
|
||||||
|
try {
|
||||||
p.onSecurityChange(aWebProgress, aRequest, aState);
|
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,16 +814,21 @@
|
||||||
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) {
|
||||||
|
try {
|
||||||
p.onLocationChange(webProgress, null, loc);
|
p.onLocationChange(webProgress, null, loc);
|
||||||
if (securityUI)
|
if (securityUI)
|
||||||
p.onSecurityChange(webProgress, null, securityUI.state);
|
p.onSecurityChange(webProgress, null, securityUI.state);
|
||||||
var listener = this.mTabListeners[this.mTabContainer.selectedIndex];
|
var listener = this.mTabListeners[this.mTabContainer
|
||||||
|
.selectedIndex];
|
||||||
if (listener.mIcon && 'onLinkIconAvailable' in p)
|
if (listener.mIcon && 'onLinkIconAvailable' in p)
|
||||||
p.onLinkIconAvailable(listener.mIcon);
|
p.onLinkIconAvailable(listener.mIcon);
|
||||||
if ('onFeedAvailable' in p) {
|
if ('onFeedAvailable' in p) {
|
||||||
for (var j = 0; j < listener.mFeeds.length; j++)
|
for (var j = 0; j < listener.mFeeds.length; j++)
|
||||||
p.onFeedAvailable(listener.mFeeds[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) {
|
||||||
|
try {
|
||||||
p.onFeedAvailable(event.originalTarget);
|
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) {
|
||||||
|
try {
|
||||||
p.onLinkIconAvailable(href);
|
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.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче