diff --git a/b2g/chrome/content/dbg-webapps-actors.js b/b2g/chrome/content/dbg-webapps-actors.js index 81f32b5217b..5decc5e6b57 100644 --- a/b2g/chrome/content/dbg-webapps-actors.js +++ b/b2g/chrome/content/dbg-webapps-actors.js @@ -53,13 +53,13 @@ WebappsActor.prototype = { reg._registerActivities(manifest, aApp, true); reg._saveApps(function() { aApp.manifest = manifest; + reg.broadcastMessage("Webapps:AddApp", { id: aId, app: aApp }); reg.broadcastMessage("Webapps:Install:Return:OK", { app: aApp, oid: "foo", requestID: "bar" }); delete aApp.manifest; - reg.broadcastMessage("Webapps:AddApp", { id: aId, app: aApp }); self.conn.send({ from: self.actorID, type: "webappsEvent", appId: aId diff --git a/b2g/installer/package-manifest.in b/b2g/installer/package-manifest.in index f7ae8c02ea0..6fb91d85330 100644 --- a/b2g/installer/package-manifest.in +++ b/b2g/installer/package-manifest.in @@ -212,7 +212,6 @@ @BINPATH@/components/dom_xbl.xpt @BINPATH@/components/dom_xpath.xpt @BINPATH@/components/dom_xul.xpt -@BINPATH@/components/dom_loadsave.xpt @BINPATH@/components/dom_time.xpt @BINPATH@/components/downloads.xpt @BINPATH@/components/editor.xpt diff --git a/browser/base/content/browser.js b/browser/base/content/browser.js index 0643574899a..257ea2ce3ea 100644 --- a/browser/base/content/browser.js +++ b/browser/base/content/browser.js @@ -202,6 +202,10 @@ XPCOMUtils.defineLazyGetter(this, "PageMenu", function() { * one listener that calls all real handlers. */ function pageShowEventHandlers(event) { + // Filter out events that are not about the document load we are interested in + if (event.target != content.document) + return; + charsetLoadListener(); XULBrowserWindow.asyncUpdateUI(); @@ -1338,6 +1342,15 @@ var gBrowserInit = { var isLoadingBlank = isBlankPageURL(uriToLoad); + gBrowser.addEventListener("pageshow", function(event) { + // The XULWindow::mPrimaryContentShell isn't up-to-date when pageshow + // is fired by a swapFrameLoaders() call (i.e. when we swap the docShells + // of two tabs). Get around this by using setTimeout - everything should + // be in the right state on the next tick. + if (content) + setTimeout(pageShowEventHandlers, 0, event); + }, true); + if (uriToLoad && uriToLoad != "about:blank") { if (uriToLoad instanceof Ci.nsISupportsArray) { let count = uriToLoad.Count(); @@ -1396,12 +1409,6 @@ var gBrowserInit = { AddonManager.addAddonListener(AddonsMgrListener); WebrtcIndicator.init(); - gBrowser.addEventListener("pageshow", function(event) { - // Filter out events that are not about the document load we are interested in - if (content && event.target == content.document) - setTimeout(pageShowEventHandlers, 0, event); - }, true); - // Ensure login manager is up and running. Services.logins; diff --git a/browser/base/content/test/Makefile.in b/browser/base/content/test/Makefile.in index 2fb9edd7154..9158dc26090 100644 --- a/browser/base/content/test/Makefile.in +++ b/browser/base/content/test/Makefile.in @@ -185,6 +185,7 @@ _BROWSER_FILES = \ browser_pluginnotification.js \ browser_plugins_added_dynamically.js \ browser_CTPScriptPlugin.js \ + browser_CTP_drag_drop.js \ browser_pluginplaypreview.js \ browser_pluginplaypreview2.js \ browser_private_browsing_window.js \ diff --git a/browser/base/content/test/browser_CTP_drag_drop.js b/browser/base/content/test/browser_CTP_drag_drop.js new file mode 100644 index 00000000000..9d647ec9395 --- /dev/null +++ b/browser/base/content/test/browser_CTP_drag_drop.js @@ -0,0 +1,53 @@ +let gHttpTestRoot = getRootDirectory(gTestPath).replace("chrome://mochitests/content/", "http://127.0.0.1:8888/"); + +let gNextTest = null; +let gNewWindow = null; + +Components.utils.import("resource://gre/modules/Services.jsm"); + +function test() { + waitForExplicitFinish(); + registerCleanupFunction(function() { Services.prefs.clearUserPref("plugins.click_to_play"); }); + Services.prefs.setBoolPref("plugins.click_to_play", true); + + gBrowser.selectedTab = gBrowser.addTab(); + gBrowser.selectedBrowser.addEventListener("PluginBindingAttached", handleEvent, true, true); + gNextTest = part1; + gBrowser.selectedBrowser.contentDocument.location = gHttpTestRoot + "plugin_test.html"; +} + +function handleEvent() { + gNextTest(); +} + +function part1() { + gBrowser.selectedBrowser.removeEventListener("PluginBindingAttached", handleEvent); + ok(PopupNotifications.getNotification("click-to-play-plugins", gBrowser.selectedBrowser), "Should have a click-to-play notification in the initial tab"); + + gNextTest = part2; + gNewWindow = gBrowser.replaceTabWithWindow(gBrowser.selectedTab); + gNewWindow.addEventListener("load", handleEvent, true); +} + +function part2() { + gNewWindow.removeEventListener("load", handleEvent); + let condition = function() PopupNotifications.getNotification("click-to-play-plugins", gNewWindow.gBrowser.selectedBrowser); + waitForCondition(condition, part3, "Waited too long for click-to-play notification"); +} + +function part3() { + ok(PopupNotifications.getNotification("click-to-play-plugins", gNewWindow.gBrowser.selectedBrowser), "Should have a click-to-play notification in the tab in the new window"); + ok(!PopupNotifications.getNotification("click-to-play-plugins", gBrowser.selectedBrowser), "Should not have a click-to-play notification in the old window now"); + + gBrowser.selectedTab = gBrowser.addTab(); + gBrowser.swapBrowsersAndCloseOther(gBrowser.selectedTab, gNewWindow.gBrowser.selectedTab); + let condition = function() PopupNotifications.getNotification("click-to-play-plugins", gBrowser.selectedBrowser); + waitForCondition(condition, part4, "Waited too long for click-to-play notification"); +} + +function part4() { + ok(PopupNotifications.getNotification("click-to-play-plugins", gBrowser.selectedBrowser), "Should have a click-to-play notification in the initial tab again"); + + gBrowser.removeCurrentTab(); + finish(); +} diff --git a/browser/base/content/utilityOverlay.js b/browser/base/content/utilityOverlay.js index beb5b9ee9e2..743e2a49da0 100644 --- a/browser/base/content/utilityOverlay.js +++ b/browser/base/content/utilityOverlay.js @@ -328,11 +328,11 @@ function openLinkIn(url, where, params) { // (e.g. "javascript:window.open('');"). var fm = Components.classes["@mozilla.org/focus-manager;1"]. getService(Components.interfaces.nsIFocusManager); - if (window == fm.activeWindow || isBlankPageURL(url)) + if (window == fm.activeWindow || w.isBlankPageURL(url)) w.focus(); w.gBrowser.selectedBrowser.focus(); - if (!loadInBackground && isBlankPageURL(url)) + if (!loadInBackground && w.isBlankPageURL(url)) w.focusAndSelectUrlBar(); } diff --git a/browser/devtools/debugger/test/browser_dbg_bug723069_editor-breakpoints.js b/browser/devtools/debugger/test/browser_dbg_bug723069_editor-breakpoints.js index 6739cb1a76b..cdfd834232a 100644 --- a/browser/devtools/debugger/test/browser_dbg_bug723069_editor-breakpoints.js +++ b/browser/devtools/debugger/test/browser_dbg_bug723069_editor-breakpoints.js @@ -24,39 +24,56 @@ function test() let scriptShown = false; let framesAdded = false; - let resumed = false; let testStarted = false; - debug_tab_pane(TAB_URL, function(aTab, aDebuggee, aPane) { - gTab = aTab; - gDebuggee = aDebuggee; - gPane = aPane; - gDebugger = gPane.panelWin; - resumed = true; + gTab = addTab(TAB_URL, function onAddTab() { + info("tab added"); + gDebuggee = gTab.linkedBrowser.contentWindow.wrappedJSObject; + + let target = TargetFactory.forTab(gTab); + + gDevTools.showToolbox(target, "jsdebugger").then(function(toolbox) { + info("jsdebugger panel opened"); + gPane = toolbox.getCurrentPanel(); + gDebugger = gPane.panelWin; + gDebugger.addEventListener("Debugger:AfterScriptsAdded", + onAfterScriptsAdded); + }); + }); + + function onAfterScriptsAdded() + { + info("scripts added"); + gDebugger.removeEventListener("Debugger:AfterScriptsAdded", + onAfterScriptsAdded, true); gDebugger.addEventListener("Debugger:SourceShown", onScriptShown); - gDebugger.DebuggerController.activeThread.addOneTimeListener("framesadded", function() { - framesAdded = true; - executeSoon(startTest); - }); + gDebugger.DebuggerController.activeThread.addOneTimeListener("framesadded", + function onFramesAdded() { + info("frames added"); + framesAdded = true; + executeSoon(startTest); + }); executeSoon(function() { gDebuggee.firstCall(); }); - }); + } function onScriptShown(aEvent) { scriptShown = aEvent.detail.url.indexOf("-02.js") != -1; + info("script shown " + aEvent.detail.url); executeSoon(startTest); } function startTest() { - if (scriptShown && framesAdded && resumed && !testStarted) { + if (scriptShown && framesAdded && !testStarted) { gDebugger.removeEventListener("Debugger:SourceShown", onScriptShown); testStarted = true; + info("test started"); Services.tm.currentThread.dispatch({ run: performTest }, 0); } } diff --git a/browser/devtools/framework/Toolbox.jsm b/browser/devtools/framework/Toolbox.jsm index 78064382dac..31ad4084b0b 100644 --- a/browser/devtools/framework/Toolbox.jsm +++ b/browser/devtools/framework/Toolbox.jsm @@ -474,6 +474,7 @@ Toolbox.prototype = { iframe.className = "toolbox-panel-iframe"; iframe.id = "toolbox-panel-iframe-" + id; iframe.setAttribute("flex", 1); + iframe.setAttribute("forceOwnRefreshDriver", ""); let vbox = this.doc.getElementById("toolbox-panel-" + id); vbox.appendChild(iframe); diff --git a/browser/devtools/framework/toolbox-window.xul b/browser/devtools/framework/toolbox-window.xul index ce74feb5cb7..880445e83a3 100644 --- a/browser/devtools/framework/toolbox-window.xul +++ b/browser/devtools/framework/toolbox-window.xul @@ -28,5 +28,5 @@ modifiers="accel"/> - + diff --git a/browser/installer/package-manifest.in b/browser/installer/package-manifest.in index 613f8fa428a..9bf0f31966a 100644 --- a/browser/installer/package-manifest.in +++ b/browser/installer/package-manifest.in @@ -211,7 +211,6 @@ @BINPATH@/components/dom_xbl.xpt @BINPATH@/components/dom_xpath.xpt @BINPATH@/components/dom_xul.xpt -@BINPATH@/components/dom_loadsave.xpt @BINPATH@/components/downloads.xpt @BINPATH@/components/editor.xpt @BINPATH@/components/embed_base.xpt diff --git a/browser/metro/base/content/BrowserTouchHandler.js b/browser/metro/base/content/BrowserTouchHandler.js index 6536ccb6d15..964f8e10269 100644 --- a/browser/metro/base/content/BrowserTouchHandler.js +++ b/browser/metro/base/content/BrowserTouchHandler.js @@ -26,26 +26,10 @@ const BrowserTouchHandler = { json: aMessage.json, target: aMessage.target }; // Touch input selection handling - if (!InputSourceHelper.isPrecise) { - if (SelectionHelperUI.isActive) { - // Selection handler is active. - if (aMessage.json.types.indexOf("selected-text") != -1) { - // long tap on existing selection. The incoming message has the - // string data, so reset the selection handler and invoke the - // context menu. - SelectionHelperUI.closeEditSession(); - } else { - // Weird, context menu request with no selected text and - // SelectionHelperUI is active? Might be a bug, warn. Fall - // through anyway, the context menu handler will look in the - // incoming message for content types it knows how to handle. - Util.dumpLn("long tap on empty selection with SelectionHelperUI active?"); - SelectionHelperUI.closeEditSession(); - } - } else if (SelectionHelperUI.canHandle(aMessage)) { - SelectionHelperUI.openEditSession(aMessage); - return; - } + if (!InputSourceHelper.isPrecise && !SelectionHelperUI.isActive && + SelectionHelperUI.canHandle(aMessage)) { + SelectionHelperUI.openEditSession(aMessage); + return; } // Check to see if we have context menu item(s) that apply to what diff --git a/browser/metro/base/content/ContextCommands.js b/browser/metro/base/content/ContextCommands.js index 9e8618cc31b..ba9bae70c81 100644 --- a/browser/metro/base/content/ContextCommands.js +++ b/browser/metro/base/content/ContextCommands.js @@ -33,6 +33,7 @@ var ContextCommands = { this.clipboard.copyString(ContextMenuUI.popupState.string, this.docRef); this.showToast(Strings.browser.GetStringFromName("selectionHelper.textCopied")); + SelectionHelperUI.closeEditSessionAndClear(); } } else { // chrome @@ -52,6 +53,7 @@ var ContextCommands = { let y = ContextMenuUI.popupState.y; let json = {x: x, y: y, command: "paste" }; target.messageManager.sendAsyncMessage("Browser:ContextCommand", json); + SelectionHelperUI.closeEditSessionAndClear(); } else { // chrome target.editor.paste(Ci.nsIClipboard.kGlobalClipboard); diff --git a/browser/metro/base/content/browser-scripts.js b/browser/metro/base/content/browser-scripts.js index 73c75a37987..3f9b121eee5 100644 --- a/browser/metro/base/content/browser-scripts.js +++ b/browser/metro/base/content/browser-scripts.js @@ -79,10 +79,10 @@ XPCOMUtils.defineLazyServiceGetter(this, "CrashReporter", * so it is not possible to set a lazy getter for Geometry.jsm. */ Cu.import("resource://gre/modules/Geometry.jsm"); - /* * Browser scripts */ +let ScriptContexts = {}; [ ["WebProgress", "chrome://browser/content/WebProgress.js"], ["FindHelperUI", "chrome://browser/content/helperui/FindHelperUI.js"], @@ -134,12 +134,16 @@ Cu.import("resource://gre/modules/Geometry.jsm"); ].forEach(function (aScript) { let [name, script] = aScript; XPCOMUtils.defineLazyGetter(window, name, function() { - let sandbox = {}; - Services.scriptloader.loadSubScript(script, sandbox); + let sandbox; + if (script in ScriptContexts) { + sandbox = ScriptContexts[script]; + } else { + sandbox = ScriptContexts[script] = {}; + Services.scriptloader.loadSubScript(script, sandbox); + } return sandbox[name]; }); }); - #ifdef MOZ_SERVICES_SYNC XPCOMUtils.defineLazyGetter(this, "Weave", function() { Components.utils.import("resource://services-sync/main.js"); diff --git a/browser/metro/base/content/browser.xul b/browser/metro/base/content/browser.xul index b787a44d1c9..593f6f58e64 100644 --- a/browser/metro/base/content/browser.xul +++ b/browser/metro/base/content/browser.xul @@ -419,7 +419,11 @@ - + + + + +