summaryrefslogtreecommitdiffstats
path: root/application/palemoon/base
diff options
context:
space:
mode:
authorjanekptacijarabaci <janekptacijarabaci@seznam.cz>2018-04-13 10:55:02 +0200
committerjanekptacijarabaci <janekptacijarabaci@seznam.cz>2018-04-13 10:55:02 +0200
commit2e0e50636fb38354ca4957e3713dd8434e0347ed (patch)
treee84cba45595238470e42cb22704948d28d9f3569 /application/palemoon/base
parent5fccd1cabd7b120e19753541cc5e9184e181b536 (diff)
downloadUXP-2e0e50636fb38354ca4957e3713dd8434e0347ed.tar
UXP-2e0e50636fb38354ca4957e3713dd8434e0347ed.tar.gz
UXP-2e0e50636fb38354ca4957e3713dd8434e0347ed.tar.lz
UXP-2e0e50636fb38354ca4957e3713dd8434e0347ed.tar.xz
UXP-2e0e50636fb38354ca4957e3713dd8434e0347ed.zip
Fix: Findbar broken (basic)
Issue #138
Diffstat (limited to 'application/palemoon/base')
-rw-r--r--application/palemoon/base/content/browser.js27
-rw-r--r--application/palemoon/base/content/nsContextMenu.js2
-rw-r--r--application/palemoon/base/content/tabbrowser.xml101
3 files changed, 82 insertions, 48 deletions
diff --git a/application/palemoon/base/content/browser.js b/application/palemoon/base/content/browser.js
index 8b3fa0b4f..981ab5f0f 100644
--- a/application/palemoon/base/content/browser.js
+++ b/application/palemoon/base/content/browser.js
@@ -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');
diff --git a/application/palemoon/base/content/nsContextMenu.js b/application/palemoon/base/content/nsContextMenu.js
index 17db4d3a9..f9e371a6b 100644
--- a/application/palemoon/base/content/nsContextMenu.js
+++ b/application/palemoon/base/content/nsContextMenu.js
@@ -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');
diff --git a/application/palemoon/base/content/tabbrowser.xml b/application/palemoon/base/content/tabbrowser.xml
index b5395bbd9..b4b997532 100644
--- a/application/palemoon/base/content/tabbrowser.xml
+++ b/application/palemoon/base/content/tabbrowser.xml
@@ -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;
+ },
+ get highlighter() {
+ return this.finder.highlighter;
+ },
+ get matchesCountLimit() {
+ return this.finder.matchesCountLimit;
},
- findAgain: function(aFindBackwards, aLinksOnly, aDrawOutline) {
- this.finder.findAgain(aFindBackwards, aLinksOnly, aDrawOutline);
+ 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>