This commit is contained in:
Tim Taubert 2012-02-02 10:03:01 +01:00
Родитель 1e1d2ead86 4cba787483
Коммит 71edb76c65
10 изменённых файлов: 140 добавлений и 27 удалений

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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