diff --git a/content/xbl/builtin/win/platformHTMLBindings.xml b/content/xbl/builtin/win/platformHTMLBindings.xml
index c5a80feec09..4e25ec74ae4 100644
--- a/content/xbl/builtin/win/platformHTMLBindings.xml
+++ b/content/xbl/builtin/win/platformHTMLBindings.xml
@@ -107,11 +107,6 @@
-
-
-
-
diff --git a/dom/src/base/nsGlobalWindowCommands.cpp b/dom/src/base/nsGlobalWindowCommands.cpp
index 83448382615..2f482650b04 100644
--- a/dom/src/base/nsGlobalWindowCommands.cpp
+++ b/dom/src/base/nsGlobalWindowCommands.cpp
@@ -676,6 +676,7 @@ protected:
// no member variables, please, we're stateless!
};
+#if 0 // Remove unless needed again, bug 204777
class nsGoForwardCommand : public nsWebNavigationBaseCommand
{
protected:
@@ -693,6 +694,7 @@ protected:
virtual nsresult DoWebNavCommand(const char *aCommandName, nsIWebNavigation* aWebNavigation);
// no member variables, please, we're stateless!
};
+#endif
/*---------------------------------------------------------------------------
@@ -756,6 +758,7 @@ nsWebNavigationBaseCommand::GetWebNavigationFromContext(nsISupports *aContext, n
#pragma mark -
#endif
+#if 0 // Remove unless needed again, bug 204777
nsresult
nsGoForwardCommand::IsWebNavCommandEnabled(const char * aCommandName, nsIWebNavigation* aWebNavigation, PRBool *outCmdEnabled)
{
@@ -779,6 +782,7 @@ nsGoBackCommand::DoWebNavCommand(const char *aCommandName, nsIWebNavigation* aWe
{
return aWebNavigation->GoBack();
}
+#endif
/*---------------------------------------------------------------------------
@@ -959,8 +963,10 @@ nsWindowCommandRegistration::RegisterWindowCommands(
NS_REGISTER_ONE_COMMAND(nsClipboardGetContentsCommand, "cmd_getContents");
+#if 0 // Remove unless needed again, bug 204777
NS_REGISTER_ONE_COMMAND(nsGoBackCommand, "cmd_browserBack");
NS_REGISTER_ONE_COMMAND(nsGoForwardCommand, "cmd_browserForward");
+#endif
NS_REGISTER_ONE_COMMAND(nsClipboardDragDropHookCommand, "cmd_clipboardDragDropHook");
diff --git a/extensions/typeaheadfind/public/nsITypeAheadFind.idl b/extensions/typeaheadfind/public/nsITypeAheadFind.idl
index 744aeb0cc5c..fd9a273804c 100644
--- a/extensions/typeaheadfind/public/nsITypeAheadFind.idl
+++ b/extensions/typeaheadfind/public/nsITypeAheadFind.idl
@@ -53,24 +53,38 @@
interface nsIDOMEvent;
-[uuid(AD1C62CC-72F4-4c5b-BE78-503854F9E0D8)]
+[scriptable, uuid(AD1C62CC-72F4-4c5b-BE78-503854F9E0D8)]
interface nsITypeAheadFind : nsISupports
{
- // Is type ahead find mode currently on?
+ /** Is type ahead find mode currently on? */
readonly attribute boolean isActive;
- // Manually start or cancel type ahead find mode
+ /** Manually start type ahead find mode */
void startNewFind(in nsIDOMWindow aWindow, in boolean aLinksOnly);
+
+ /** Manually cancel type ahead find mode */
void cancelFind();
- // If no automatic typeaheadfind start in this window,
- // it must be started manually with startNewFind()
- void setAutoStart(in nsIDOMWindow aWindow, in boolean aAutoStartOn);
+ /**
+ * Will find as you type start automatically if the user
+ * types with the focus on page content other than a textfield or select?
+ * If autostart is off, the startNewFind() method can be used to enact
+ * type ahead find, as well as cmd_findTypeLinks or cmd_findTypeText.
+ */
+ void setAutoStart(in nsIDOMWindow aWindow, in boolean aIsAutoStartOn);
boolean getAutoStart(in nsIDOMWindow aWindow);
- // Find next recurrence if typeaheadfind was the last used find,
- // as opposed to regular find. Returns false in nsISupportsPRBool if we
- // don't handle the request.
+ /**
+ * Find next recurrence if typeaheadfind was the last used find,
+ * as opposed to regular find. Returns false in nsISupportsPRBool if we
+ * don't handle the request.
+ */
void findNext(in boolean aReverse, in nsISupportsInterfacePointer aCallerWindowSupports);
+
+ /*
+ * Go back and remove one character from find string
+ * Returns true if backspace used
+ */
+ boolean backOneChar();
};
diff --git a/extensions/typeaheadfind/src/nsTypeAheadFind.cpp b/extensions/typeaheadfind/src/nsTypeAheadFind.cpp
index 876c856c91c..44c78c0d2fb 100644
--- a/extensions/typeaheadfind/src/nsTypeAheadFind.cpp
+++ b/extensions/typeaheadfind/src/nsTypeAheadFind.cpp
@@ -664,7 +664,13 @@ nsTypeAheadFind::KeyPress(nsIDOMEvent* aEvent)
// ----------- Back space -------------------------
if (keyCode == nsIDOMKeyEvent::DOM_VK_BACK_SPACE) {
- if (HandleBackspace()) {
+ // The order of seeing keystrokes is:
+ // 1) Chrome, 2) Typeahead, 3) [platform]HTMLBindings.xml
+ // If chrome handles backspace, it needs to do this work
+ // Otherwise, we handle backspace here.
+ PRBool backspaceUsed;
+ BackOneChar(&backspaceUsed);
+ if (backspaceUsed) {
aEvent->PreventDefault(); // Prevent normal processing of this keystroke
}
@@ -693,13 +699,15 @@ nsTypeAheadFind::KeyPress(nsIDOMEvent* aEvent)
}
-PRBool
-nsTypeAheadFind::HandleBackspace()
+NS_IMETHODIMP
+nsTypeAheadFind::BackOneChar(PRBool *aIsBackspaceUsed)
{
// In normal type ahead find, remove a printable char from
// mTypeAheadBuffer, then search for buffer contents
// Or, in repeated char find, go backwards
+ *aIsBackspaceUsed = PR_TRUE;
+
// ---------- No chars in string ------------
if (mTypeAheadBuffer.IsEmpty() || !mStartFindRange) {
if (!mFindNextBuffer.IsEmpty() &&
@@ -722,9 +730,12 @@ nsTypeAheadFind::HandleBackspace()
soundInterface->Beep(); // beep to warn
}
mIsBackspaceProtectOn = PR_FALSE;
- return PR_TRUE;
}
- return PR_FALSE;
+ else {
+ *aIsBackspaceUsed = PR_FALSE;
+ }
+
+ return NS_OK;
}
}
@@ -742,7 +753,7 @@ nsTypeAheadFind::HandleBackspace()
CancelFind();
mIsBackspaceProtectOn = PR_TRUE;
- return PR_TRUE;
+ return NS_OK;
}
// ---------- Multiple chars in string ----------
@@ -763,7 +774,7 @@ nsTypeAheadFind::HandleBackspace()
--mBadKeysSinceMatch;
DisplayStatus(PR_FALSE, nsnull, PR_FALSE); // Display failure status
SaveFind();
- return PR_TRUE;
+ return NS_OK;
}
mBadKeysSinceMatch = 0;
@@ -785,7 +796,8 @@ nsTypeAheadFind::HandleBackspace()
}
}
if (!presShell) {
- return PR_FALSE;
+ *aIsBackspaceUsed = PR_FALSE;
+ return NS_ERROR_FAILURE;
}
// Set the selection to the where the first character was found
// so that find starts from there
@@ -808,7 +820,7 @@ nsTypeAheadFind::HandleBackspace()
SaveFind();
- return PR_TRUE; // Backspace handled
+ return NS_OK; // Backspace handled
}
diff --git a/xpfe/browser/resources/content/navigator.js b/xpfe/browser/resources/content/navigator.js
index b3a3f9a48d0..d26c8018ae8 100644
--- a/xpfe/browser/resources/content/navigator.js
+++ b/xpfe/browser/resources/content/navigator.js
@@ -740,6 +740,27 @@ function BrowserBack()
}
}
+function BrowserHandleBackspace()
+{
+ // The order of seeing keystrokes is this:
+ // 1) Chrome, 2) Typeahead, 3) [platform]HTMLBindings.xml
+ // Rather than have typeaheadfind responsible for making VK_BACK
+ // go back in history, we handle backspace it here as follows:
+ // When backspace is pressed, it might mean back
+ // in typeaheadfind if that's active, or it might mean back in history
+
+ var typeAhead = null;
+ const TYPE_AHEAD_FIND_CONTRACTID = "@mozilla.org/typeaheadfind;1";
+ if (TYPE_AHEAD_FIND_CONTRACTID in Components.classes) {
+ typeAhead = Components.classes[TYPE_AHEAD_FIND_CONTRACTID]
+ .getService(Components.interfaces.nsITypeAheadFind);
+ }
+
+ if (!typeAhead || !typeAhead.backOneChar()) {
+ BrowserBack();
+ }
+}
+
function BrowserForward()
{
try {
diff --git a/xpfe/browser/resources/content/navigatorOverlay.xul b/xpfe/browser/resources/content/navigatorOverlay.xul
index fb90e16b1ab..30f48074cf1 100644
--- a/xpfe/browser/resources/content/navigatorOverlay.xul
+++ b/xpfe/browser/resources/content/navigatorOverlay.xul
@@ -113,6 +113,7 @@
+
+
+
+
+