diff --git a/browser/app/profile/firefox.js b/browser/app/profile/firefox.js index c5dba7cfe2f..9398f709078 100644 --- a/browser/app/profile/firefox.js +++ b/browser/app/profile/firefox.js @@ -1112,10 +1112,10 @@ pref("prompts.tab_modal.enabled", true); pref("browser.panorama.animate_zoom", true); // Defines the url to be used for new tabs. -pref("browser.newtab.url", "about:blank"); +pref("browser.newtab.url", "about:newtab"); // Toggles the content of 'about:newtab'. Shows the grid when enabled. -pref("browser.newtabpage.enabled", false); +pref("browser.newtabpage.enabled", true); // Enable the DOM full-screen API. pref("full-screen-api.enabled", true); diff --git a/browser/base/content/browser.js b/browser/base/content/browser.js index 657194f0118..99fddd32702 100644 --- a/browser/base/content/browser.js +++ b/browser/base/content/browser.js @@ -5455,7 +5455,7 @@ var TabsInTitlebar = { if (!this._draghandle) { let tmp = {}; Components.utils.import("resource://gre/modules/WindowDraggingUtils.jsm", tmp); - this._draghandle = new tmp.WindowDraggingElement(tabsToolbar, window); + this._draghandle = new tmp.WindowDraggingElement(tabsToolbar); this._draghandle.mouseDownCheck = function () { return !this._dragBindingAlive && TabsInTitlebar.enabled; }; diff --git a/browser/base/content/test/newtab/head.js b/browser/base/content/test/newtab/head.js index 00f0dc11116..1695c90e22d 100644 --- a/browser/base/content/test/newtab/head.js +++ b/browser/base/content/test/newtab/head.js @@ -5,7 +5,9 @@ const PREF_NEWTAB_ENABLED = "browser.newtabpage.enabled"; Services.prefs.setBoolPref(PREF_NEWTAB_ENABLED, true); -Cu.import("resource:///modules/NewTabUtils.jsm"); +let tmp = {}; +Cu.import("resource:///modules/NewTabUtils.jsm", tmp); +let NewTabUtils = tmp.NewTabUtils; registerCleanupFunction(function () { reset(); diff --git a/browser/components/preferences/cookies.js b/browser/components/preferences/cookies.js index 9edf66146b5..0cea01effb5 100644 --- a/browser/components/preferences/cookies.js +++ b/browser/components/preferences/cookies.js @@ -693,7 +693,10 @@ var gCookiesWindow = { } else { var rangeCount = seln.getRangeCount(); - for (var i = 0; i < rangeCount; ++i) { + // Traverse backwards through selections to avoid messing + // up the indices when they are deleted. + // See bug 388079. + for (var i = rangeCount - 1; i >= 0; --i) { var min = {}; var max = {}; seln.getRangeAt(i, min, max); nextSelected = min.value; diff --git a/browser/components/sessionstore/test/Makefile.in b/browser/components/sessionstore/test/Makefile.in index 3ba76628f99..b2929c449c9 100644 --- a/browser/components/sessionstore/test/Makefile.in +++ b/browser/components/sessionstore/test/Makefile.in @@ -160,6 +160,7 @@ _BROWSER_TEST_FILES = \ browser_687710_2.js \ browser_694378.js \ browser_705597.js \ + browser_707862.js \ $(NULL) ifneq ($(OS_ARCH),Darwin) diff --git a/browser/components/sessionstore/test/browser_707862.js b/browser/components/sessionstore/test/browser_707862.js new file mode 100644 index 00000000000..a42343ca924 --- /dev/null +++ b/browser/components/sessionstore/test/browser_707862.js @@ -0,0 +1,56 @@ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ + +let tabState = { + entries: [{url: "about:home", children: [{url: "about:mozilla"}]}] +}; + +function test() { + waitForExplicitFinish(); + + let tab = gBrowser.addTab("about:blank"); + registerCleanupFunction(function () gBrowser.removeTab(tab)); + + let browser = tab.linkedBrowser; + + whenBrowserLoaded(browser, function () { + ss.setTabState(tab, JSON.stringify(tabState)); + + let sessionHistory = browser.sessionHistory; + let entry = sessionHistory.getEntryAtIndex(0, false); + + whenChildCount(entry, 1, function () { + whenChildCount(entry, 2, function () { + whenBrowserLoaded(browser, function () { + let sessionHistory = browser.sessionHistory; + let entry = sessionHistory.getEntryAtIndex(0, false); + + whenChildCount(entry, 0, finish); + }); + + // reload the browser to deprecate the subframes + browser.reload(); + }); + + // create a dynamic subframe + let doc = browser.contentDocument; + let iframe = doc.createElement("iframe"); + iframe.setAttribute("src", "about:mozilla"); + doc.body.appendChild(iframe); + }); + }); +} + +function whenBrowserLoaded(aBrowser, aCallback) { + aBrowser.addEventListener("load", function onLoad() { + aBrowser.removeEventListener("load", onLoad, true); + executeSoon(aCallback); + }, true); +} + +function whenChildCount(aEntry, aChildCount, aCallback) { + if (aEntry.childCount == aChildCount) + aCallback(); + else + executeSoon(function () whenChildCount(aEntry, aChildCount, aCallback)); +} diff --git a/browser/components/thumbnails/test/head.js b/browser/components/thumbnails/test/head.js index fd902b58079..d0516d82aca 100644 --- a/browser/components/thumbnails/test/head.js +++ b/browser/components/thumbnails/test/head.js @@ -1,7 +1,10 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ -Cu.import("resource:///modules/PageThumbs.jsm"); +let tmp = {}; +Cu.import("resource:///modules/PageThumbs.jsm", tmp); +let PageThumbs = tmp.PageThumbs; +let PageThumbsCache = tmp.PageThumbsCache; registerCleanupFunction(function () { while (gBrowser.tabs.length > 1) diff --git a/browser/devtools/tilt/test/browser_tilt_utils05.js b/browser/devtools/tilt/test/browser_tilt_utils05.js index 56714d0bbf0..5c93eecd1dd 100644 --- a/browser/devtools/tilt/test/browser_tilt_utils05.js +++ b/browser/devtools/tilt/test/browser_tilt_utils05.js @@ -2,7 +2,9 @@ http://creativecommons.org/publicdomain/zero/1.0/ */ "use strict"; -Cu.import("resource:///modules/devtools/LayoutHelpers.jsm"); +let tmp = {}; +Cu.import("resource:///modules/devtools/LayoutHelpers.jsm", tmp); +let LayoutHelpers = tmp.LayoutHelpers; function init(callback) { let iframe = gBrowser.ownerDocument.createElement("iframe"); diff --git a/browser/devtools/webconsole/test/browser_gcli_commands.js b/browser/devtools/webconsole/test/browser_gcli_commands.js index 56e067a65b7..1cb7c80168d 100644 --- a/browser/devtools/webconsole/test/browser_gcli_commands.js +++ b/browser/devtools/webconsole/test/browser_gcli_commands.js @@ -5,7 +5,9 @@ // - https://github.com/mozilla/gcli/blob/master/docs/index.md // - https://wiki.mozilla.org/DevTools/Features/GCLI -Components.utils.import("resource:///modules/gcli.jsm"); +let tmp = {}; +Components.utils.import("resource:///modules/gcli.jsm", tmp); +let gcli = tmp.gcli; let hud; let gcliterm; diff --git a/content/html/content/src/nsHTMLCanvasElement.cpp b/content/html/content/src/nsHTMLCanvasElement.cpp index 7202f307400..bedf98f3451 100644 --- a/content/html/content/src/nsHTMLCanvasElement.cpp +++ b/content/html/content/src/nsHTMLCanvasElement.cpp @@ -216,6 +216,28 @@ nsHTMLCanvasElement::ToDataURL(const nsAString& aType, nsIVariant* aParams, return ToDataURLImpl(aType, aParams, aDataURL); } +// nsHTMLCanvasElement::mozFetchAsStream + +NS_IMETHODIMP +nsHTMLCanvasElement::MozFetchAsStream(nsIInputStreamCallback *aCallback, + const nsAString& aType) +{ + if (!nsContentUtils::IsCallerChrome()) + return NS_ERROR_FAILURE; + + nsresult rv; + bool fellBackToPNG = false; + nsCOMPtr inputData; + + rv = ExtractData(aType, EmptyString(), getter_AddRefs(inputData), fellBackToPNG); + NS_ENSURE_SUCCESS(rv, rv); + + nsCOMPtr asyncData = do_QueryInterface(inputData, &rv); + NS_ENSURE_SUCCESS(rv, rv); + + return aCallback->OnInputStreamReady(asyncData); +} + nsresult nsHTMLCanvasElement::ExtractData(const nsAString& aType, const nsAString& aOptions, diff --git a/docshell/shistory/src/nsSHEntry.cpp b/docshell/shistory/src/nsSHEntry.cpp index 767ef70980c..31e007d8692 100644 --- a/docshell/shistory/src/nsSHEntry.cpp +++ b/docshell/shistory/src/nsSHEntry.cpp @@ -655,8 +655,16 @@ nsSHEntry::RemoveChild(nsISHEntry * aChild) childRemoved = mChildren.ReplaceObjectAt(nsnull, index); } } - if (childRemoved) + if (childRemoved) { aChild->SetParent(nsnull); + + // reduce the child count, i.e. remove empty children at the end + for (PRInt32 i = mChildren.Count() - 1; i >= 0 && !mChildren[i]; --i) { + if (!mChildren.RemoveObjectAt(i)) { + break; + } + } + } return NS_OK; } diff --git a/dom/interfaces/html/nsIDOMHTMLCanvasElement.idl b/dom/interfaces/html/nsIDOMHTMLCanvasElement.idl index 964ae1040ee..9d097e3ad24 100644 --- a/dom/interfaces/html/nsIDOMHTMLCanvasElement.idl +++ b/dom/interfaces/html/nsIDOMHTMLCanvasElement.idl @@ -54,6 +54,7 @@ interface nsIDOMFile; interface nsIVariant; +interface nsIInputStreamCallback; [scriptable, uuid(8cddbc86-f384-40ac-835b-fe3e00630cad)] interface nsIDOMHTMLCanvasElement : nsIDOMHTMLElement @@ -82,5 +83,10 @@ interface nsIDOMHTMLCanvasElement : nsIDOMHTMLElement // A Mozilla-only extension to get a canvas context backed by double-buffered // shared memory. Only privileged callers can call this. nsISupports MozGetIPCContext(in DOMString contextId); + + // A Mozilla-only extension that returns the canvas' image data as a data + // stream in the desired image format. + void mozFetchAsStream(in nsIInputStreamCallback callback, + [optional] in DOMString type); }; diff --git a/layout/style/TopLevelImageDocument.css b/layout/style/TopLevelImageDocument.css index 9bb5cfa100b..4f6aaffdfd0 100644 --- a/layout/style/TopLevelImageDocument.css +++ b/layout/style/TopLevelImageDocument.css @@ -37,25 +37,27 @@ are top level (e.g. not iframes). */ -body { - background-color: #222; - margin: 0; -} +@media not print { + body { + background-color: #222; + margin: 0; + } -/* We must declare the image as a block element. If we stay as -an inline element, our parent LineBox will be inline too and -ignore the available height during reflow. -This is bad during printing, it means tall image frames won't know -the size of the paper and cannot break into continuations along -multiple pages. */ -img { - color: #eee; - text-align: center; - display: block; - position: absolute; - margin: auto; - top: 0; - right: 0; - bottom: 0; - left: 0; + /* We must declare the image as a block element. If we stay as + an inline element, our parent LineBox will be inline too and + ignore the available height during reflow. + This is bad during printing, it means tall image frames won't know + the size of the paper and cannot break into continuations along + multiple pages. */ + img { + color: #eee; + text-align: center; + display: block; + position: absolute; + margin: auto; + top: 0; + right: 0; + bottom: 0; + left: 0; + } } diff --git a/toolkit/content/WindowDraggingUtils.jsm b/toolkit/content/WindowDraggingUtils.jsm index 2f3d54701d8..51924ce2680 100644 --- a/toolkit/content/WindowDraggingUtils.jsm +++ b/toolkit/content/WindowDraggingUtils.jsm @@ -36,9 +36,9 @@ let EXPORTED_SYMBOLS = [ "WindowDraggingElement" ]; -function WindowDraggingElement(elem, window) { +function WindowDraggingElement(elem) { this._elem = elem; - this._window = window; + this._window = elem.ownerDocument.defaultView; #ifdef XP_WIN if (!this.isPanel()) this._elem.addEventListener("MozMouseHittest", this, false); diff --git a/toolkit/content/widgets/general.xml b/toolkit/content/widgets/general.xml index d6122b3e579..7aaec1ff6ce 100644 --- a/toolkit/content/widgets/general.xml +++ b/toolkit/content/widgets/general.xml @@ -167,7 +167,7 @@ try { let tmp = {}; Components.utils.import("resource://gre/modules/WindowDraggingUtils.jsm", tmp); - let draghandle = new tmp.WindowDraggingElement(this, window); + let draghandle = new tmp.WindowDraggingElement(this); draghandle.mouseDownCheck = function () this._dragBindingAlive; } catch (e) {} } @@ -274,7 +274,7 @@ try { let tmp = {}; Components.utils.import("resource://gre/modules/WindowDraggingUtils.jsm", tmp); - let draghandle = new tmp.WindowDraggingElement(this, window); + let draghandle = new tmp.WindowDraggingElement(this); draghandle.mouseDownCheck = function () this._dragBindingAlive; } catch (e) {} } diff --git a/toolkit/content/widgets/popup.xml b/toolkit/content/widgets/popup.xml index 00bf6e4ebb5..68581a12d50 100644 --- a/toolkit/content/widgets/popup.xml +++ b/toolkit/content/widgets/popup.xml @@ -237,7 +237,7 @@ try { let tmp = {}; Components.utils.import("resource://gre/modules/WindowDraggingUtils.jsm", tmp); - let draghandle = new tmp.WindowDraggingElement(this, window); + let draghandle = new tmp.WindowDraggingElement(this); draghandle.mouseDownCheck = function () this._dragBindingAlive; } catch (e) {} } diff --git a/toolkit/content/widgets/toolbar.xml b/toolkit/content/widgets/toolbar.xml index ae4a27155f4..ad15ac8600e 100644 --- a/toolkit/content/widgets/toolbar.xml +++ b/toolkit/content/widgets/toolbar.xml @@ -486,7 +486,7 @@ try { let tmp = {}; Components.utils.import("resource://gre/modules/WindowDraggingUtils.jsm", tmp); - let draggableThis = new tmp.WindowDraggingElement(this, window); + let draggableThis = new tmp.WindowDraggingElement(this); draggableThis.mouseDownCheck = function(e) { // Don't move while customizing. return this._dragBindingAlive && diff --git a/toolkit/mozapps/extensions/content/extensions.js b/toolkit/mozapps/extensions/content/extensions.js index e2d01807497..019ce164c0e 100644 --- a/toolkit/mozapps/extensions/content/extensions.js +++ b/toolkit/mozapps/extensions/content/extensions.js @@ -1850,8 +1850,7 @@ var gDiscoverView = { } self._browser.homePage = self.homepageURL.spec; - self._browser.addProgressListener(self, Ci.nsIWebProgress.NOTIFY_ALL | - Ci.nsIWebProgress.NOTIFY_STATE_ALL); + self._browser.addProgressListener(self); if (self.loaded) self._loadURL(self.homepageURL.spec, false, notifyInitialized); @@ -1888,6 +1887,15 @@ var gDiscoverView = { }); }, + destroy: function() { + try { + this._browser.removeProgressListener(this); + } + catch (e) { + // Ignore the case when the listener wasn't already registered + } + }, + show: function(aParam, aRequest, aState, aIsRefresh) { gViewController.updateCommands(); @@ -2006,6 +2014,13 @@ var gDiscoverView = { }, onStateChange: function(aWebProgress, aRequest, aStateFlags, aStatus) { + let transferStart = Ci.nsIWebProgressListener.STATE_IS_DOCUMENT | + Ci.nsIWebProgressListener.STATE_IS_REQUEST | + Ci.nsIWebProgressListener.STATE_IS_TRANSFERRING; + // Once transferring begins show the content + if (aStateFlags & transferStart) + this.node.selectedPanel = this._browser; + // Only care about the network events if (!(aStateFlags & (Ci.nsIWebProgressListener.STATE_IS_NETWORK))) return; diff --git a/xpcom/io/nsIAsyncInputStream.idl b/xpcom/io/nsIAsyncInputStream.idl index 99053fd116e..01849de9e26 100644 --- a/xpcom/io/nsIAsyncInputStream.idl +++ b/xpcom/io/nsIAsyncInputStream.idl @@ -124,7 +124,7 @@ interface nsIAsyncInputStream : nsIInputStream /** * This is a companion interface for nsIAsyncInputStream::asyncWait. */ -[scriptable, uuid(d1f28e94-3a6e-4050-a5f5-2e81b1fc2a43)] +[function, scriptable, uuid(d1f28e94-3a6e-4050-a5f5-2e81b1fc2a43)] interface nsIInputStreamCallback : nsISupports { /**