mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-08 00:38:39 +09:00
parent
1476418612
commit
25b7b3d1d3
3 changed files with 82 additions and 48 deletions
|
|
@ -65,6 +65,9 @@ XPCOMUtils.defineLazyGetter(window, "gFindBar", function() {
|
|||
return findbar;
|
||||
});
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "BrowserUtils",
|
||||
"resource://gre/modules/BrowserUtils.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "gPrefService", function() {
|
||||
return Services.prefs;
|
||||
});
|
||||
|
|
@ -3426,26 +3429,6 @@ function updateCharacterEncodingMenuState()
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if |aMimeType| is text-based, false otherwise.
|
||||
*
|
||||
* @param aMimeType
|
||||
* The MIME type to check.
|
||||
*
|
||||
* If adding types to this function, please also check the similar
|
||||
* function in findbar.xml
|
||||
*/
|
||||
function mimeTypeIsTextBased(aMimeType)
|
||||
{
|
||||
return aMimeType.startsWith("text/") ||
|
||||
aMimeType.endsWith("+xml") ||
|
||||
aMimeType == "application/x-javascript" ||
|
||||
aMimeType == "application/javascript" ||
|
||||
aMimeType == "application/json" ||
|
||||
aMimeType == "application/xml" ||
|
||||
aMimeType == "mozilla.application/cached-xul";
|
||||
}
|
||||
|
||||
var XULBrowserWindow = {
|
||||
// Stored Status, Link and Loading values
|
||||
status: "",
|
||||
|
|
@ -3669,7 +3652,7 @@ var XULBrowserWindow = {
|
|||
this.setDefaultStatus(msg);
|
||||
|
||||
// Disable menu entries for images, enable otherwise
|
||||
if (!gMultiProcessBrowser && content.document && mimeTypeIsTextBased(content.document.contentType))
|
||||
if (!gMultiProcessBrowser && content.document && BrowserUtils.mimeTypeIsTextBased(content.document.contentType))
|
||||
this.isImage.removeAttribute('disabled');
|
||||
else
|
||||
this.isImage.setAttribute('disabled', 'true');
|
||||
|
|
@ -3717,7 +3700,7 @@ var XULBrowserWindow = {
|
|||
}
|
||||
|
||||
// Disable menu entries for images, enable otherwise
|
||||
if (!gMultiProcessBrowser && content.document && mimeTypeIsTextBased(content.document.contentType))
|
||||
if (!gMultiProcessBrowser && content.document && BrowserUtils.mimeTypeIsTextBased(content.document.contentType))
|
||||
this.isImage.removeAttribute('disabled');
|
||||
else
|
||||
this.isImage.setAttribute('disabled', 'true');
|
||||
|
|
|
|||
|
|
@ -265,7 +265,7 @@ nsContextMenu.prototype = {
|
|||
|
||||
// Hide menu entries for images, show otherwise
|
||||
if (this.inFrame) {
|
||||
if (mimeTypeIsTextBased(this.target.ownerDocument.contentType))
|
||||
if (BrowserUtils.mimeTypeIsTextBased(this.target.ownerDocument.contentType))
|
||||
this.isFrameImage.removeAttribute('hidden');
|
||||
else
|
||||
this.isFrameImage.setAttribute('hidden', 'true');
|
||||
|
|
|
|||
|
|
@ -2730,6 +2730,9 @@
|
|||
get finder() {
|
||||
return this.mTabBrowser.mCurrentBrowser.finder;
|
||||
},
|
||||
destroy: function() {
|
||||
this.finder.destroy();
|
||||
},
|
||||
addResultListener: function(aListener) {
|
||||
this.mListeners.add(aListener);
|
||||
this.finder.addResultListener(aListener);
|
||||
|
|
@ -2750,21 +2753,33 @@
|
|||
set caseSensitive(val) {
|
||||
return this.finder.caseSensitive = val;
|
||||
},
|
||||
fastFind: function(aSearchString, aLinksOnly, aDrawOutline) {
|
||||
this.finder.fastFind(aSearchString, aLinksOnly, aDrawOutline);
|
||||
set entireWord(val) {
|
||||
return this.finder.entireWord = val;
|
||||
},
|
||||
findAgain: function(aFindBackwards, aLinksOnly, aDrawOutline) {
|
||||
this.finder.findAgain(aFindBackwards, aLinksOnly, aDrawOutline);
|
||||
get highlighter() {
|
||||
return this.finder.highlighter;
|
||||
},
|
||||
get matchesCountLimit() {
|
||||
return this.finder.matchesCountLimit;
|
||||
},
|
||||
fastFind: function(...args) {
|
||||
this.finder.fastFind(...args);
|
||||
},
|
||||
findAgain: function(...args) {
|
||||
this.finder.findAgain(...args);
|
||||
},
|
||||
setSearchStringToSelection: function() {
|
||||
return this.finder.setSearchStringToSelection();
|
||||
},
|
||||
highlight: function(aHighlight, aWord) {
|
||||
this.finder.highlight(aHighlight, aWord);
|
||||
highlight: function(...args) {
|
||||
this.finder.highlight(...args);
|
||||
},
|
||||
getInitialSelection: function() {
|
||||
this.finder.getInitialSelection();
|
||||
},
|
||||
getActiveSelectionText: function() {
|
||||
return this.finder.getActiveSelectionText();
|
||||
},
|
||||
enableSelection: function() {
|
||||
this.finder.enableSelection();
|
||||
},
|
||||
|
|
@ -2774,11 +2789,38 @@
|
|||
focusContent: function() {
|
||||
this.finder.focusContent();
|
||||
},
|
||||
onFindbarClose: function() {
|
||||
this.finder.onFindbarClose();
|
||||
},
|
||||
onFindbarOpen: function() {
|
||||
this.finder.onFindbarOpen();
|
||||
},
|
||||
onModalHighlightChange: function(...args) {
|
||||
return this.finder.onModalHighlightChange(...args);
|
||||
},
|
||||
onHighlightAllChange: function(...args) {
|
||||
return this.finder.onHighlightAllChange(...args);
|
||||
},
|
||||
keyPress: function(aEvent) {
|
||||
this.finder.keyPress(aEvent);
|
||||
},
|
||||
requestMatchesCount: function(aWord, aMatchLimit, aLinksOnly) {
|
||||
this.finder.requestMatchesCount(aWord, aMatchLimit, aLinksOnly);
|
||||
requestMatchesCount: function(...args) {
|
||||
this.finder.requestMatchesCount(...args);
|
||||
},
|
||||
onIteratorRangeFound: function(...args) {
|
||||
this.finder.onIteratorRangeFound(...args);
|
||||
},
|
||||
onIteratorReset: function() {
|
||||
this.finder.onIteratorReset();
|
||||
},
|
||||
onIteratorRestart: function(...args) {
|
||||
this.finder.onIteratorRestart(...args);
|
||||
},
|
||||
onIteratorStart: function(...args) {
|
||||
this.finder.onIteratorStart(...args);
|
||||
},
|
||||
onLocationChange: function(...args) {
|
||||
this.finder.onLocationChange(...args);
|
||||
}
|
||||
})
|
||||
]]></field>
|
||||
|
|
@ -2787,6 +2829,19 @@
|
|||
onget="return this.mCurrentBrowser.docShell"
|
||||
readonly="true"/>
|
||||
|
||||
<property name="messageManager"
|
||||
readonly="true">
|
||||
<getter>
|
||||
<![CDATA[
|
||||
let frameLoader = this.mCurrentBrowser.frameLoader;
|
||||
if (!frameLoader) {
|
||||
return null;
|
||||
}
|
||||
return frameLoader.messageManager;
|
||||
]]>
|
||||
</getter>
|
||||
</property>
|
||||
|
||||
<property name="webNavigation"
|
||||
onget="return this.mCurrentBrowser.webNavigation"
|
||||
readonly="true"/>
|
||||
|
|
@ -2803,6 +2858,10 @@
|
|||
readonly="true"
|
||||
onget="return this.mCurrentBrowser.contentWindow"/>
|
||||
|
||||
<property name="contentWindowAsCPOW"
|
||||
readonly="true"
|
||||
onget="return this.contentWindow;"/>
|
||||
|
||||
<property name="sessionHistory"
|
||||
onget="return this.mCurrentBrowser.sessionHistory;"
|
||||
readonly="true"/>
|
||||
|
|
@ -2873,23 +2932,6 @@
|
|||
}
|
||||
}
|
||||
|
||||
// We need to take care of FAYT-watching as long as the findbar
|
||||
// isn't initialized. The checks on aEvent are copied from
|
||||
// _shouldFastFind (see findbar.xml).
|
||||
if (!gFindBarInitialized &&
|
||||
!(aEvent.ctrlKey || aEvent.metaKey) &&
|
||||
!aEvent.defaultPrevented) {
|
||||
let charCode = aEvent.charCode;
|
||||
if (charCode) {
|
||||
let char = String.fromCharCode(charCode);
|
||||
if (char == "'" || char == "/" ||
|
||||
Services.prefs.getBoolPref("accessibility.typeaheadfind")) {
|
||||
gFindBar._onBrowserKeypress(aEvent);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef XP_MACOSX
|
||||
if (!aEvent.metaKey)
|
||||
return;
|
||||
|
|
@ -2981,6 +3023,14 @@
|
|||
window.focus();
|
||||
break;
|
||||
}
|
||||
case "Findbar:Keypress":
|
||||
if (!gFindBarInitialized) {
|
||||
// If the find bar for this tab is not yet alive, change that,
|
||||
// and make sure we return the result:
|
||||
return gFindBar.receiveMessage(aMessage);
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
]]></body>
|
||||
</method>
|
||||
|
|
@ -3047,6 +3097,7 @@
|
|||
this.mCurrentBrowser);
|
||||
}
|
||||
messageManager.addMessageListener("DOMWebNotificationClicked", this);
|
||||
messageManager.addMessageListener("Findbar:Keypress", this);
|
||||
]]>
|
||||
</constructor>
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue