зеркало из https://github.com/mozilla/pjs.git
Bug 349884 - Fast Find must be disabled when viewing non-text content, patch by Ehsan Akhgari <ehsan.akhgari@gmail.com>, r=mano
This commit is contained in:
Родитель
bd408550f3
Коммит
737b76403d
|
@ -26,6 +26,7 @@
|
|||
- Ben Basson <contact@cusser.net>
|
||||
- Jason Barnabe <jason_barnabe@fastmail.fm>
|
||||
- Asaf Romano <mano@mozilla.com>
|
||||
- Ehsan Akhgari <ehsan.akhgari@gmail.com>
|
||||
-
|
||||
- Alternatively, the contents of this file may be used under the terms of
|
||||
- either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
|
@ -893,6 +894,21 @@
|
|||
]]></body>
|
||||
</method>
|
||||
|
||||
<!--
|
||||
- Returns true if |aMimeType| is text-based, or false otherwise.
|
||||
-
|
||||
- @param aMimeType
|
||||
- The MIME type to check.
|
||||
-->
|
||||
<method name="_mimeTypeIsTextBased">
|
||||
<parameter name="aMimeType"/>
|
||||
<body><![CDATA[
|
||||
return /^text\/|\+xml$/.test(aMimeType) ||
|
||||
aMimeType == "application/x-javascript" ||
|
||||
aMimeType == "application/xml";
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<!--
|
||||
- Returns whether FAYT can be used for the given event in
|
||||
- the current content state.
|
||||
|
@ -904,6 +920,11 @@
|
|||
aEvent.getPreventDefault())
|
||||
return false;
|
||||
|
||||
var win = document.commandDispatcher.focusedWindow;
|
||||
if (win)
|
||||
if (!this._mimeTypeIsTextBased(win.document.contentType))
|
||||
return false;
|
||||
|
||||
var elt = document.commandDispatcher.focusedElement;
|
||||
if (elt) {
|
||||
if (elt instanceof HTMLInputElement) {
|
||||
|
@ -930,7 +951,6 @@
|
|||
if (url == "about:blank" || url == "about:config")
|
||||
return false;
|
||||
|
||||
var win = document.commandDispatcher.focusedWindow;
|
||||
if (win) {
|
||||
try {
|
||||
var editingSession = win.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
|
||||
|
|
Загрузка…
Ссылка в новой задаче