Merge mozilla-central to mozilla-inbound

This commit is contained in:
Ed Morley 2012-02-02 10:54:45 +00:00
commit a2cee55542
19 changed files with 160 additions and 38 deletions

View File

@ -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);

View File

@ -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;
};

View File

@ -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();

View File

@ -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;

View File

@ -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)

View File

@ -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));
}

View File

@ -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)

View File

@ -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");

View File

@ -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;

View File

@ -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<nsIInputStream> inputData;
rv = ExtractData(aType, EmptyString(), getter_AddRefs(inputData), fellBackToPNG);
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIAsyncInputStream> asyncData = do_QueryInterface(inputData, &rv);
NS_ENSURE_SUCCESS(rv, rv);
return aCallback->OnInputStreamReady(asyncData);
}
nsresult
nsHTMLCanvasElement::ExtractData(const nsAString& aType,
const nsAString& aOptions,

View File

@ -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;
}

View File

@ -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);
};

View File

@ -37,6 +37,7 @@
are top level (e.g. not iframes).
*/
@media not print {
body {
background-color: #222;
margin: 0;
@ -59,3 +60,4 @@ img {
bottom: 0;
left: 0;
}
}

View File

@ -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);

View File

@ -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) {}
}

View File

@ -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) {}
}

View File

@ -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 &&

View File

@ -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;

View File

@ -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
{
/**