diff --git a/browser/devtools/debugger/debugger-toolbar.js b/browser/devtools/debugger/debugger-toolbar.js index 2a9ecacdac1b..23c034a89e6e 100644 --- a/browser/devtools/debugger/debugger-toolbar.js +++ b/browser/devtools/debugger/debugger-toolbar.js @@ -5,6 +5,10 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ "use strict"; +// A time interval sufficient for the options popup panel to finish hiding +// itself. +const POPUP_HIDDEN_DELAY = 100; // ms + /** * Functions handling the toolbar view: close button, expand/collapse button, * pause/resume and stepping buttons etc. @@ -233,6 +237,13 @@ OptionsView.prototype = { this._button.removeAttribute("open"); }, + /** + * Listener handling the 'gear menu' popup hidden event. + */ + _onPopupHidden: function() { + window.dispatchEvent(document, "Debugger:OptionsPopupHidden"); + }, + /** * Listener handling the 'pause on exceptions' menuitem command. */ @@ -269,10 +280,19 @@ OptionsView.prototype = { * Listener handling the 'show original source' menuitem command. */ _toggleShowOriginalSource: function() { + function reconfigure() { + window.removeEventListener("Debugger:OptionsPopupHidden", reconfigure, false); + // The popup panel needs more time to hide after triggering onpopuphidden. + window.setTimeout(function() { + DebuggerController.reconfigureThread(pref); + }, POPUP_HIDDEN_DELAY); + } + let pref = Prefs.sourceMapsEnabled = this._showOriginalSourceItem.getAttribute("checked") == "true"; - DebuggerController.reconfigureThread(pref); + // Don't block the UI while reconfiguring the server. + window.addEventListener("Debugger:OptionsPopupHidden", reconfigure, false); }, _button: null, diff --git a/browser/devtools/debugger/debugger.xul b/browser/devtools/debugger/debugger.xul index 3b4b9a1a86ae..cc4d0ce4b90f 100644 --- a/browser/devtools/debugger/debugger.xul +++ b/browser/devtools/debugger/debugger.xul @@ -145,7 +145,8 @@ + onpopuphiding="DebuggerView.Options._onPopupHiding()" + onpopuphidden="DebuggerView.Options._onPopupHidden()"> = 0; line--) { + let bp = existing[line]; + // Only consider breakpoints that are not already associated with + // scripts, and limit search to the line numbers contained in the new + // script. + if (bp && !bp.actor.scripts.length && + line >= aScript.startLine && line <= endLine) { + this._setBreakpoint(bp); + } + } + } + return true; + }, + /** * Add the provided script to the server cache. *