зеркало из https://github.com/mozilla/pjs.git
Bug 225854 fix JS error handling anonymous link elements (e.g. from XMLPrettyPrint.xml) r=hj sr=alecf
This commit is contained in:
Родитель
c4895dd106
Коммит
5be2553edc
|
@ -602,15 +602,14 @@
|
||||||
<parameter name="event"/>
|
<parameter name="event"/>
|
||||||
<body>
|
<body>
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
var tabBrowser = this.parentNode.parentNode;
|
if (!this.mPrefs.getBoolPref("browser.chrome.site_icons"))
|
||||||
if (!tabBrowser.mPrefs.getBoolPref("browser.chrome.site_icons"))
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!event.target.rel.match((/(?:^|\s)icon(?:\s|$)/i)))
|
if (!event.originalTarget.rel.match((/(?:^|\s)icon(?:\s|$)/i)))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// We have an icon.
|
// We have an icon.
|
||||||
var href = event.target.href;
|
var href = event.originalTarget.href;
|
||||||
if (!href)
|
if (!href)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -627,29 +626,28 @@
|
||||||
var notifyListeners = true;
|
var notifyListeners = true;
|
||||||
var i;
|
var i;
|
||||||
|
|
||||||
if (tabBrowser.mTabbedMode) {
|
if (this.mTabbedMode) {
|
||||||
// We need to update a tab.
|
// We need to update a tab.
|
||||||
for (i = 0; i < this.childNodes.length; i++) {
|
for (i = 0; i < this.childNodes.length; i++) {
|
||||||
if (this.childNodes[i].contentDocument == event.target.ownerDocument) {
|
if (this.browsers[i].contentDocument == event.originalTarget.ownerDocument) {
|
||||||
if (!contentPolicy.shouldLoad(Components.interfaces.nsIContentPolicy.IMAGE,
|
if (!contentPolicy.shouldLoad(Components.interfaces.nsIContentPolicy.IMAGE,
|
||||||
uri, event.target, this.childNodes[i].contentWindow))
|
uri, event.originalTarget, this.browsers[i].contentWindow))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var listener = tabBrowser.mTabListeners[i];
|
this.mTabListeners[i].mIcon = href;
|
||||||
listener.mIcon = href;
|
notifyListeners = (this.browsers[i] == this.mCurrentBrowser);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
notifyListeners = (this.childNodes[i] == tabBrowser.mCurrentBrowser);
|
|
||||||
}
|
}
|
||||||
else if (!contentPolicy.shouldLoad(Components.interfaces.nsIContentPolicy.IMAGE,
|
else if (this.contentDocument != event.originalTarget.ownerDocument ||
|
||||||
uri, event.target, tabBrowser.mCurrentBrowser.contentWindow))
|
!contentPolicy.shouldLoad(Components.interfaces.nsIContentPolicy.IMAGE,
|
||||||
|
uri, event.originalTarget, this.mCurrentBrowser.contentWindow))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (notifyListeners && tabBrowser.mProgressListeners) {
|
if (notifyListeners && this.mProgressListeners) {
|
||||||
for (i = 0; i < tabBrowser.mProgressListeners.length; i++) {
|
for (i = 0; i < this.mProgressListeners.length; i++) {
|
||||||
var p = tabBrowser.mProgressListeners[i];
|
var p = this.mProgressListeners[i];
|
||||||
if (p)
|
if (p)
|
||||||
p.onLinkIconAvailable(href);
|
p.onLinkIconAvailable(href);
|
||||||
}
|
}
|
||||||
|
@ -998,9 +996,6 @@
|
||||||
const forceHide = this.mPrefs.getBoolPref("browser.tabs.forceHide");
|
const forceHide = this.mPrefs.getBoolPref("browser.tabs.forceHide");
|
||||||
if (!autoHide && !forceHide)
|
if (!autoHide && !forceHide)
|
||||||
this.setStripVisibilityTo(true);
|
this.setStripVisibilityTo(true);
|
||||||
|
|
||||||
// Hook up a listener for <link>s.
|
|
||||||
this.mPanelContainer.addEventListener("DOMLinkAdded", this.onLinkAdded, false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.mProgressListeners.push(aListener);
|
this.mProgressListeners.push(aListener);
|
||||||
|
@ -1431,7 +1426,6 @@
|
||||||
this.mTabListeners[i] = null;
|
this.mTabListeners[i] = null;
|
||||||
this.mPanelContainer.childNodes[i].removeEventListener("DOMTitleChanged", this.onTitleChanged, false);
|
this.mPanelContainer.childNodes[i].removeEventListener("DOMTitleChanged", this.onTitleChanged, false);
|
||||||
}
|
}
|
||||||
this.mPanelContainer.removeEventListener("DOMLinkAdded", this.onLinkAdded, false);
|
|
||||||
]]>
|
]]>
|
||||||
</destructor>
|
</destructor>
|
||||||
</implementation>
|
</implementation>
|
||||||
|
@ -1439,6 +1433,8 @@
|
||||||
<handlers>
|
<handlers>
|
||||||
<handler event="select" action="if (event.originalTarget == this.mPanelContainer) this.updateCurrentBrowser();"/>
|
<handler event="select" action="if (event.originalTarget == this.mPanelContainer) this.updateCurrentBrowser();"/>
|
||||||
|
|
||||||
|
<handler event="DOMLinkAdded" action="this.onLinkAdded(event);"/>
|
||||||
|
|
||||||
<handler event="keypress" modifiers="control" keycode="VK_F4">
|
<handler event="keypress" modifiers="control" keycode="VK_F4">
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
if (this.mTabBox.handleCtrlPageUpDown)
|
if (this.mTabBox.handleCtrlPageUpDown)
|
||||||
|
|
Загрузка…
Ссылка в новой задаче