Merge inbound to m-c

This commit is contained in:
Wes Kocher 2014-05-14 14:21:38 -07:00
commit 3a998cce2a
85 changed files with 1042 additions and 325 deletions

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,8 +402,15 @@ private:
return NS_OK;
}
AutoPushJSContext cx(node->Context()->GetJSContext());
if (cx) {
// 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;
@ -416,7 +423,7 @@ private:
}
// Put the channel data inside it
for (uint32_t i = 0; i < mInputChannels.Length(); ++i) {
inputBuffer->SetRawChannelContents(cx, i, mInputChannels[i]);
inputBuffer->SetRawChannelContents(i, mInputChannels[i]);
}
}
@ -439,7 +446,7 @@ private:
// Append it to our output buffer queue
node->GetSharedBuffers()->FinishProducingOutputBuffer(output, node->BufferSize());
}
return NS_OK;
}
private:

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

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

@ -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;
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).
// 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,7 +1567,8 @@ GenerateLIR(MIRGenerator *mir)
AllocationIntegrityState integrity(*lir);
TraceLogStartEvent(logger, TraceLogger::RegisterAllocation);
{
AutoTraceLog log(logger, TraceLogger::RegisterAllocation);
switch (mir->optimizationInfo().registerAllocator()) {
case RegisterAllocator_LSRA: {
@ -1629,8 +1630,7 @@ GenerateLIR(MIRGenerator *mir)
if (mir->shouldCancel("Allocate Registers"))
return nullptr;
TraceLogStopEvent(logger, TraceLogger::RegisterAllocation);
}
{
AutoTraceLog log(logger, TraceLogger::UnsplitEdges);

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
*/
while (str != leftMostRope) {
JS_ASSERT(str->isRope());
while (str != leftMostRope) {
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
{
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

@ -1561,12 +1561,10 @@ GetAnimatedGeometryRootForFrame(nsIFrame* aFrame,
if (!parent)
break;
nsIAtom* parentType = parent->GetType();
#ifdef ANDROID
// Treat the slider thumb as being as an active scrolled root
// on mobile so that it can move without repainting.
// so that it can move without repainting.
if (parentType == nsGkAtoms::sliderFrame)
break;
#endif
// Sticky frames are active if their nearest scrollable frame
// is also active, just keep a record of sticky frames that we
// encounter for now.

View File

@ -845,7 +845,7 @@ skip-if(B2G&&browserIsRemote) == 401946-1.xul about:blank # bug 974780
== 402567-1.html 402567-1-ref.html
== 402567-2.html 402567-2-ref.html
== 402567-3.html 402567-3-ref.html
skip-if(B2G) == 402567-4.html 402567-4-ref.html
skip-if(B2G) fuzzy-if(gtk2Widget,2,40) == 402567-4.html 402567-4-ref.html
== 402629-1.html 402629-1-ref.html
== 402629-2.html 402629-2-ref.html
== 402629-3.html 402629-3-ref.html

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

@ -17,7 +17,7 @@ random-if(d2d) == element-paint-transform-02.html element-paint-transform-02-ref
== element-paint-background-size-02.html element-paint-background-size-02-ref.html
== element-paint-transform-repeated.html element-paint-transform-repeated-ref.html
fuzzy-if(d2d,255,24) == element-paint-transform-03.html element-paint-transform-03-ref.html
== element-paint-native-widget.html element-paint-native-widget-ref.html
fuzzy-if(gtk2Widget,1,32) == element-paint-native-widget.html element-paint-native-widget-ref.html
== element-paint-subimage-sampling-restriction.html about:blank
== element-paint-clippath.html element-paint-clippath-ref.html
== element-paint-sharpness-01a.html element-paint-sharpness-01b.html

View File

@ -3,7 +3,7 @@ skip-if(B2G) == ellipsis-font-fallback.html ellipsis-font-fallback-ref.html
skip-if(B2G) HTTP(..) == marker-basic.html marker-basic-ref.html
skip-if(B2G) HTTP(..) == marker-string.html marker-string-ref.html
skip-if(Android||B2G) HTTP(..) == bidi-simple.html bidi-simple-ref.html # Fails on Android due to anti-aliasing
skip-if(!gtk2Widget) HTTP(..) == bidi-simple-scrolled.html bidi-simple-scrolled-ref.html # Fails on Windows and OSX due to anti-aliasing
skip-if(!gtk2Widget) fuzzy-if(gtk2Widget,1,104) HTTP(..) == bidi-simple-scrolled.html bidi-simple-scrolled-ref.html # Fails on Windows and OSX due to anti-aliasing
skip-if(B2G) fuzzy-if(Android&&AndroidVersion<15,9,2545) fuzzy-if(Android&&AndroidVersion>=15,24,4000) HTTP(..) == scroll-rounding.html scroll-rounding-ref.html # bug 760264
fuzzy-if(OSX==10.8,1,1) HTTP(..) == anonymous-block.html anonymous-block-ref.html
skip-if(B2G) HTTP(..) == false-marker-overlap.html false-marker-overlap-ref.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,

View File

@ -664,11 +664,10 @@ nsSliderFrame::CurrentPositionChanged()
else
newThumbRect.y = clientRect.y + NSToCoordRound(pos * mRatio);
#ifdef MOZ_WIDGET_GONK
// avoid putting the scroll thumb at subpixel positions which cause needless invalidations
nscoord appUnitsPerPixel = PresContext()->AppUnitsPerDevPixel();
newThumbRect = newThumbRect.ToNearestPixels(appUnitsPerPixel).ToAppUnits(appUnitsPerPixel);
#endif
// set the rect
thumbFrame->SetRect(newThumbRect);

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

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

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 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,5 +1,12 @@
# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
# 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

@ -0,0 +1,69 @@
/* 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/. */
"use strict";
this.EXPORTED_SYMBOLS = [
"UpdateProvider",
];
const {classes: Cc, interfaces: Ci, utils: Cu} = Components;
Cu.import("resource://gre/modules/Metrics.jsm", this);
Cu.import("resource://gre/modules/Task.jsm", this);
const DAILY_COUNTER_FIELD = {type: Metrics.Storage.FIELD_DAILY_COUNTER};
const DAILY_DISCRETE_NUMERIC_FIELD = {type: Metrics.Storage.FIELD_DAILY_DISCRETE_NUMERIC};
function UpdateMeasurement1() {
Metrics.Measurement.call(this);
}
UpdateMeasurement1.prototype = Object.freeze({
__proto__: Metrics.Measurement.prototype,
name: "update",
version: 1,
fields: {
updateCheckStartCount: DAILY_COUNTER_FIELD,
updateCheckSuccessCount: DAILY_COUNTER_FIELD,
updateCheckFailedCount: DAILY_COUNTER_FIELD,
updateCheckFailedStatuses: DAILY_DISCRETE_NUMERIC_FIELD,
completeUpdateStartCount: DAILY_COUNTER_FIELD,
partialUpdateStartCount: DAILY_COUNTER_FIELD,
completeUpdateSuccessCount: DAILY_COUNTER_FIELD,
partialUpdateSuccessCount: DAILY_COUNTER_FIELD,
updateFailedCount: DAILY_COUNTER_FIELD,
updateFailedStatuses: DAILY_DISCRETE_NUMERIC_FIELD,
},
});
this.UpdateProvider = function () {
Metrics.Provider.call(this);
};
UpdateProvider.prototype = Object.freeze({
__proto__: Metrics.Provider.prototype,
name: "org.mozilla.update",
measurementTypes: [
UpdateMeasurement1,
],
recordUpdate: function (field, status) {
let m = this.getMeasurement(UpdateMeasurement1.prototype.name,
UpdateMeasurement1.prototype.version);
return this.enqueueStorageOperation(function recordUpdateFields() {
return Task.spawn(function recordUpdateFieldsTask() {
yield m.incrementDailyCounter(field + "Count");
if ((field == "updateFailed" || field == "updateCheckFailed") && status) {
yield m.addDailyDiscreteNumeric(field + "Statuses", status);
}
}.bind(this));
}.bind(this));
},
});

View File

@ -46,4 +46,8 @@ if CONFIG['MOZ_UPDATER']:
'nsUpdateServiceStub.js',
]
EXTRA_JS_MODULES += [
'UpdaterHealthProvider.jsm'
]
JAR_MANIFESTS += ['jar.mn']

View File

@ -12,6 +12,7 @@ Components.utils.import("resource://gre/modules/FileUtils.jsm");
Components.utils.import("resource://gre/modules/AddonManager.jsm");
Components.utils.import("resource://gre/modules/Services.jsm");
Components.utils.import("resource://gre/modules/ctypes.jsm");
Components.utils.import("resource://gre/modules/UpdaterHealthProvider.jsm");
const Cc = Components.classes;
const Ci = Components.interfaces;
@ -258,6 +259,18 @@ const PING_BGUC_ADDON_UPDATES_FOR_INCOMPAT = 29;
// Incompatible add-ons found (update notification)
const PING_BGUC_ADDON_HAVE_INCOMPAT = 30;
// Health report field names
const UpdaterHealthReportFields = {
CHECK_START: "updateCheckStart",
CHECK_SUCCESS: "updateCheckSuccess",
CHECK_FAILED: "updateCheckFailed",
COMPLETE_START: "completeUpdateStart",
PARTIAL_START: "partialUpdateStart",
COMPLETE_SUCCESS: "completeUpdateSuccess",
PARTIAL_SUCCESS: "partialUpdateSuccess",
FAILED: "updateFailed"
};
var gLocale = null;
var gUpdateMutexHandle = null;
@ -935,6 +948,37 @@ function getStatusTextFromCode(code, defaultCode) {
return reason;
}
/**
* Record count in the health report.
* @param field
* The field name to record
* @param status
* Status code for errors, 0 otherwise
*/
function recordInHealthReport(field, status) {
#ifdef MOZ_SERVICES_HEALTHREPORT
try {
LOG("recordInHealthReport - " + field + " - " + status);
let reporter = Cc["@mozilla.org/datareporting/service;1"]
.getService().wrappedJSObject.healthReporter;
if (reporter) {
reporter.onInit().then(function recordUpdateInHealthReport() {
try {
reporter.getProvider("org.mozilla.update").recordUpdate(field, status);
} catch (ex) {
Cu.reportError(ex);
}
});
}
// If getting the heath reporter service fails, don't fail updating.
} catch (ex) {
LOG("recordInHealthReport - could not initialize health reporter");
}
#endif
}
/**
* Get the Active Updates directory
* @return The active updates directory, as a nsIFile object
@ -3600,6 +3644,8 @@ Checker.prototype = {
if (!url || (!this.enabled && !force))
return;
recordInHealthReport(UpdaterHealthReportFields.CHECK_START, 0);
this._request = Cc["@mozilla.org/xmlextras/xmlhttprequest;1"].
createInstance(Ci.nsISupports);
// This is here to let unit test code override XHR
@ -3723,6 +3769,8 @@ Checker.prototype = {
if (Services.prefs.prefHasUserValue(PREF_APP_UPDATE_BACKGROUNDERRORS))
Services.prefs.clearUserPref(PREF_APP_UPDATE_BACKGROUNDERRORS);
recordInHealthReport(UpdaterHealthReportFields.CHECK_SUCCESS, 0);
// Tell the callback about the updates
this._callback.onCheckComplete(event.target, updates, updates.length);
}
@ -3743,6 +3791,9 @@ Checker.prototype = {
update.errorCode = updates[0] ? CERT_ATTR_CHECK_FAILED_HAS_UPDATE
: CERT_ATTR_CHECK_FAILED_NO_UPDATE;
}
recordInHealthReport(UpdaterHealthReportFields.CHECK_FAILED, update.errorCode);
this._callback.onError(request, update);
}
@ -3774,6 +3825,8 @@ Checker.prototype = {
update.errorCode = HTTP_ERROR_OFFSET + status;
}
recordInHealthReport(UpdaterHealthReportFields.CHECK_FAILED, update.errorCode);
this._callback.onError(request, update);
this._request = null;
@ -4088,6 +4141,10 @@ Downloader.prototype = {
}
this.isCompleteUpdate = this._patch.type == "complete";
recordInHealthReport(
this.isCompleteUpdate ? UpdaterHealthReportFields.COMPLETE_START :
UpdaterHealthReportFields.PARTIAL_START, 0);
var patchFile = null;
#ifdef MOZ_WIDGET_GONK
@ -4343,6 +4400,10 @@ Downloader.prototype = {
"current fail: " + this.updateService._consecutiveSocketErrors + ", " +
"max fail: " + maxFail + ", " + "retryTimeout: " + retryTimeout);
if (Components.isSuccessCode(status)) {
recordInHealthReport(
this.isCompleteUpdate ? UpdaterHealthReportFields.COMPLETE_SUCCESS :
UpdaterHealthReportFields.PARTIAL_SUCCESS, 0);
if (this._verifyDownload()) {
state = shouldUseService() ? STATE_PENDING_SVC : STATE_PENDING;
if (this.background) {
@ -4371,7 +4432,10 @@ Downloader.prototype = {
// Destroy the updates directory, since we're done with it.
cleanUpUpdatesDir();
}
} else if (status == Cr.NS_ERROR_OFFLINE) {
} else {
recordInHealthReport(UpdaterHealthReportFields.FAILED, status);
if (status == Cr.NS_ERROR_OFFLINE) {
// Register an online observer to try again.
// The online observer will continue the incremental download by
// calling downloadUpdate on the active update which continues
@ -4415,6 +4479,7 @@ Downloader.prototype = {
deleteActiveUpdate = true;
}
}
LOG("Downloader:onStopRequest - setting state to: " + state);
this._patch.state = state;
var um = Cc["@mozilla.org/updates/update-manager;1"].

View File

@ -10,3 +10,6 @@ contract @mozilla.org/updates/update-prompt;1 {27ABA825-35B5-4018-9FDD-F99250A0E
component {e43b0010-04ba-4da6-b523-1f92580bc150} nsUpdateServiceStub.js
contract @mozilla.org/updates/update-service-stub;1 {e43b0010-04ba-4da6-b523-1f92580bc150}
category profile-after-change nsUpdateServiceStub @mozilla.org/updates/update-service-stub;1
#ifdef MOZ_SERVICES_HEALTHREPORT
category healthreport-js-provider-default UpdateProvider resource://gre/modules/UpdaterHealthProvider.jsm
#endif

View File

@ -0,0 +1,91 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
const {utils: Cu, classes: Cc, interfaces: Ci} = Components;
Cu.import("resource://gre/modules/Metrics.jsm");
Cu.import("resource://gre/modules/UpdaterHealthProvider.jsm");
// Create a profile
let gProfile = do_get_profile();
function run_test() {
run_next_test();
}
add_test(function test_constructor() {
let provider = new UpdateProvider();
run_next_test();
});
add_task(function test_init() {
let storage = yield Metrics.Storage("init");
let provider = new UpdateProvider();
yield provider.init(storage);
yield provider.shutdown();
yield storage.close();
});
add_task(function test_collect() {
let storage = yield Metrics.Storage("collect");
let provider = new UpdateProvider();
yield provider.init(storage);
let now = new Date();
let m = provider.getMeasurement("update", 1);
let fieldcount = 0;
for (let field of ["updateCheckStart",
"updateCheckSuccess",
"completeUpdateStart",
"partialUpdateStart",
"completeUpdateSuccess",
"partialUpdateSuccess"]) {
fieldcount++; // One new day per iteration
yield provider.recordUpdate(field, 0);
let data = yield m.getValues();
do_check_eq(data.days.size, 1);
let day = data.days.getDay(now);
do_check_eq(day.size, fieldcount);
do_check_eq(day.get(field + "Count"), 1);
yield provider.recordUpdate(field, 0);
data = yield m.getValues();
day = data.days.getDay(now);
do_check_eq(day.size, fieldcount);
do_check_eq(day.get(field + "Count"), 2);
}
for (let field of ["updateCheckFailed", "updateFailed"]) {
fieldcount += 2; // Two fields added per iteration
yield provider.recordUpdate(field, 500);
let data = yield m.getValues();
let day = data.days.getDay(now);
do_check_eq(day.size, fieldcount);
do_check_eq(day.get(field + "Statuses"), 500);
yield provider.recordUpdate(field, 800);
data = yield m.getValues();
day = data.days.getDay(now);
do_check_eq(day.size, fieldcount);
do_check_eq(day.get(field + "Statuses")[0], 500);
do_check_eq(day.get(field + "Statuses")[1], 800);
}
yield provider.shutdown();
yield storage.close();
});

View File

@ -39,3 +39,5 @@ skip-if = toolkit == 'gonk'
reason = custom nsIUpdatePrompt
[updateRootDirMigration_win.js]
run-if = os == 'win'
[updateHealthReport.js]
skip-if = ! healthreport

View File

@ -2481,18 +2481,12 @@ GetDPI(NSWindow* aWindow)
[[[screen deviceDescription] objectForKey:@"NSScreenNumber"] intValue];
CGFloat heightMM = ::CGDisplayScreenSize(displayID).height;
size_t heightPx = ::CGDisplayPixelsHigh(displayID);
CGFloat scaleFactor = [aWindow userSpaceScaleFactor];
if (scaleFactor < 0.01 || heightMM < 1 || heightPx < 1) {
if (heightMM < 1 || heightPx < 1) {
// Something extremely bogus is going on
return 96.0f;
}
// Currently we don't do our own scaling to take account
// of userSpaceScaleFactor, so every "pixel" we draw is actually
// userSpaceScaleFactor screen pixels. So divide the screen height
// by userSpaceScaleFactor to get the number of "device pixels"
// available.
float dpi = (heightPx / scaleFactor) / (heightMM / MM_PER_INCH_FLOAT);
float dpi = heightPx / (heightMM / MM_PER_INCH_FLOAT);
// Account for HiDPI mode where Cocoa's "points" do not correspond to real
// device pixels

View File

@ -3232,6 +3232,18 @@ nsNativeThemeCocoa::WidgetStateChanged(nsIFrame* aFrame, uint8_t aWidgetType,
aAttribute == nsGkAtoms::open ||
aAttribute == nsGkAtoms::hover)
*aShouldRepaint = true;
if ((aWidgetType == NS_THEME_SCROLLBAR ||
aWidgetType == NS_THEME_SCROLLBAR_SMALL) &&
!nsLookAndFeel::UseOverlayScrollbars() &&
(aAttribute == nsGkAtoms::curpos ||
aAttribute == nsGkAtoms::minpos ||
aAttribute == nsGkAtoms::maxpos ||
aAttribute == nsGkAtoms::pageincrement)) {
// Non-overlay scrollbars paint the thumb as part of the scrollbar,
// so we need to invalidate the scrollbar when the thumb moves.
*aShouldRepaint = true;
}
}
return NS_OK;

View File

@ -3589,6 +3589,15 @@ nsWindow::UpdateThemeGeometries(const nsTArray<ThemeGeometry>& aThemeGeometries)
}
}
uint32_t
nsWindow::GetMaxTouchPoints() const
{
if (IsWin7OrLater()) {
return GetSystemMetrics(SM_MAXIMUMTOUCHES);
}
return 0;
}
/**************************************************************
**************************************************************
**

View File

@ -197,6 +197,7 @@ public:
virtual void EndRemoteDrawing() MOZ_OVERRIDE;
virtual void UpdateThemeGeometries(const nsTArray<ThemeGeometry>& aThemeGeometries) MOZ_OVERRIDE;
virtual uint32_t GetMaxTouchPoints() const MOZ_OVERRIDE;
/**
* Event helpers

View File

@ -45,6 +45,11 @@
#define SM_CXPADDEDBORDER 92
#endif
// require WINVER >= 0x601
#ifndef SM_MAXIMUMTOUCHES
#define SM_MAXIMUMTOUCHES 95
#endif
#ifndef WM_THEMECHANGED
#define WM_THEMECHANGED 0x031A
#endif