Merge m-c to b2g-inbound

This commit is contained in:
Wes Kocher 2014-05-14 16:34:15 -07:00
commit eee6cd4dda
128 changed files with 1437 additions and 338 deletions

View File

@ -1018,6 +1018,8 @@ pref("browser.sessionstore.restore_pinned_tabs_on_demand", false);
pref("browser.sessionstore.upgradeBackup.latestBuildID", "");
// End-users should not run sessionstore in debug mode
pref("browser.sessionstore.debug", false);
// Forget closed windows/tabs after two weeks
pref("browser.sessionstore.cleanup.forget_closed_after", 1209600000);
// allow META refresh by default
pref("accessibility.blockautorefresh", false);

View File

@ -111,14 +111,20 @@ function restoreSession() {
// restore the session into a new window and close the current tab
var newWindow = top.openDialog(top.location, "_blank", "chrome,dialog=no,all");
newWindow.addEventListener("load", function() {
newWindow.removeEventListener("load", arguments.callee, true);
var obs = Cc["@mozilla.org/observer-service;1"].getService(Ci.nsIObserverService);
obs.addObserver(function observe(win, topic) {
if (win != newWindow) {
return;
}
obs.removeObserver(observe, topic);
ss.setWindowState(newWindow, stateString, true);
var tabbrowser = top.gBrowser;
var tabIndex = tabbrowser.getBrowserIndexForDocument(document);
tabbrowser.removeTab(tabbrowser.tabs[tabIndex]);
}, true);
}, "browser-delayed-startup-finished", false);
}
function startNewSession() {

View File

@ -36,6 +36,7 @@ const OBSERVING = [
"quit-application", "browser:purge-session-history",
"browser:purge-domain-data",
"gather-telemetry",
"idle-daily",
];
// XUL Window properties to (re)store
@ -384,15 +385,14 @@ let SessionStoreInternal = {
* Initialize the session using the state provided by SessionStartup
*/
initSession: function () {
TelemetryStopwatch.start("FX_SESSION_RESTORE_STARTUP_INIT_SESSION_MS");
let state;
let ss = gSessionStartup;
try {
if (ss.doRestore() ||
ss.sessionType == Ci.nsISessionStartup.DEFER_SESSION)
state = ss.state;
if (ss.doRestore() ||
ss.sessionType == Ci.nsISessionStartup.DEFER_SESSION) {
state = ss.state;
}
catch(ex) { dump(ex + "\n"); } // no state to restore, which is ok
if (state) {
try {
@ -466,6 +466,7 @@ let SessionStoreInternal = {
this._performUpgradeBackup();
TelemetryStopwatch.finish("FX_SESSION_RESTORE_STARTUP_INIT_SESSION_MS");
return state;
},
@ -570,6 +571,9 @@ let SessionStoreInternal = {
case "gather-telemetry":
this.onGatherTelemetry();
break;
case "idle-daily":
this.onIdleDaily();
break;
}
},
@ -966,7 +970,10 @@ let SessionStoreInternal = {
} else {
let initialState = this.initSession();
this._sessionInitialized = true;
TelemetryStopwatch.start("FX_SESSION_RESTORE_STARTUP_ONLOAD_INITIAL_WINDOW_MS");
this.onLoad(aWindow, initialState);
TelemetryStopwatch.finish("FX_SESSION_RESTORE_STARTUP_ONLOAD_INITIAL_WINDOW_MS");
// Let everyone know we're done.
this._deferredInitialized.resolve();
@ -1425,6 +1432,39 @@ let SessionStoreInternal = {
return SessionFile.gatherTelemetry(stateString);
},
// Clean up data that has been closed a long time ago.
// Do not reschedule a save. This will wait for the next regular
// save.
onIdleDaily: function() {
// Remove old closed windows
this._cleanupOldData([this._closedWindows]);
// Remove closed tabs of closed windows
this._cleanupOldData([winData._closedTabs for (winData of this._closedWindows)]);
// Remove closed tabs of open windows
this._cleanupOldData([this._windows[key]._closedTabs for (key of Object.keys(this._windows))]);
},
// Remove "old" data from an array
_cleanupOldData: function(targets) {
const TIME_TO_LIVE = this._prefBranch.getIntPref("sessionstore.cleanup.forget_closed_after");
const now = Date.now();
for (let array of targets) {
for (let i = array.length - 1; i >= 0; --i) {
let data = array[i];
// Make sure that we have a timestamp to tell us when the target
// has been closed. If we don't have a timestamp, default to a
// safe timestamp: just now.
data.closedAt = data.closedAt || now;
if (now - data.closedAt > TIME_TO_LIVE) {
array.splice(i, 1);
}
}
}
},
/* ........ nsISessionStore API .............. */
getBrowserState: function ssi_getBrowserState() {
@ -1668,6 +1708,8 @@ let SessionStoreInternal = {
// reopen the window
let state = { windows: this._closedWindows.splice(aIndex, 1) };
delete state.windows[0].closedAt; // Window is now open.
let window = this._openWindowWithState(state);
this.windowToFocus = window;
return window;
@ -2469,6 +2511,7 @@ let SessionStoreInternal = {
} else {
delete tab.__SS_extdata;
}
delete tabData.closedAt; // Tab is now open.
// Flush all data from the content script synchronously. This is done so
// that all async messages that are still on their way to chrome will

View File

@ -57,9 +57,11 @@ support-files =
#disabled-for-intermittent-failures--bug-766044, browser_459906_sample.html
#disabled-for-intermittent-failures--bug-765389, browser_461743_sample.html
[browser_aboutSessionRestore.js]
[browser_attributes.js]
[browser_broadcast.js]
[browser_capabilities.js]
[browser_cleaner.js]
[browser_dying_cache.js]
[browser_dynamic_frames.js]
[browser_form_restore_events.js]

View File

@ -0,0 +1,46 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
const CRASH_SHENTRY = {url: "about:mozilla"};
const CRASH_TAB = {entries: [CRASH_SHENTRY]};
const CRASH_STATE = {windows: [{tabs: [CRASH_TAB]}]};
const TAB_FORMDATA = {id: {sessionData: CRASH_STATE}};
const TAB_SHENTRY = {url: "about:sessionrestore", formdata: TAB_FORMDATA};
const TAB_STATE = {entries: [TAB_SHENTRY]};
const FRAME_SCRIPT = "data:," +
"content.document.getElementById('errorTryAgain').click()";
add_task(function* () {
// Prepare a blank tab.
let tab = gBrowser.addTab("about:blank");
let browser = tab.linkedBrowser;
yield promiseBrowserLoaded(browser);
// Fake a post-crash tab.
ss.setTabState(tab, JSON.stringify(TAB_STATE));
yield promiseTabRestored(tab);
ok(gBrowser.tabs.length > 1, "we have more than one tab");
browser.messageManager.loadFrameScript(FRAME_SCRIPT, true);
// Wait until the new window was restored.
let win = yield waitForNewWindow();
yield promiseWindowClosed(win);
let [{tabs: [{entries: [{url}]}]}] = JSON.parse(ss.getClosedWindowData());
is(url, "about:mozilla", "session was restored correctly");
ss.forgetClosedWindow(0);
});
function waitForNewWindow() {
return new Promise(resolve => {
Services.obs.addObserver(function observe(win, topic) {
Services.obs.removeObserver(observe, topic);
resolve(win);
}, "browser-delayed-startup-finished", false);
});
}

View File

@ -0,0 +1,160 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
/*
* This test ensures that Session Restore eventually forgets about
* tabs and windows that have been closed a long time ago.
*/
"use strict";
Cu.import("resource://gre/modules/Services.jsm", this);
Cu.import("resource://gre/modules/osfile.jsm", this);
Cu.import("resource://gre/modules/Task.jsm", this);
const LONG_TIME_AGO = 1;
const URL_TAB1 = "http://example.com/browser_cleaner.js?newtab1=" + Math.random();
const URL_TAB2 = "http://example.com/browser_cleaner.js?newtab2=" + Math.random();
const URL_NEWWIN = "http://example.com/browser_cleaner.js?newwin=" + Math.random();
function isRecent(stamp) {
is(typeof stamp, "number", "This is a timestamp");
return Date.now() - stamp <= 60000;
}
function promiseCleanup () {
info("Cleaning up browser");
return promiseBrowserState(getClosedState());
};
function getClosedState() {
return Cu.cloneInto(CLOSED_STATE, {});
}
let CLOSED_STATE;
add_task(function* init() {
while (ss.getClosedWindowCount() > 0) {
ss.forgetClosedWindow(0);
}
while (ss.getClosedTabCount(window) > 0) {
ss.forgetClosedTab(window, 0);
}
});
add_task(function* test_open_and_close() {
let newTab1 = gBrowser.addTab(URL_TAB1);
yield promiseBrowserLoaded(newTab1.linkedBrowser);
let newTab2 = gBrowser.addTab(URL_TAB2);
yield promiseBrowserLoaded(newTab2.linkedBrowser);
let newWin = yield promiseNewWindowLoaded();
let tab = newWin.gBrowser.addTab(URL_NEWWIN);
yield promiseBrowserLoaded(tab.linkedBrowser);
info("1. Making sure that before closing, we don't have closedAt");
// For the moment, no "closedAt"
let state = JSON.parse(ss.getBrowserState());
is(state.windows[0].closedAt || false, false, "1. Main window doesn't have closedAt");
is(state.windows[1].closedAt || false, false, "1. Second window doesn't have closedAt");
is(state.windows[0].tabs[0].closedAt || false, false, "1. First tab doesn't have closedAt");
is(state.windows[0].tabs[1].closedAt || false, false, "1. Second tab doesn't have closedAt");
info("2. Making sure that after closing, we have closedAt");
// Now close stuff, this should add closeAt
yield promiseWindowClosed(newWin);
gBrowser.removeTab(newTab1);
gBrowser.removeTab(newTab2);
state = CLOSED_STATE = JSON.parse(ss.getBrowserState());
is(state.windows[0].closedAt || false, false, "2. Main window doesn't have closedAt");
ok(isRecent(state._closedWindows[0].closedAt), "2. Second window was closed recently");
ok(isRecent(state.windows[0]._closedTabs[0].closedAt), "2. First tab was closed recently");
ok(isRecent(state.windows[0]._closedTabs[1].closedAt), "2. Second tab was closed recently");
});
add_task(function* test_restore() {
info("3. Making sure that after restoring, we don't have closedAt");
yield promiseBrowserState(CLOSED_STATE);
let newWin = ss.undoCloseWindow(0);
yield promiseDelayedStartupFinished(newWin);
let newTab2 = ss.undoCloseTab(window, 0);
yield promiseTabRestored(newTab2);
let newTab1 = ss.undoCloseTab(window, 0);
yield promiseTabRestored(newTab1);
let state = JSON.parse(ss.getBrowserState());
is(state.windows[0].closedAt || false, false, "3. Main window doesn't have closedAt");
is(state.windows[1].closedAt || false, false, "3. Second window doesn't have closedAt");
is(state.windows[0].tabs[0].closedAt || false, false, "3. First tab doesn't have closedAt");
is(state.windows[0].tabs[1].closedAt || false, false, "3. Second tab doesn't have closedAt");
yield promiseWindowClosed(newWin);
gBrowser.removeTab(newTab1);
gBrowser.removeTab(newTab2);
});
add_task(function* test_old_data() {
info("4. Removing closedAt from the sessionstore, making sure that it is added upon idle-daily");
let state = getClosedState();
delete state._closedWindows[0].closedAt;
delete state.windows[0]._closedTabs[0].closedAt;
delete state.windows[0]._closedTabs[1].closedAt;
yield promiseBrowserState(state);
info("Sending idle-daily");
Services.obs.notifyObservers(null, "idle-daily", "");
info("Sent idle-daily");
state = JSON.parse(ss.getBrowserState());
is(state.windows[0].closedAt || false, false, "4. Main window doesn't have closedAt");
ok(isRecent(state._closedWindows[0].closedAt), "4. Second window was closed recently");
ok(isRecent(state.windows[0]._closedTabs[0].closedAt), "4. First tab was closed recently");
ok(isRecent(state.windows[0]._closedTabs[1].closedAt), "4. Second tab was closed recently");
yield promiseCleanup();
});
add_task(function* test_cleanup() {
info("5. Altering closedAt to an old date, making sure that stuff gets collected, eventually");
yield promiseCleanup();
let state = getClosedState();
state._closedWindows[0].closedAt = LONG_TIME_AGO;
state.windows[0]._closedTabs[0].closedAt = LONG_TIME_AGO;
state.windows[0]._closedTabs[1].closedAt = Date.now();
let url = state.windows[0]._closedTabs[1].state.entries[0].url;
yield promiseBrowserState(state);
info("Sending idle-daily");
Services.obs.notifyObservers(null, "idle-daily", "");
info("Sent idle-daily");
state = JSON.parse(ss.getBrowserState());
is(state._closedWindows[0], undefined, "5. Second window was forgotten");
is(state.windows[0]._closedTabs.length, 1, "5. Only one closed tab left");
is(state.windows[0]._closedTabs[0].state.entries[0].url, url, "5. The second tab is still here");
yield promiseCleanup();
});

View File

@ -88,6 +88,12 @@ function provideWindow(aCallback, aURL, aFeatures) {
// This assumes that tests will at least have some state/entries
function waitForBrowserState(aState, aSetStateCallback) {
if (typeof aState == "string") {
aState = JSON.parse(aState);
}
if (typeof aState != "object") {
throw new TypeError("Argument must be an object or a JSON representation of an object");
}
let windows = [window];
let tabsRestored = 0;
let expectedTabsRestored = 0;
@ -172,6 +178,10 @@ function waitForBrowserState(aState, aSetStateCallback) {
ss.setBrowserState(JSON.stringify(aState));
}
function promiseBrowserState(aState) {
return new Promise(resolve => waitForBrowserState(aState, resolve));
}
// Doesn't assume that the tab needs to be closed in a cleanup function.
// If that's the case, the test author should handle that in the test.
function waitForTabState(aTab, aState, aCallback) {
@ -481,6 +491,9 @@ function whenDelayedStartupFinished(aWindow, aCallback) {
}
}, "browser-delayed-startup-finished", false);
}
function promiseDelayedStartupFinished(aWindow) {
return new Promise((resolve) => whenDelayedStartupFinished(aWindow, resolve));
}
/**
* The test runner that controls the execution flow of our tests.

View File

@ -26,6 +26,11 @@
min-height: 18px;
}
#downloads-button[cui-areatype="toolbar"] > #downloads-indicator-anchor > #downloads-indicator-icon:-moz-lwtheme-brighttext {
background: -moz-image-rect(url("chrome://browser/skin/Toolbar-inverted.png"),
0, 198, 18, 180) center no-repeat;
}
#downloads-button[cui-areatype="toolbar"][attention] > #downloads-indicator-anchor > #downloads-indicator-icon {
background-image: url("chrome://browser/skin/downloads/download-glow.png");
}
@ -44,6 +49,11 @@
background-size: 12px;
}
#downloads-button:not([counter]) > #downloads-indicator-anchor >
#downloads-button-progress-area > #downloads-indicator-counter:-moz-lwtheme-brighttext {
background-image: -moz-image-rect(url("chrome://browser/skin/Toolbar-inverted.png"), 0, 198, 18, 180);
}
#downloads-button:not([counter])[attention] > #downloads-indicator-anchor > #downloads-indicator-progress-area > #downloads-indicator-counter {
background-image: url("chrome://browser/skin/downloads/download-glow.png");
}
@ -105,6 +115,12 @@
text-align: center;
}
#downloads-indicator-counter:-moz-lwtheme-brighttext {
color: white;
text-shadow: 0 0 1px rgba(0,0,0,.7),
0 1px 1.5px rgba(0,0,0,.5);
}
#downloads-indicator-progress {
width: 18px;
height: 6px;

View File

@ -2547,7 +2547,7 @@ AC_LANG_C
dnl Check for .hidden assembler directive and visibility attribute.
dnl Borrowed from glibc configure.in
dnl ===============================================================
if test "$GNU_CC"; then
if test "$GNU_CC" -a "$OS_TARGET" != WINNT; then
AC_DEFINE(HAVE_VISIBILITY_HIDDEN_ATTRIBUTE)
AC_DEFINE(HAVE_VISIBILITY_ATTRIBUTE)
if test -n "$gonkdir"; then
@ -5806,6 +5806,11 @@ if test -n "$MOZ_ANGLE_RENDERER"; then
MOZ_D3DCOMPILER_VISTA_DLL=
fi
# On mingw, check if headers are provided by toolchain.
if test -n "$GNU_CC"; then
MOZ_CHECK_HEADER(d3d10.h, MOZ_HAS_WINSDK_WITH_D3D=1)
fi
######################################
# Find _43 for use by XP.

View File

@ -10,6 +10,7 @@
#include "mozilla/DOMEventTargetHelper.h"
#include "mozilla/dom/EventSourceBinding.h"
#include "mozilla/dom/MessageEvent.h"
#include "mozilla/dom/ScriptSettings.h"
#include "js/OldDebugAPI.h"
#include "nsNetUtil.h"
@ -29,7 +30,6 @@
#include "nsIChannelPolicy.h"
#include "nsIContentSecurityPolicy.h"
#include "nsContentUtils.h"
#include "nsCxPusher.h"
#include "mozilla/Preferences.h"
#include "xpcpublic.h"
#include "nsCrossSiteListenerProxy.h"
@ -1236,15 +1236,15 @@ EventSource::DispatchAllMessageEvents()
return;
}
// Let's play get the JSContext
nsCOMPtr<nsIScriptGlobalObject> sgo = do_QueryInterface(GetOwner());
NS_ENSURE_TRUE_VOID(sgo);
// We need a parent object so that we can enter its compartment.
nsCOMPtr<nsIGlobalObject> parentObject = do_QueryInterface(GetParentObject());
if (NS_WARN_IF(!parentObject)) {
return;
}
nsIScriptContext* scriptContext = sgo->GetContext();
NS_ENSURE_TRUE_VOID(scriptContext);
AutoPushJSContext cx(scriptContext->GetNativeContext());
NS_ENSURE_TRUE_VOID(cx);
AutoJSAPI jsapi;
JSContext* cx = jsapi.cx();
JSAutoCompartment ac(cx, parentObject->GetGlobalJSObject());
while (mMessagesToDispatch.GetSize() > 0) {
nsAutoPtr<Message>

View File

@ -33,7 +33,6 @@
#include "nsIDOMApplicationRegistry.h"
#include "nsIBaseWindow.h"
#include "nsContentUtils.h"
#include "nsCxPusher.h"
#include "nsIXPConnect.h"
#include "nsUnicharUtils.h"
#include "nsIScriptGlobalObject.h"
@ -2423,12 +2422,6 @@ nsFrameLoader::EnsureMessageManager()
return NS_OK;
}
nsIScriptContext* sctx = mOwnerContent->GetContextForEventHandlers(&rv);
NS_ENSURE_SUCCESS(rv, rv);
NS_ENSURE_STATE(sctx);
AutoPushJSContext cx(sctx->GetNativeContext());
NS_ENSURE_STATE(cx);
nsCOMPtr<nsIDOMChromeWindow> chromeWindow =
do_QueryInterface(GetOwnerDoc()->GetWindow());
nsCOMPtr<nsIMessageBroadcaster> parentManager;

View File

@ -4286,16 +4286,18 @@ CanvasRenderingContext2D::ShouldForceInactiveLayer(LayerManager *aManager)
NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(CanvasPath, AddRef)
NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(CanvasPath, Release)
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_0(CanvasPath)
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(CanvasPath, mParent)
CanvasPath::CanvasPath(nsCOMPtr<nsISupports> aParent) : mParent(aParent)
CanvasPath::CanvasPath(nsISupports* aParent)
: mParent(aParent)
{
SetIsDOMBinding();
mPathBuilder = gfxPlatform::GetPlatform()->ScreenReferenceDrawTarget()->CreatePathBuilder();
}
CanvasPath::CanvasPath(nsCOMPtr<nsISupports> aParent, RefPtr<PathBuilder> aPathBuilder): mParent(aParent), mPathBuilder(aPathBuilder)
CanvasPath::CanvasPath(nsISupports* aParent, RefPtr<PathBuilder> aPathBuilder)
: mParent(aParent), mPathBuilder(aPathBuilder)
{
SetIsDOMBinding();

View File

@ -46,7 +46,7 @@ extern const mozilla::gfx::Float SIGMA_MAX;
template<typename T> class Optional;
class CanvasPath :
class CanvasPath MOZ_FINAL :
public nsWrapperCache
{
public:
@ -88,8 +88,8 @@ public:
mozilla::RefPtr<mozilla::gfx::Path> GetPath(const CanvasWindingRule& winding,
const mozilla::RefPtr<mozilla::gfx::DrawTarget>& mTarget) const;
CanvasPath(nsCOMPtr<nsISupports> aParent);
CanvasPath(nsCOMPtr<nsISupports> aParent, RefPtr<gfx::PathBuilder> mPathBuilder);
explicit CanvasPath(nsISupports* aParent);
CanvasPath(nsISupports* aParent, RefPtr<gfx::PathBuilder> mPathBuilder);
virtual ~CanvasPath() {}
private:

View File

@ -383,4 +383,8 @@ function runTests() {
addLoadEvent(runTests);
// Don't leak the world via the Path2D reference to its window.
document.all;
window.p = new Path2D();
</script>

View File

@ -426,7 +426,7 @@ protected:
NS_IMETHOD Run() MOZ_OVERRIDE
{
static_cast<HTMLFormElement*>(mEventNode.get())->EventHandled();
static_cast<HTMLFormElement*>(mTarget.get())->EventHandled();
return AsyncEventDispatcher::Run();
}
};

View File

@ -166,8 +166,7 @@ AudioBuffer::CopyToChannel(JSContext* aJSContext, const Float32Array& aSource,
}
void
AudioBuffer::SetRawChannelContents(JSContext* aJSContext, uint32_t aChannel,
float* aContents)
AudioBuffer::SetRawChannelContents(uint32_t aChannel, float* aContents)
{
PodCopy(JS_GetFloat32ArrayData(mJSChannels[aChannel]), aContents, mLength);
}

View File

@ -97,9 +97,7 @@ public:
// This function needs to be called on an AudioBuffer which has not been
// handed off to the content yet, and right after the object has been
// initialized.
void SetRawChannelContents(JSContext* aJSContext,
uint32_t aChannel,
float* aContents);
void SetRawChannelContents(uint32_t aChannel, float* aContents);
protected:
bool RestoreJSChannelData(JSContext* aJSContext);

View File

@ -590,21 +590,16 @@ AudioContext::UpdateNodeCount(int32_t aDelta)
}
}
JSContext*
AudioContext::GetJSContext() const
JSObject*
AudioContext::GetGlobalJSObject() const
{
MOZ_ASSERT(NS_IsMainThread());
nsCOMPtr<nsIGlobalObject> parentObject = do_QueryInterface(GetParentObject());
if (!parentObject) {
return nullptr;
}
nsCOMPtr<nsIScriptGlobalObject> scriptGlobal =
do_QueryInterface(GetParentObject());
if (!scriptGlobal) {
return nullptr;
}
nsIScriptContext* scriptContext = scriptGlobal->GetContext();
if (!scriptContext) {
return nullptr;
}
return scriptContext->GetNativeContext();
// This can also return null.
return parentObject->GetGlobalJSObject();
}
void

View File

@ -219,7 +219,7 @@ public:
void Mute() const;
void Unmute() const;
JSContext* GetJSContext() const;
JSObject* GetGlobalJSObject() const;
AudioChannel MozAudioChannelType() const;
void SetMozAudioChannelType(AudioChannel aValue, ErrorResult& aRv);

View File

@ -6,6 +6,7 @@
#include "AudioDestinationNode.h"
#include "mozilla/dom/AudioDestinationNodeBinding.h"
#include "mozilla/dom/ScriptSettings.h"
#include "mozilla/Preferences.h"
#include "mozilla/Services.h"
#include "AudioChannelAgent.h"
@ -125,11 +126,15 @@ public:
// which is strongly referenced by the runnable that called
// AudioDestinationNode::FireOfflineCompletionEvent.
AutoPushJSContext cx(context->GetJSContext());
if (!cx) {
// We need the global for the context so that we can enter its compartment.
JSObject* global = context->GetGlobalJSObject();
if (NS_WARN_IF(!global)) {
return;
}
JSAutoRequest ar(cx);
AutoJSAPI jsapi;
JSContext* cx = jsapi.cx();
JSAutoCompartment ac(cx, global);
// Create the input buffer
nsRefPtr<AudioBuffer> renderedBuffer = new AudioBuffer(context,
@ -139,7 +144,7 @@ public:
return;
}
for (uint32_t i = 0; i < mInputChannels.Length(); ++i) {
renderedBuffer->SetRawChannelContents(cx, i, mInputChannels[i]);
renderedBuffer->SetRawChannelContents(i, mInputChannels[i]);
}
nsRefPtr<OfflineAudioCompletionEvent> event =

View File

@ -6,6 +6,7 @@
#include "AudioProcessingEvent.h"
#include "mozilla/dom/AudioProcessingEventBinding.h"
#include "mozilla/dom/ScriptSettings.h"
#include "AudioContext.h"
namespace mozilla {
@ -40,7 +41,15 @@ void
AudioProcessingEvent::LazilyCreateBuffer(nsRefPtr<AudioBuffer>& aBuffer,
uint32_t aNumberOfChannels)
{
AutoPushJSContext cx(mNode->Context()->GetJSContext());
// We need the global for the context so that we can enter its compartment.
JSObject* global = mNode->Context()->GetGlobalJSObject();
if (NS_WARN_IF(!global)) {
return;
}
AutoJSAPI jsapi;
JSContext* cx = jsapi.cx();
JSAutoCompartment ac(cx, global);
aBuffer = new AudioBuffer(mNode->Context(), mNode->BufferSize(),
mNode->Context()->SampleRate());

View File

@ -7,6 +7,7 @@
#include "MediaBufferDecoder.h"
#include "BufferDecoder.h"
#include "mozilla/dom/AudioContextBinding.h"
#include "mozilla/dom/ScriptSettings.h"
#include <speex/speex_resampler.h>
#include "nsXPCOMCIDInternal.h"
#include "nsComponentManagerUtils.h"
@ -18,7 +19,6 @@
#include "nsIScriptObjectPrincipal.h"
#include "nsIScriptError.h"
#include "nsMimeTypes.h"
#include "nsCxPusher.h"
#include "WebAudioUtils.h"
namespace mozilla {
@ -402,12 +402,16 @@ WebAudioDecodeJob::AllocateBuffer()
MOZ_ASSERT(!mOutput);
MOZ_ASSERT(NS_IsMainThread());
// First, get a JSContext
AutoPushJSContext cx(mContext->GetJSContext());
if (!cx) {
// We need the global for the context so that we can enter its compartment.
JSObject* global = mContext->GetGlobalJSObject();
if (NS_WARN_IF(!global)) {
return false;
}
AutoJSAPI jsapi;
JSContext* cx = jsapi.cx();
JSAutoCompartment ac(cx, global);
// Now create the AudioBuffer
mOutput = new AudioBuffer(mContext, mWriteIndex, mContext->SampleRate());
if (!mOutput->InitializeBuffers(mChannelBuffers.Length(), cx)) {
@ -415,7 +419,7 @@ WebAudioDecodeJob::AllocateBuffer()
}
for (uint32_t i = 0; i < mChannelBuffers.Length(); ++i) {
mOutput->SetRawChannelContents(cx, i, mChannelBuffers[i]);
mOutput->SetRawChannelContents(i, mChannelBuffers[i]);
}
return true;

View File

@ -12,7 +12,7 @@
#include "AudioNodeStream.h"
#include "AudioProcessingEvent.h"
#include "WebAudioUtils.h"
#include "nsCxPusher.h"
#include "mozilla/dom/ScriptSettings.h"
#include "mozilla/Mutex.h"
#include "mozilla/PodOperations.h"
#include <deque>
@ -402,44 +402,51 @@ private:
return NS_OK;
}
AutoPushJSContext cx(node->Context()->GetJSContext());
if (cx) {
// Create the input buffer
nsRefPtr<AudioBuffer> inputBuffer;
if (!mNullInput) {
inputBuffer = new AudioBuffer(node->Context(),
node->BufferSize(),
node->Context()->SampleRate());
if (!inputBuffer->InitializeBuffers(mInputChannels.Length(), cx)) {
return NS_OK;
}
// Put the channel data inside it
for (uint32_t i = 0; i < mInputChannels.Length(); ++i) {
inputBuffer->SetRawChannelContents(cx, i, mInputChannels[i]);
}
}
// Ask content to produce data in the output buffer
// Note that we always avoid creating the output buffer here, and we try to
// avoid creating the input buffer as well. The AudioProcessingEvent class
// knows how to lazily create them if needed once the script tries to access
// them. Otherwise, we may be able to get away without creating them!
nsRefPtr<AudioProcessingEvent> event = new AudioProcessingEvent(node, nullptr, nullptr);
event->InitEvent(inputBuffer,
mInputChannels.Length(),
mPlaybackTime);
node->DispatchTrustedEvent(event);
// Steal the output buffers
nsRefPtr<ThreadSharedFloatArrayBufferList> output;
if (event->HasOutputBuffer()) {
output = event->OutputBuffer()->GetThreadSharedChannelsForRate(cx);
}
// Append it to our output buffer queue
node->GetSharedBuffers()->FinishProducingOutputBuffer(output, node->BufferSize());
// Get the global for the context so that we can enter its compartment.
JSObject* global = node->Context()->GetGlobalJSObject();
if (NS_WARN_IF(!global)) {
return NS_OK;
}
AutoJSAPI jsapi;
JSContext* cx = jsapi.cx();
JSAutoCompartment ac(cx, global);
// Create the input buffer
nsRefPtr<AudioBuffer> inputBuffer;
if (!mNullInput) {
inputBuffer = new AudioBuffer(node->Context(),
node->BufferSize(),
node->Context()->SampleRate());
if (!inputBuffer->InitializeBuffers(mInputChannels.Length(), cx)) {
return NS_OK;
}
// Put the channel data inside it
for (uint32_t i = 0; i < mInputChannels.Length(); ++i) {
inputBuffer->SetRawChannelContents(i, mInputChannels[i]);
}
}
// Ask content to produce data in the output buffer
// Note that we always avoid creating the output buffer here, and we try to
// avoid creating the input buffer as well. The AudioProcessingEvent class
// knows how to lazily create them if needed once the script tries to access
// them. Otherwise, we may be able to get away without creating them!
nsRefPtr<AudioProcessingEvent> event = new AudioProcessingEvent(node, nullptr, nullptr);
event->InitEvent(inputBuffer,
mInputChannels.Length(),
mPlaybackTime);
node->DispatchTrustedEvent(event);
// Steal the output buffers
nsRefPtr<ThreadSharedFloatArrayBufferList> output;
if (event->HasOutputBuffer()) {
output = event->OutputBuffer()->GetThreadSharedChannelsForRate(cx);
}
// Append it to our output buffer queue
node->GetSharedBuffers()->FinishProducingOutputBuffer(output, node->BufferSize());
return NS_OK;
}
private:

View File

@ -577,7 +577,7 @@ nsDOMWindowUtils::GetResolution(float* aXResolution, float* aYResolution)
}
NS_IMETHODIMP
nsDOMWindowUtils::GetIsHistoryRestored(bool* aIsHistoryRestored) {
nsDOMWindowUtils::GetIsResolutionSet(bool* aIsResolutionSet) {
if (!nsContentUtils::IsCallerChrome()) {
return NS_ERROR_DOM_SECURITY_ERR;
}
@ -588,7 +588,7 @@ nsDOMWindowUtils::GetIsHistoryRestored(bool* aIsHistoryRestored) {
}
const nsIScrollableFrame* sf = presShell->GetRootScrollFrameAsScrollable();
*aIsHistoryRestored = sf && sf->DidHistoryRestore();
*aIsResolutionSet = sf && sf->IsResolutionSet();
return NS_OK;
}

View File

@ -13452,12 +13452,6 @@ nsGlobalWindow::GetMessageManager(ErrorResult& aError)
MOZ_ASSERT(IsChromeWindow());
nsGlobalChromeWindow* myself = static_cast<nsGlobalChromeWindow*>(this);
if (!myself->mMessageManager) {
nsIScriptContext* scx = GetContextInternal();
if (NS_WARN_IF(!scx || !(scx->GetNativeContext()))) {
aError.Throw(NS_ERROR_UNEXPECTED);
return nullptr;
}
nsCOMPtr<nsIMessageBroadcaster> globalMM =
do_GetService("@mozilla.org/globalmessagemanager;1");
myself->mMessageManager =

View File

@ -19,13 +19,13 @@ using namespace dom;
* mozilla::AsyncEventDispatcher
******************************************************************************/
AsyncEventDispatcher::AsyncEventDispatcher(nsINode* aEventNode,
AsyncEventDispatcher::AsyncEventDispatcher(EventTarget* aTarget,
WidgetEvent& aEvent)
: mEventNode(aEventNode)
: mTarget(aTarget)
, mDispatchChromeOnly(false)
{
MOZ_ASSERT(mEventNode);
EventDispatcher::CreateEvent(aEventNode, nullptr, &aEvent, EmptyString(),
MOZ_ASSERT(mTarget);
EventDispatcher::CreateEvent(aTarget, nullptr, &aEvent, EmptyString(),
getter_AddRefs(mEvent));
NS_ASSERTION(mEvent, "Should never fail to create an event");
mEvent->DuplicatePrivateData();
@ -39,8 +39,9 @@ AsyncEventDispatcher::Run()
if (mDispatchChromeOnly) {
MOZ_ASSERT(mEvent->InternalDOMEvent()->IsTrusted());
nsCOMPtr<nsIDocument> ownerDoc = mEventNode->OwnerDoc();
nsPIDOMWindow* window = ownerDoc->GetWindow();
nsCOMPtr<nsINode> node = do_QueryInterface(mTarget);
MOZ_ASSERT(node, "ChromeOnly dispatch supported with Node targets only!");
nsPIDOMWindow* window = node->OwnerDoc()->GetWindow();
if (!window) {
return NS_ERROR_INVALID_ARG;
}
@ -52,18 +53,23 @@ AsyncEventDispatcher::Run()
EventDispatcher::DispatchDOMEvent(target, nullptr, mEvent,
nullptr, nullptr);
} else {
nsCOMPtr<EventTarget> target = mEventNode.get();
bool defaultActionEnabled; // This is not used because the caller is async
target->DispatchEvent(mEvent, &defaultActionEnabled);
mTarget->DispatchEvent(mEvent, &defaultActionEnabled);
}
} else {
nsIDocument* doc = mEventNode->OwnerDoc();
if (mDispatchChromeOnly) {
nsContentUtils::DispatchChromeEvent(doc, mEventNode, mEventType,
nsCOMPtr<nsINode> node = do_QueryInterface(mTarget);
MOZ_ASSERT(node, "ChromeOnly dispatch supported with Node targets only!");
nsContentUtils::DispatchChromeEvent(node->OwnerDoc(), node, mEventType,
mBubbles, false);
} else {
nsContentUtils::DispatchTrustedEvent(doc, mEventNode, mEventType,
mBubbles, false);
nsCOMPtr<nsIDOMEvent> event;
NS_NewDOMEvent(getter_AddRefs(event), mTarget, nullptr, nullptr);
nsresult rv = event->InitEvent(mEventType, mBubbles, false);
NS_ENSURE_SUCCESS(rv, rv);
event->SetTrusted(true);
bool dummy;
mTarget->DispatchEvent(event, &dummy);
}
}
@ -73,12 +79,14 @@ AsyncEventDispatcher::Run()
nsresult
AsyncEventDispatcher::PostDOMEvent()
{
nsRefPtr<AsyncEventDispatcher> ensureDeletionWhenFailing = this;
return NS_DispatchToCurrentThread(this);
}
void
AsyncEventDispatcher::RunDOMEventWhenSafe()
{
nsRefPtr<AsyncEventDispatcher> ensureDeletionWhenFailing = this;
nsContentUtils::AddScriptRunner(this);
}

View File

@ -26,29 +26,38 @@ namespace mozilla {
class AsyncEventDispatcher : public nsRunnable
{
public:
AsyncEventDispatcher(nsINode* aEventNode, const nsAString& aEventType,
AsyncEventDispatcher(nsINode* aTarget, const nsAString& aEventType,
bool aBubbles, bool aDispatchChromeOnly)
: mEventNode(aEventNode)
: mTarget(aTarget)
, mEventType(aEventType)
, mBubbles(aBubbles)
, mDispatchChromeOnly(aDispatchChromeOnly)
{
}
AsyncEventDispatcher(nsINode* aEventNode, nsIDOMEvent* aEvent)
: mEventNode(aEventNode)
AsyncEventDispatcher(dom::EventTarget* aTarget, const nsAString& aEventType,
bool aBubbles)
: mTarget(aTarget)
, mEventType(aEventType)
, mBubbles(aBubbles)
, mDispatchChromeOnly(false)
{
}
AsyncEventDispatcher(dom::EventTarget* aTarget, nsIDOMEvent* aEvent)
: mTarget(aTarget)
, mEvent(aEvent)
, mDispatchChromeOnly(false)
{
}
AsyncEventDispatcher(nsINode* aEventNode, WidgetEvent& aEvent);
AsyncEventDispatcher(dom::EventTarget* aTarget, WidgetEvent& aEvent);
NS_IMETHOD Run() MOZ_OVERRIDE;
nsresult PostDOMEvent();
void RunDOMEventWhenSafe();
nsCOMPtr<nsINode> mEventNode;
nsCOMPtr<dom::EventTarget> mTarget;
nsCOMPtr<nsIDOMEvent> mEvent;
nsString mEventType;
bool mBubbles;

View File

@ -48,7 +48,7 @@ interface nsIRunnable;
interface nsICompositionStringSynthesizer;
interface nsITranslationNodeList;
[scriptable, uuid(8489681a-7407-457e-b889-53d1ae999b30)]
[scriptable, uuid(aae2d993-366f-43e6-aa51-f2eb83935e7d)]
interface nsIDOMWindowUtils : nsISupports {
/**
@ -231,13 +231,13 @@ interface nsIDOMWindowUtils : nsISupports {
void getResolution(out float aXResolution, out float aYResolution);
/**
* Whether the current window has been restored from session history.
* This gives a way to check whether the provided resolution and scroll
* position are default values or restored from a previous session.
* Whether the resolution has been set by the user.
* This gives a way to check whether the provided resolution is the default
* value or restored from a previous session.
*
* Can only be accessed with chrome privileges.
*/
readonly attribute boolean isHistoryRestored;
readonly attribute boolean isResolutionSet;
/**
* Whether the next paint should be flagged as the first paint for a document.

View File

@ -501,6 +501,11 @@ nsTArray<ContentParent*>* ContentParent::sNonAppContentParents;
nsTArray<ContentParent*>* ContentParent::sPrivateContent;
StaticAutoPtr<LinkedList<ContentParent> > ContentParent::sContentParents;
#ifdef MOZ_NUWA_PROCESS
// The pref updates sent to the Nuwa process.
static nsTArray<PrefSetting>* sNuwaPrefUpdates;
#endif
// This is true when subprocess launching is enabled. This is the
// case between StartUp() and ShutDown() or JoinAllSubprocesses().
static bool sCanLaunchSubprocesses;
@ -1325,6 +1330,14 @@ ContentParent::ActorDestroy(ActorDestroyReason why)
// remove the global remote preferences observers
Preferences::RemoveObserver(this, "");
#ifdef MOZ_NUWA_PROCESS
// Remove the pref update requests.
if (IsNuwaProcess() && sNuwaPrefUpdates) {
delete sNuwaPrefUpdates;
sNuwaPrefUpdates = nullptr;
}
#endif
RecvRemoveGeolocationListener();
mConsoleService = nullptr;
@ -2115,6 +2128,13 @@ ContentParent::RecvAddNewProcess(const uint32_t& aPid,
aPid,
aFds);
content->Init();
size_t numNuwaPrefUpdates = sNuwaPrefUpdates ?
sNuwaPrefUpdates->Length() : 0;
// Resend pref updates to the forked child.
for (int i = 0; i < numNuwaPrefUpdates; i++) {
content->SendPreferenceUpdate(sNuwaPrefUpdates->ElementAt(i));
}
PreallocatedProcessManager::PublishSpareProcess(content);
return true;
#else
@ -2162,9 +2182,22 @@ ContentParent::Observe(nsISupports* aSubject,
PrefSetting pref(strData, null_t(), null_t());
Preferences::GetPreference(&pref);
#ifdef MOZ_NUWA_PROCESS
if (IsNuwaProcess() && PreallocatedProcessManager::IsNuwaReady()) {
// Don't send the pref update to the Nuwa process. Save the update
// to send to the forked child.
if (!sNuwaPrefUpdates) {
sNuwaPrefUpdates = new nsTArray<PrefSetting>();
}
sNuwaPrefUpdates->AppendElement(pref);
} else if (!SendPreferenceUpdate(pref)) {
return NS_ERROR_NOT_AVAILABLE;
}
#else
if (!SendPreferenceUpdate(pref)) {
return NS_ERROR_NOT_AVAILABLE;
}
#endif
}
else if (!strcmp(aTopic, NS_IPC_IOSERVICE_SET_OFFLINE_TOPIC)) {
NS_ConvertUTF16toUTF8 dataStr(aData);

View File

@ -54,6 +54,7 @@ public:
void DelayedNuwaFork();
void PublishSpareProcess(ContentParent* aContent);
void MaybeForgetSpare(ContentParent* aContent);
bool IsNuwaReady();
void OnNuwaReady();
bool PreallocatedProcessReady();
already_AddRefed<ContentParent> GetSpareProcess();
@ -340,6 +341,12 @@ PreallocatedProcessManagerImpl::MaybeForgetSpare(ContentParent* aContent)
}
}
bool
PreallocatedProcessManagerImpl::IsNuwaReady()
{
return mIsNuwaReady;
}
void
PreallocatedProcessManagerImpl::OnNuwaReady()
{
@ -482,6 +489,12 @@ PreallocatedProcessManager::OnNuwaReady()
GetPPMImpl()->OnNuwaReady();
}
/* static */ bool
PreallocatedProcessManager::IsNuwaReady()
{
return GetPPMImpl()->IsNuwaReady();
}
/*static */ bool
PreallocatedProcessManager::PreallocatedProcessReady()
{

View File

@ -83,6 +83,7 @@ public:
#ifdef MOZ_NUWA_PROCESS
static void PublishSpareProcess(ContentParent* aContent);
static void MaybeForgetSpare(ContentParent* aContent);
static bool IsNuwaReady();
static void OnNuwaReady();
static bool PreallocatedProcessReady();
static void RunAfterPreallocatedProcessReady(nsIRunnable* aRunnable);

View File

@ -2093,7 +2093,7 @@ MOZ_CXX11
dnl Check for .hidden assembler directive and visibility attribute.
dnl Borrowed from glibc configure.in
dnl ===============================================================
if test "$GNU_CC"; then
if test "$GNU_CC" -a "$OS_TARGET" != WINNT; then
AC_DEFINE(HAVE_VISIBILITY_HIDDEN_ATTRIBUTE)
AC_DEFINE(HAVE_VISIBILITY_ATTRIBUTE)
if test -n "$gonkdir"; then

View File

@ -2,7 +2,7 @@ Modifications to upstream libffi needed for the Mozilla build:
* Clear INFO_DEPS so that builds don't fail when makeinfo isn't present.
- This can be removed if https://github.com/atgreen/libffi/issues/111 is fixed.
* Various workarounds for pymake bugs.
- Once pymake support is fully deprecated, hunks 2 & 3 be safely removed.
- Once pymake support is fully deprecated, hunks 2-4 be safely removed.
diff --git a/js/src/ctypes/libffi/Makefile.in b/js/src/ctypes/libffi/Makefile.in
--- a/js/src/ctypes/libffi/Makefile.in
@ -26,7 +26,30 @@ diff --git a/js/src/ctypes/libffi/Makefile.in b/js/src/ctypes/libffi/Makefile.in
TEXINFOS = doc/libffi.texi
TEXI2DVI = texi2dvi
TEXI2PDF = $(TEXI2DVI) --pdf --batch
@@ -1292,57 +1292,57 @@ distclean-compile:
@@ -758,18 +758,20 @@ Makefile: $(srcdir)/Makefile.in $(top_bu
$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
$(am__cd) $(srcdir) && $(AUTOCONF)
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
$(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
$(am__aclocal_m4_deps):
fficonfig.h: stamp-h1
- @test -f $@ || rm -f stamp-h1
- @test -f $@ || $(MAKE) $(AM_MAKEFLAGS) stamp-h1
+ @if test ! -f $@; then \
+ rm -f stamp-h1; \
+ $(MAKE) $(AM_MAKEFLAGS) stamp-h1; \
+ else :; fi
stamp-h1: $(srcdir)/fficonfig.h.in $(top_builddir)/config.status
@rm -f stamp-h1
cd $(top_builddir) && $(SHELL) ./config.status fficonfig.h
$(srcdir)/fficonfig.h.in: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
($(am__cd) $(top_srcdir) && $(AUTOHEADER))
rm -f stamp-h1
touch $@
@@ -1292,57 +1294,57 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@src/x86/$(DEPDIR)/freebsd.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@src/x86/$(DEPDIR)/sysv.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@src/x86/$(DEPDIR)/unix64.Plo@am__quote@
@ -90,7 +113,7 @@ diff --git a/js/src/ctypes/libffi/Makefile.in b/js/src/ctypes/libffi/Makefile.in
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $<
mostlyclean-libtool:
@@ -1443,17 +1443,17 @@ doc/libffi.html: doc/libffi.texi $(srcdi
@@ -1443,17 +1445,17 @@ doc/libffi.html: doc/libffi.texi $(srcdi
-@rm -f vti.tmp
@cp $(srcdir)/doc/version.texi $@

View File

@ -763,8 +763,10 @@ $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
$(am__aclocal_m4_deps):
fficonfig.h: stamp-h1
@test -f $@ || rm -f stamp-h1
@test -f $@ || $(MAKE) $(AM_MAKEFLAGS) stamp-h1
@if test ! -f $@; then \
rm -f stamp-h1; \
$(MAKE) $(AM_MAKEFLAGS) stamp-h1; \
else :; fi
stamp-h1: $(srcdir)/fficonfig.h.in $(top_builddir)/config.status
@rm -f stamp-h1

View File

@ -237,7 +237,7 @@ if (isAsmJSCompilationAvailable() && isCachingEnabled()) {
})();
/* Implicit "use strict" context */
/* Implicit "use strict" context in modules */
(function() {
var funcHeader = 'function (glob, ffi, heap) {',
@ -336,3 +336,33 @@ if (isAsmJSCompilationAvailable() && isCachingEnabled()) {
}
})();
/* Implicit "use strict" context in functions */
(function () {
var funcCode = 'function g(x) {\n\
x=x|0;\n\
return x + 1 | 0;}';
var moduleCode = 'function () {\n\
"use asm";\n' + funcCode + '\n\
return g;\n\
}',
useStrict = '"use strict";';
var f5 = eval(useStrict + ";\n(" + moduleCode + "())");
var expectedToString = funcCode.replace('{', '{\n' + useStrict + '\n')
var expectedToSource = expectedToString
assertEq(f5.toString(), expectedToString);
assertEq(f5.toSource(), expectedToSource);
if (isAsmJSCompilationAvailable() && isCachingEnabled()) {
var mf5 = eval("\"use strict\";\n(" + moduleCode + ")");
assertEq(isAsmJSModuleLoadedFromCache(mf5), true);
var f5 = mf5();
assertEq(f5.toString(), expectedToString);
assertEq(f5.toSource(), expectedToSource);
}
})();

View File

@ -585,6 +585,7 @@ HandleDynamicLinkFailure(JSContext *cx, CallArgs args, AsmJSModule &module, Hand
CompileOptions options(cx);
options.setOriginPrincipals(module.scriptSource()->originPrincipals())
.setFile(module.scriptSource()->filename())
.setCompileAndGo(false)
.setNoScriptRval(false);
@ -860,6 +861,28 @@ js::IsAsmJSModule(HandleFunction fun)
return fun->isNative() && fun->maybeNative() == LinkAsmJS;
}
static bool
AppendUseStrictSource(JSContext *cx, HandleFunction fun, Handle<JSFlatString*> src, StringBuffer &out)
{
// We need to add "use strict" in the body right after the opening
// brace.
size_t bodyStart = 0, bodyEnd;
// No need to test for functions created with the Function ctor as
// these don't implicitly inherit the "use strict" context. Strict mode is
// enabled for functions created with the Function ctor only if they begin with
// the "use strict" directive, but these functions won't validate as asm.js
// modules.
ConstTwoByteChars chars(src->chars(), src->length());
if (!FindBody(cx, fun, chars, src->length(), &bodyStart, &bodyEnd))
return false;
return out.append(chars, bodyStart) &&
out.append("\n\"use strict\";\n") &&
out.append(chars + bodyStart, src->length() - bodyStart);
}
JSString *
js::AsmJSModuleToString(JSContext *cx, HandleFunction fun, bool addParenToLambda)
{
@ -909,26 +932,8 @@ js::AsmJSModuleToString(JSContext *cx, HandleFunction fun, bool addParenToLambda
return nullptr;
if (module.strict()) {
// We need to add "use strict" in the body right after the opening
// brace.
size_t bodyStart = 0, bodyEnd;
// No need to test for functions created with the Function ctor as
// these doesn't implicitly inherit the "use strict" context. Strict mode is
// enabled for functions created with the Function ctor only if they begin with
// the "use strict" directive, but these functions won't validate as asm.js
// modules.
ConstTwoByteChars chars(src->chars(), src->length());
if (!FindBody(cx, fun, chars, src->length(), &bodyStart, &bodyEnd))
if (!AppendUseStrictSource(cx, fun, src, out))
return nullptr;
if (!out.append(chars, bodyStart) ||
!out.append("\n\"use strict\";\n") ||
!out.append(chars + bodyStart, src->length() - bodyStart))
{
return nullptr;
}
} else {
if (!out.append(src->chars(), src->length()))
return nullptr;
@ -995,12 +1000,27 @@ js::AsmJSFunctionToString(JSContext *cx, HandleFunction fun)
if (!out.append("function "))
return nullptr;
Rooted<JSFlatString*> src(cx, source->substring(cx, begin, end));
if (!src)
return nullptr;
if (module.strict()) {
// AppendUseStrictSource expects its input to start right after the
// function name, so split the source chars from the src into two parts:
// the function name and the rest (arguments + body).
if (!out.append(src->chars(), src->length()))
return nullptr;
// asm.js functions can't be anonymous
JS_ASSERT(fun->atom());
if (!out.append(fun->atom()))
return nullptr;
size_t nameEnd = begin + fun->atom()->length();
Rooted<JSFlatString*> src(cx, source->substring(cx, nameEnd, end));
if (!AppendUseStrictSource(cx, fun, src, out))
return nullptr;
} else {
Rooted<JSFlatString*> src(cx, source->substring(cx, begin, end));
if (!src)
return nullptr;
if (!out.append(src->chars(), src->length()))
return nullptr;
}
return out.finishString();
}

View File

@ -1567,71 +1567,71 @@ GenerateLIR(MIRGenerator *mir)
AllocationIntegrityState integrity(*lir);
TraceLogStartEvent(logger, TraceLogger::RegisterAllocation);
{
AutoTraceLog log(logger, TraceLogger::RegisterAllocation);
switch (mir->optimizationInfo().registerAllocator()) {
case RegisterAllocator_LSRA: {
switch (mir->optimizationInfo().registerAllocator()) {
case RegisterAllocator_LSRA: {
#ifdef DEBUG
if (!integrity.record())
return nullptr;
if (!integrity.record())
return nullptr;
#endif
LinearScanAllocator regalloc(mir, &lirgen, *lir);
if (!regalloc.go())
return nullptr;
LinearScanAllocator regalloc(mir, &lirgen, *lir);
if (!regalloc.go())
return nullptr;
#ifdef DEBUG
if (!integrity.check(false))
return nullptr;
if (!integrity.check(false))
return nullptr;
#endif
IonSpewPass("Allocate Registers [LSRA]", &regalloc);
break;
}
IonSpewPass("Allocate Registers [LSRA]", &regalloc);
break;
}
case RegisterAllocator_Backtracking: {
case RegisterAllocator_Backtracking: {
#ifdef DEBUG
if (!integrity.record())
return nullptr;
if (!integrity.record())
return nullptr;
#endif
BacktrackingAllocator regalloc(mir, &lirgen, *lir);
if (!regalloc.go())
return nullptr;
BacktrackingAllocator regalloc(mir, &lirgen, *lir);
if (!regalloc.go())
return nullptr;
#ifdef DEBUG
if (!integrity.check(false))
return nullptr;
if (!integrity.check(false))
return nullptr;
#endif
IonSpewPass("Allocate Registers [Backtracking]");
break;
}
IonSpewPass("Allocate Registers [Backtracking]");
break;
}
case RegisterAllocator_Stupid: {
// Use the integrity checker to populate safepoint information, so
// run it in all builds.
if (!integrity.record())
return nullptr;
case RegisterAllocator_Stupid: {
// Use the integrity checker to populate safepoint information, so
// run it in all builds.
if (!integrity.record())
return nullptr;
StupidAllocator regalloc(mir, &lirgen, *lir);
if (!regalloc.go())
return nullptr;
if (!integrity.check(true))
return nullptr;
IonSpewPass("Allocate Registers [Stupid]");
break;
}
StupidAllocator regalloc(mir, &lirgen, *lir);
if (!regalloc.go())
return nullptr;
if (!integrity.check(true))
return nullptr;
IonSpewPass("Allocate Registers [Stupid]");
break;
}
default:
MOZ_ASSUME_UNREACHABLE("Bad regalloc");
default:
MOZ_ASSUME_UNREACHABLE("Bad regalloc");
}
if (mir->shouldCancel("Allocate Registers"))
return nullptr;
}
if (mir->shouldCancel("Allocate Registers"))
return nullptr;
TraceLogStopEvent(logger, TraceLogger::RegisterAllocation);
{
AutoTraceLog log(logger, TraceLogger::UnsplitEdges);
// Now that all optimization and register allocation is done, re-introduce

View File

@ -87,7 +87,7 @@ JSString::validateLength(js::ThreadSafeContext *maybecx, size_t length)
MOZ_ALWAYS_INLINE void
JSRope::init(js::ThreadSafeContext *cx, JSString *left, JSString *right, size_t length)
{
d.lengthAndFlags = buildLengthAndFlags(length, ROPE_FLAGS);
d.u0.lengthAndFlags = buildLengthAndFlags(length, ROPE_FLAGS);
d.u1.left = left;
d.s.u2.right = right;
js::StringWriteBarrierPost(cx, &d.u1.left);
@ -122,7 +122,7 @@ JSDependentString::init(js::ThreadSafeContext *cx, JSLinearString *base, const j
size_t length)
{
JS_ASSERT(!js::IsPoisonedPtr(base));
d.lengthAndFlags = buildLengthAndFlags(length, DEPENDENT_FLAGS);
d.u0.lengthAndFlags = buildLengthAndFlags(length, DEPENDENT_FLAGS);
d.u1.chars = chars;
d.s.u2.base = base;
js::StringWriteBarrierPost(cx, reinterpret_cast<JSString **>(&d.s.u2.base));
@ -185,7 +185,7 @@ JSString::markBase(JSTracer *trc)
MOZ_ALWAYS_INLINE void
JSFlatString::init(const jschar *chars, size_t length)
{
d.lengthAndFlags = buildLengthAndFlags(length, FIXED_FLAGS);
d.u0.lengthAndFlags = buildLengthAndFlags(length, FIXED_FLAGS);
d.u1.chars = chars;
}
@ -229,7 +229,7 @@ JSInlineString::new_(js::ThreadSafeContext *cx)
MOZ_ALWAYS_INLINE jschar *
JSInlineString::init(size_t length)
{
d.lengthAndFlags = buildLengthAndFlags(length, FIXED_FLAGS);
d.u0.lengthAndFlags = buildLengthAndFlags(length, FIXED_FLAGS);
d.u1.chars = d.inlineStorage;
JS_ASSERT(lengthFits(length) || (isFatInline() && JSFatInlineString::lengthFits(length)));
return d.inlineStorage;
@ -238,7 +238,7 @@ JSInlineString::init(size_t length)
MOZ_ALWAYS_INLINE void
JSInlineString::resetLength(size_t length)
{
d.lengthAndFlags = buildLengthAndFlags(length, FIXED_FLAGS);
d.u0.lengthAndFlags = buildLengthAndFlags(length, FIXED_FLAGS);
JS_ASSERT(lengthFits(length) || (isFatInline() && JSFatInlineString::lengthFits(length)));
}
@ -254,7 +254,7 @@ JSExternalString::init(const jschar *chars, size_t length, const JSStringFinaliz
{
JS_ASSERT(fin);
JS_ASSERT(fin->finalize);
d.lengthAndFlags = buildLengthAndFlags(length, FIXED_FLAGS);
d.u0.lengthAndFlags = buildLengthAndFlags(length, FIXED_FLAGS);
d.u1.chars = chars;
d.s.u2.externalFinalizer = fin;
}

View File

@ -231,8 +231,7 @@ JSRope::flattenInternal(ExclusiveContext *maybecx)
* To avoid maintaining a stack, tree nodes are mutated to indicate how many
* times they have been visited. Since ropes can be dags, a node may be
* encountered multiple times during traversal. However, step 3 above leaves
* a valid dependent string, so everything works out. This algorithm is
* homomorphic to marking code.
* a valid dependent string, so everything works out.
*
* While ropes avoid all sorts of quadratic cases with string
* concatenation, they can't help when ropes are immediately flattened.
@ -260,6 +259,14 @@ JSRope::flattenInternal(ExclusiveContext *maybecx)
JSString *str = this;
jschar *pos;
/*
* JSString::flattenData is a tagged pointer to the parent node.
* The tag indicates what to do when we return to the parent.
*/
static const uintptr_t Tag_Mask = 0x3;
static const uintptr_t Tag_FinishNode = 0x0;
static const uintptr_t Tag_VisitRightChild = 0x1;
/* Find the left most string, containing the first string. */
JSRope *leftMostRope = this;
while (leftMostRope->leftChild()->isRope())
@ -273,16 +280,16 @@ JSRope::flattenInternal(ExclusiveContext *maybecx)
* Simulate a left-most traversal from the root to leftMost->leftChild()
* via first_visit_node
*/
JS_ASSERT(str->isRope());
while (str != leftMostRope) {
JS_ASSERT(str->isRope());
if (b == WithIncrementalBarrier) {
JSString::writeBarrierPre(str->d.u1.left);
JSString::writeBarrierPre(str->d.s.u2.right);
}
JSString *child = str->d.u1.left;
JS_ASSERT(child->isRope());
str->d.u1.chars = left.chars();
child->d.s.u3.parent = str;
child->d.lengthAndFlags = 0x200;
child->d.u0.flattenData = uintptr_t(str) | Tag_VisitRightChild;
str = child;
}
if (b == WithIncrementalBarrier) {
@ -292,10 +299,10 @@ JSRope::flattenInternal(ExclusiveContext *maybecx)
str->d.u1.chars = left.chars();
wholeCapacity = capacity;
wholeChars = const_cast<jschar *>(left.chars());
size_t bits = left.d.lengthAndFlags;
size_t bits = left.d.u0.lengthAndFlags;
pos = wholeChars + (bits >> LENGTH_SHIFT);
JS_STATIC_ASSERT(!(EXTENSIBLE_FLAGS & DEPENDENT_FLAGS));
left.d.lengthAndFlags = bits ^ (EXTENSIBLE_FLAGS | DEPENDENT_FLAGS);
left.d.u0.lengthAndFlags = bits ^ (EXTENSIBLE_FLAGS | DEPENDENT_FLAGS);
left.d.s.u2.base = (JSLinearString *)this; /* will be true on exit */
StringWriteBarrierPostRemove(maybecx, &left.d.u1.left);
StringWriteBarrierPost(maybecx, (JSString **)&left.d.s.u2.base);
@ -317,8 +324,8 @@ JSRope::flattenInternal(ExclusiveContext *maybecx)
str->d.u1.chars = pos;
StringWriteBarrierPostRemove(maybecx, &str->d.u1.left);
if (left.isRope()) {
left.d.s.u3.parent = str; /* Return to this when 'left' done, */
left.d.lengthAndFlags = 0x200; /* but goto visit_right_child. */
/* Return to this node when 'left' done, then goto visit_right_child. */
left.d.u0.flattenData = uintptr_t(str) | Tag_VisitRightChild;
str = &left;
goto first_visit_node;
}
@ -329,8 +336,8 @@ JSRope::flattenInternal(ExclusiveContext *maybecx)
visit_right_child: {
JSString &right = *str->d.s.u2.right;
if (right.isRope()) {
right.d.s.u3.parent = str; /* Return to this node when 'right' done, */
right.d.lengthAndFlags = 0x300; /* but goto finish_node. */
/* Return to this node when 'right' done, then goto finish_node. */
right.d.u0.flattenData = uintptr_t(str) | Tag_FinishNode;
str = &right;
goto first_visit_node;
}
@ -342,21 +349,21 @@ JSRope::flattenInternal(ExclusiveContext *maybecx)
if (str == this) {
JS_ASSERT(pos == wholeChars + wholeLength);
*pos = '\0';
str->d.lengthAndFlags = buildLengthAndFlags(wholeLength, EXTENSIBLE_FLAGS);
str->d.u0.lengthAndFlags = buildLengthAndFlags(wholeLength, EXTENSIBLE_FLAGS);
str->d.u1.chars = wholeChars;
str->d.s.u2.capacity = wholeCapacity;
StringWriteBarrierPostRemove(maybecx, &str->d.u1.left);
StringWriteBarrierPostRemove(maybecx, &str->d.s.u2.right);
return &this->asFlat();
}
size_t progress = str->d.lengthAndFlags;
str->d.lengthAndFlags = buildLengthAndFlags(pos - str->d.u1.chars, DEPENDENT_FLAGS);
uintptr_t flattenData = str->d.u0.flattenData;
str->d.u0.lengthAndFlags = buildLengthAndFlags(pos - str->d.u1.chars, DEPENDENT_FLAGS);
str->d.s.u2.base = (JSLinearString *)this; /* will be true on exit */
StringWriteBarrierPost(maybecx, (JSString **)&str->d.s.u2.base);
str = str->d.s.u3.parent;
if (progress == 0x200)
str = (JSString *)(flattenData & ~Tag_Mask);
if ((flattenData & Tag_Mask) == Tag_VisitRightChild)
goto visit_right_child;
JS_ASSERT(progress == 0x300);
JS_ASSERT((flattenData & Tag_Mask) == Tag_FinishNode);
goto finish_node;
}
}
@ -465,7 +472,7 @@ JSDependentString::undepend(ExclusiveContext *cx)
* Transform *this into an undepended string so 'base' will remain rooted
* for the benefit of any other dependent string that depends on *this.
*/
d.lengthAndFlags = buildLengthAndFlags(n, UNDEPENDED_FLAGS);
d.u0.lengthAndFlags = buildLengthAndFlags(n, UNDEPENDED_FLAGS);
return &this->asFlat();
}

View File

@ -136,7 +136,10 @@ class JSString : public js::gc::BarrieredCell<JSString>
/* Fields only apply to string types commented on the right. */
struct Data
{
size_t lengthAndFlags; /* JSString */
union {
size_t lengthAndFlags; /* JSString */
uintptr_t flattenData; /* JSRope (temporary while flattening) */
} u0;
union {
const jschar *chars; /* JSLinearString */
JSString *left; /* JSRope */
@ -150,10 +153,6 @@ class JSString : public js::gc::BarrieredCell<JSString>
size_t capacity; /* JSFlatString (extensible) */
const JSStringFinalizer *externalFinalizer;/* JSExternalString */
} u2;
union {
JSString *parent; /* JSRope (temporary) */
size_t reserved; /* may use for bug 615290 */
} u3;
} s;
};
} d;
@ -252,12 +251,12 @@ class JSString : public js::gc::BarrieredCell<JSString>
MOZ_ALWAYS_INLINE
size_t length() const {
return d.lengthAndFlags >> LENGTH_SHIFT;
return d.u0.lengthAndFlags >> LENGTH_SHIFT;
}
MOZ_ALWAYS_INLINE
bool empty() const {
return d.lengthAndFlags <= FLAGS_MASK;
return d.u0.lengthAndFlags <= FLAGS_MASK;
}
/*
@ -299,7 +298,7 @@ class JSString : public js::gc::BarrieredCell<JSString>
MOZ_ALWAYS_INLINE
bool isRope() const {
return (d.lengthAndFlags & FLAGS_MASK) == ROPE_FLAGS;
return (d.u0.lengthAndFlags & FLAGS_MASK) == ROPE_FLAGS;
}
MOZ_ALWAYS_INLINE
@ -321,7 +320,7 @@ class JSString : public js::gc::BarrieredCell<JSString>
MOZ_ALWAYS_INLINE
bool isDependent() const {
return (d.lengthAndFlags & FLAGS_MASK) == DEPENDENT_FLAGS;
return (d.u0.lengthAndFlags & FLAGS_MASK) == DEPENDENT_FLAGS;
}
MOZ_ALWAYS_INLINE
@ -343,7 +342,7 @@ class JSString : public js::gc::BarrieredCell<JSString>
MOZ_ALWAYS_INLINE
bool isExtensible() const {
return (d.lengthAndFlags & FLAGS_MASK) == EXTENSIBLE_FLAGS;
return (d.u0.lengthAndFlags & FLAGS_MASK) == EXTENSIBLE_FLAGS;
}
MOZ_ALWAYS_INLINE
@ -376,17 +375,17 @@ class JSString : public js::gc::BarrieredCell<JSString>
MOZ_ALWAYS_INLINE
bool isUndepended() const {
return (d.lengthAndFlags & FLAGS_MASK) == UNDEPENDED_FLAGS;
return (d.u0.lengthAndFlags & FLAGS_MASK) == UNDEPENDED_FLAGS;
}
MOZ_ALWAYS_INLINE
bool isAtom() const {
return d.lengthAndFlags & ATOM_BIT;
return d.u0.lengthAndFlags & ATOM_BIT;
}
MOZ_ALWAYS_INLINE
bool isPermanentAtom() const {
return (d.lengthAndFlags & FLAGS_MASK) == PERMANENT_ATOM_FLAGS;
return (d.u0.lengthAndFlags & FLAGS_MASK) == PERMANENT_ATOM_FLAGS;
}
MOZ_ALWAYS_INLINE
@ -399,7 +398,7 @@ class JSString : public js::gc::BarrieredCell<JSString>
inline bool hasBase() const {
JS_STATIC_ASSERT((DEPENDENT_FLAGS | JS_BIT(1)) == UNDEPENDED_FLAGS);
return d.lengthAndFlags & HAS_BASE_BIT;
return d.u0.lengthAndFlags & HAS_BASE_BIT;
}
inline JSLinearString *base() const;
@ -417,7 +416,7 @@ class JSString : public js::gc::BarrieredCell<JSString>
/* Offsets for direct field from jit code. */
static size_t offsetOfLengthAndFlags() {
return offsetof(JSString, d.lengthAndFlags);
return offsetof(JSString, d.u0.lengthAndFlags);
}
static size_t offsetOfChars() {
@ -594,11 +593,11 @@ class JSFlatString : public JSLinearString
* operation changes the string to the JSAtom type, in place.
*/
MOZ_ALWAYS_INLINE JSAtom *morphAtomizedStringIntoAtom() {
d.lengthAndFlags = buildLengthAndFlags(length(), ATOM_BIT);
d.u0.lengthAndFlags = buildLengthAndFlags(length(), ATOM_BIT);
return &asAtom();
}
MOZ_ALWAYS_INLINE JSAtom *morphAtomizedStringIntoPermanentAtom() {
d.lengthAndFlags = buildLengthAndFlags(length(), PERMANENT_ATOM_FLAGS);
d.u0.lengthAndFlags = buildLengthAndFlags(length(), PERMANENT_ATOM_FLAGS);
return &asAtom();
}
@ -740,13 +739,13 @@ class JSAtom : public JSFlatString
MOZ_ALWAYS_INLINE
bool isPermanent() const {
return d.lengthAndFlags & PERMANENT_BIT;
return d.u0.lengthAndFlags & PERMANENT_BIT;
}
// Transform this atom into a permanent atom. This is only done during
// initialization of the runtime.
MOZ_ALWAYS_INLINE void morphIntoPermanentAtom() {
d.lengthAndFlags = buildLengthAndFlags(length(), PERMANENT_ATOM_FLAGS);
d.u0.lengthAndFlags = buildLengthAndFlags(length(), PERMANENT_ATOM_FLAGS);
}
#ifdef DEBUG

View File

@ -1607,6 +1607,7 @@ ScrollFrameHelper::ScrollFrameHelper(nsContainerFrame* aOuter,
, mCollapsedResizer(false)
, mShouldBuildScrollableLayer(false)
, mHasBeenScrolled(false)
, mIsResolutionSet(false)
{
mScrollingActive = IsAlwaysActive();
@ -2795,6 +2796,7 @@ void
ScrollFrameHelper::SetResolution(const gfxSize& aResolution)
{
mResolution = aResolution;
mIsResolutionSet = true;
}
static void
@ -4538,6 +4540,7 @@ ScrollFrameHelper::RestoreState(nsPresState* aState)
mDidHistoryRestore = true;
mLastPos = mScrolledFrame ? GetLogicalScrollPosition() : nsPoint(0,0);
mResolution = aState->GetResolution();
mIsResolutionSet = true;
if (mIsRoot) {
mOuter->PresContext()->PresShell()->SetResolution(mResolution.width, mResolution.height);

View File

@ -407,6 +407,10 @@ public:
// True if this frame has been scrolled at least once
bool mHasBeenScrolled:1;
// True if the frame's resolution has been set via SetResolution or restored
// via RestoreState.
bool mIsResolutionSet:1;
protected:
/**
* @note This method might destroy the frame, pres shell and other objects.
@ -658,6 +662,9 @@ public:
virtual void ResetScrollPositionForLayerPixelAlignment() MOZ_OVERRIDE {
mHelper.ResetScrollPositionForLayerPixelAlignment();
}
virtual bool IsResolutionSet() const MOZ_OVERRIDE {
return mHelper.mIsResolutionSet;
}
virtual bool DidHistoryRestore() const MOZ_OVERRIDE {
return mHelper.mDidHistoryRestore;
}
@ -972,6 +979,9 @@ public:
virtual void ResetScrollPositionForLayerPixelAlignment() MOZ_OVERRIDE {
mHelper.ResetScrollPositionForLayerPixelAlignment();
}
virtual bool IsResolutionSet() const MOZ_OVERRIDE {
return mHelper.mIsResolutionSet;
}
virtual bool DidHistoryRestore() const MOZ_OVERRIDE {
return mHelper.mDidHistoryRestore;
}

View File

@ -271,6 +271,10 @@ public:
* Was the current presentation state for this frame restored from history?
*/
virtual bool DidHistoryRestore() const = 0;
/**
* Was the current resolution set by the user or just default initialized?
*/
virtual bool IsResolutionSet() const = 0;
/**
* Clear the flag so that DidHistoryRestore() returns false until the next
* RestoreState call.

View File

@ -0,0 +1,16 @@
<!DOCTYPE html>
<html>
<head>
<title>Bug 1007278: test button "disabled" text style</title>
<style>
button {
color: GrayText;
border-width: 0;
background: transparent;
}
</style>
</head>
<body>
<button>Some text</button>
</body>
</html>

View File

@ -0,0 +1,15 @@
<!DOCTYPE html>
<html>
<head>
<title>Bug 1007278: test button "disabled" text style</title>
<style>
button {
border-width: 0;
background: transparent;
}
</style>
</head>
<body>
<button disabled>Some text</button>
</body>
</html>

View File

@ -0,0 +1,17 @@
<!DOCTYPE html>
<html>
<head>
<title>Bug 1007278: test all types of buttons look similar when disabled</title>
</head>
<body>
<button>Some text</button>
<button>Some text</button>
<button>Reset</button>
<button>Submit Query</button>
<br>
<button disabled>Some text</button>
<button disabled>Some text</button>
<button disabled>Reset</button>
<button disabled>Submit Query</button>
</body>
</html>

View File

@ -0,0 +1,17 @@
<!DOCTYPE html>
<html>
<head>
<title>Bug 1007278: test all types of buttons look similar when disabled</title>
</head>
<body>
<button>Some text</button>
<input type="button" value="Some text">
<input type="reset">
<input type="submit">
<br>
<button disabled>Some text</button>
<input disabled type="button" value="Some text">
<input disabled type="reset">
<input disabled type="submit">
</body>
</html>

View File

@ -0,0 +1,9 @@
<!DOCTYPE html>
<html>
<head>
<title>Bug 1007278: check disabled and non-disabled buttons look different</title>
</head>
<body>
<button disabled>Some text</button>
</body>
</html>

View File

@ -0,0 +1,9 @@
<!DOCTYPE html>
<html>
<head>
<title>Bug 1007278: check disabled and non-disabled buttons look different</title>
</head>
<body>
<button>Some text</button>
</body>
</html>

View File

@ -0,0 +1,9 @@
<!DOCTYPE html>
<html>
<head>
<title>Bug 1007278: check disabled and non-disabled buttons look different</title>
</head>
<body>
<input disabled type="button" value="Some text">
</body>
</html>

View File

@ -0,0 +1,9 @@
<!DOCTYPE html>
<html>
<head>
<title>Bug 1007278: check disabled and non-disabled buttons look different</title>
</head>
<body>
<input type="button" value="Some text">
</body>
</html>

View File

@ -0,0 +1,9 @@
<!DOCTYPE html>
<html>
<head>
<title>Bug 1007278: check disabled and non-disabled buttons look different</title>
</head>
<body>
<input disabled type="reset">
</body>
</html>

View File

@ -0,0 +1,9 @@
<!DOCTYPE html>
<html>
<head>
<title>Bug 1007278: check disabled and non-disabled buttons look different</title>
</head>
<body>
<input type="reset">
</body>
</html>

View File

@ -0,0 +1,9 @@
<!DOCTYPE html>
<html>
<head>
<title>Bug 1007278: check disabled and non-disabled buttons look different</title>
</head>
<body>
<input disabled type="submit">
</body>
</html>

View File

@ -0,0 +1,9 @@
<!DOCTYPE html>
<html>
<head>
<title>Bug 1007278: check disabled and non-disabled buttons look different</title>
</head>
<body>
<input type="submit">
</body>
</html>

View File

@ -17,3 +17,15 @@ fuzzy-if(B2G||Android,125,80) == percent-width-child-2.html percent-width-child
!= line-height-button-1.5.html line-height-button-1.0.html
!= line-height-input-0.5.html line-height-input-1.0.html
!= line-height-input-1.5.html line-height-input-1.0.html
# Looks like Android and B2G change the text color, but to something slightly
# different from ColorGray
fails-if(Android||B2G) == disabled-1.html disabled-1-ref.html
# While disabled buttons don't look like non-disabled buttons, <button disabled>
# is different from other disabled buttons for B2G ICS Emulator (see bug 1009714)
fails-if(B2G) == disabled-2.html disabled-2-ref.html
!= disabled-3.html disabled-3-notref.html
!= disabled-4.html disabled-4-notref.html
!= disabled-5.html disabled-5-notref.html
!= disabled-6.html disabled-6-notref.html

View File

@ -664,6 +664,7 @@ input[type="submit"]:disabled {
cursor: inherit;
}
button:disabled:active, button:disabled,
input[type="reset"]:disabled:active,
input[type="reset"]:disabled,
input[type="button"]:disabled:active,

2
mach
View File

@ -1,4 +1,4 @@
#!/usr/bin/env python2.7
#!/usr/bin/env python
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

View File

@ -1,3 +1,3 @@
{ "title": "Firefox Marketplace",
"url": "http://marketplace.firefox.com",
"url": "https://marketplace.firefox.com/",
"bgcolor": "#0095dd" }

View File

@ -1,3 +1,3 @@
{ "title": "Mozilla",
"url": "http://mozilla.org",
"url": "http://www.mozilla.org/en-US/",
"bgcolor": "#c13832" }

Binary file not shown.

After

Width:  |  Height:  |  Size: 803 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 722 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 668 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 716 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 813 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 670 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 727 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 541 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 539 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 562 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 553 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 562 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 556 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 803 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 722 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 668 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 716 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 813 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 670 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 727 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 541 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 539 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 562 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 553 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 562 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 556 B

View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<animation-list xmlns:android="http://schemas.android.com/apk/res/android"
android:oneshot="false">
<item android:drawable="@drawable/alert_app_animation_1" android:duration="150" />
<item android:drawable="@drawable/alert_app_animation_2" android:duration="150" />
<item android:drawable="@drawable/alert_app_animation_3" android:duration="150" />
<item android:drawable="@drawable/alert_app_animation_4" android:duration="150" />
<item android:drawable="@drawable/alert_app_animation_5" android:duration="150" />
<item android:drawable="@drawable/alert_app_animation_6" android:duration="150" />
<item android:drawable="@drawable/alert_app_animation_7" android:duration="150" />
</animation-list>

View File

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<animation-list xmlns:android="http://schemas.android.com/apk/res/android"
android:oneshot="false">
<item android:drawable="@drawable/alert_download_animation_1" android:duration="150" />
<item android:drawable="@drawable/alert_download_animation_2" android:duration="150" />
<item android:drawable="@drawable/alert_download_animation_3" android:duration="150" />
<item android:drawable="@drawable/alert_download_animation_4" android:duration="150" />
<item android:drawable="@drawable/alert_download_animation_5" android:duration="150" />
<item android:drawable="@drawable/alert_download_animation_6" android:duration="150" />
</animation-list>

View File

@ -4233,7 +4233,7 @@ Tab.prototype = {
restoredSessionZoom: function() {
let cwu = this.browser.contentWindow.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils);
if (this._restoreZoom && cwu.isHistoryRestored) {
if (this._restoreZoom && cwu.isResolutionSet) {
return this._getGeckoZoom();
}
return null;

View File

@ -46,6 +46,7 @@ relativesrcdir toolkit/locales:
locale/@AB_CD@/browser/overrides/about.dtd (%chrome/global/about.dtd)
locale/@AB_CD@/browser/overrides/aboutAbout.dtd (%chrome/global/aboutAbout.dtd)
locale/@AB_CD@/browser/overrides/aboutRights.dtd (%chrome/global/aboutRights.dtd)
locale/@AB_CD@/browser/overrides/charsetMenu.properties (%chrome/global/charsetMenu.properties)
locale/@AB_CD@/browser/overrides/commonDialogs.properties (%chrome/global/commonDialogs.properties)
locale/@AB_CD@/browser/overrides/intl.properties (%chrome/global/intl.properties)
locale/@AB_CD@/browser/overrides/intl.css (%chrome/global/intl.css)
@ -70,6 +71,7 @@ relativesrcdir toolkit/locales:
% override chrome://global/locale/about.dtd chrome://browser/locale/overrides/about.dtd
% override chrome://global/locale/aboutAbout.dtd chrome://browser/locale/overrides/aboutAbout.dtd
% override chrome://global/locale/aboutRights.dtd chrome://browser/locale/overrides/aboutRights.dtd
% override chrome://global/locale/charsetMenu.properties chrome://browser/locale/overrides/charsetMenu.properties
% override chrome://global/locale/commonDialogs.properties chrome://browser/locale/overrides/commonDialogs.properties
% override chrome://mozapps/locale/handling/handling.properties chrome://browser/locale/handling.properties
% override chrome://global/locale/intl.properties chrome://browser/locale/overrides/intl.properties

View File

@ -351,8 +351,7 @@ this.WebappManager = {
notification = this._notify({
title: Strings.GetStringFromName("checkingForUpdatesTitle"),
message: Strings.GetStringFromName("checkingForUpdatesMessage"),
// TODO: replace this with an animated icon.
icon: "drawable://alert_app",
icon: "drawable://alert_app_animation",
progress: NaN,
});
}
@ -392,10 +391,7 @@ this.WebappManager = {
title: PluralForm.get(aApps.length, Strings.GetStringFromName("downloadingUpdateTitle")).
replace("#1", aApps.length),
message: Strings.formatStringFromName("downloadingUpdateMessage", [downloadingNames], 1),
// TODO: replace this with an animated icon. UpdateService uses
// android.R.drawable.stat_sys_download, but I don't think we can reference
// a system icon with a drawable: URL here, so we'll have to craft our own.
icon: "drawable://alert_download",
icon: "drawable://alert_download_animation",
// TODO: make this a determinate progress indicator once we can determine
// the sizes of the APKs and observe their progress.
progress: NaN,

View File

@ -126,6 +126,19 @@ Http2Session::Http2Session(nsAHttpTransaction *aHttpTransaction,
mPingThreshold = gHttpHandler->SpdyPingThreshold();
}
// Copy the 32 bit number into the destination, using network byte order
// in the destination.
template<typename charType> static void
CopyAsNetwork32(charType dest, // where to store it
uint32_t number) // the 32 bit number in native format
{
number = PR_htonl(number);
memcpy(dest, &number, sizeof(number));
}
template void CopyAsNetwork32(char *dest, uint32_t number);
template void CopyAsNetwork32(uint8_t *dest, uint32_t number);
PLDHashOperator
Http2Session::ShutdownEnumerator(nsAHttpTransaction *key,
nsAutoPtr<Http2Stream> &stream,
@ -601,12 +614,11 @@ Http2Session::CreateFrameHeader(charType dest, uint16_t frameLength,
MOZ_ASSERT(!(streamID & 0x80000000));
frameLength = PR_htons(frameLength);
streamID = PR_htonl(streamID);
memcpy(dest, &frameLength, 2);
dest[2] = frameType;
dest[3] = frameFlags;
memcpy(dest + 4, &streamID, 4);
CopyAsNetwork32(dest + 4, streamID);
}
char *
@ -710,7 +722,7 @@ Http2Session::GeneratePriority(uint32_t aID, uint8_t aPriorityWeight)
mOutputQueueUsed += 13;
CreateFrameHeader(packet, 5, FRAME_TYPE_PRIORITY, 0, aID);
memset(packet + 8, 0, 4);
CopyAsNetwork32(packet + 8, 0);
memcpy(packet + 12, &aPriorityWeight, 1);
LogIO(this, nullptr, "Generate Priority", packet, 13);
FlushOutputQueue();
@ -736,8 +748,7 @@ Http2Session::GenerateRstStream(uint32_t aStatusCode, uint32_t aID)
mOutputQueueUsed += 12;
CreateFrameHeader(packet, 4, FRAME_TYPE_RST_STREAM, 0, aID);
aStatusCode = PR_htonl(aStatusCode);
memcpy(packet + 8, &aStatusCode, 4);
CopyAsNetwork32(packet + 8, aStatusCode);
LogIO(this, nullptr, "Generate Reset", packet, 12);
FlushOutputQueue();
@ -755,12 +766,10 @@ Http2Session::GenerateGoAway(uint32_t aStatusCode)
CreateFrameHeader(packet, 8, FRAME_TYPE_GOAWAY, 0, 0);
// last-good-stream-id are bytes 8-11 reflecting pushes
uint32_t goAway = PR_htonl(mOutgoingGoAwayID);
memcpy(packet + 8, &goAway, 4);
CopyAsNetwork32(packet + 8, mOutgoingGoAwayID);
// bytes 12-15 are the status code.
aStatusCode = PR_htonl(aStatusCode);
memcpy(packet + 12, &aStatusCode, 4);
CopyAsNetwork32(packet + 12, aStatusCode);
LogIO(this, nullptr, "Generate GoAway", packet, 16);
FlushOutputQueue();
@ -812,8 +821,7 @@ Http2Session::SendHello()
// Advertise the Push RWIN for the session, and on each new pull stream
// send a window update with END_FLOW_CONTROL
packet[8 + 5 * numberOfEntries] = SETTINGS_TYPE_INITIAL_WINDOW;
uint32_t rwin = PR_htonl(mPushAllowance);
memcpy(packet + 9 + 5 * numberOfEntries, &rwin, 4);
CopyAsNetwork32(packet + 9 + 5 * numberOfEntries, mPushAllowance);
numberOfEntries++;
// Explicitly signal that we do NOT support compressed data frames, even
@ -835,16 +843,15 @@ Http2Session::SendHello()
goto sendHello_complete;
// send a window update for the session (Stream 0) for something large
sessionWindowBump = PR_htonl(sessionWindowBump);
mLocalSessionWindow = ASpdySession::kInitialRwin;
packet = mOutputQueueBuffer.get() + mOutputQueueUsed;
CreateFrameHeader(packet, 4, FRAME_TYPE_WINDOW_UPDATE, 0, 0);
mOutputQueueUsed += 12;
memcpy(packet + 8, &sessionWindowBump, 4);
CopyAsNetwork32(packet + 8, sessionWindowBump);
LOG3(("Session Window increase at start of session %p %u\n",
this, PR_ntohl(sessionWindowBump)));
this, sessionWindowBump));
LogIO(this, nullptr, "Session Window Bump ", packet, 12);
sendHello_complete:
@ -2480,8 +2487,7 @@ Http2Session::UpdateLocalStreamWindow(Http2Stream *stream, uint32_t bytes)
MOZ_ASSERT(mOutputQueueUsed <= mOutputQueueSize);
CreateFrameHeader(packet, 4, FRAME_TYPE_WINDOW_UPDATE, 0, stream->StreamID());
toack = PR_htonl(toack);
memcpy(packet + 8, &toack, 4);
CopyAsNetwork32(packet + 8, toack);
LogIO(this, stream, "Stream Window Update", packet, 12);
// dont flush here, this write can commonly be coalesced with a
@ -2519,8 +2525,7 @@ Http2Session::UpdateLocalSessionWindow(uint32_t bytes)
MOZ_ASSERT(mOutputQueueUsed <= mOutputQueueSize);
CreateFrameHeader(packet, 4, FRAME_TYPE_WINDOW_UPDATE, 0, 0);
toack = PR_htonl(toack);
memcpy(packet + 8, &toack, 4);
CopyAsNetwork32(packet + 8, toack);
LogIO(this, nullptr, "Session Window Update", packet, 12);
// dont flush here, this write can commonly be coalesced with others

View File

@ -1,6 +1,13 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* Copyright 2013 Mozilla Foundation
/* This code is made available to you under your choice of the following sets
* of licensing terms:
*/
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
/* Copyright 2013 Mozilla Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@ -1,6 +1,13 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* Copyright 2013 Mozilla Foundation
/* This code is made available to you under your choice of the following sets
* of licensing terms:
*/
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
/* Copyright 2013 Mozilla Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@ -1,6 +1,13 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* Copyright 2013 Mozilla Foundation
/* This code is made available to you under your choice of the following sets
* of licensing terms:
*/
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
/* Copyright 2013 Mozilla Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@ -1,6 +1,13 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* Copyright 2013 Mozilla Foundation
/* This code is made available to you under your choice of the following sets
* of licensing terms:
*/
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
/* Copyright 2013 Mozilla Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@ -1,6 +1,13 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* Copyright 2013 Mozilla Foundation
/* This code is made available to you under your choice of the following sets
* of licensing terms:
*/
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
/* Copyright 2013 Mozilla Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@ -1,6 +1,13 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* Copyright 2013 Mozilla Foundation
/* This code is made available to you under your choice of the following sets
* of licensing terms:
*/
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
/* Copyright 2013 Mozilla Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@ -1,6 +1,13 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* Copyright 2013 Mozilla Foundation
/* This code is made available to you under your choice of the following sets
* of licensing terms:
*/
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
/* Copyright 2013 Mozilla Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@ -1,6 +1,13 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* Copyright 2012 Mozilla Foundation
/* This code is made available to you under your choice of the following sets
* of licensing terms:
*/
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
/* Copyright 2013 Mozilla Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

Some files were not shown because too many files have changed in this diff Show More