mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Merge inbound to m-c.
This commit is contained in:
commit
f43c59704b
22
configure.in
22
configure.in
@ -1455,8 +1455,12 @@ if test "$GNU_CXX"; then
|
||||
|
||||
# Turn off the following warnings that -Wall turns on:
|
||||
# -Wno-invalid-offsetof - we use offsetof on non-POD types frequently
|
||||
# -Wno-inline-new-delete - we inline 'new' and 'delete' in mozalloc
|
||||
# for performance reasons, and because GCC and clang accept it (though
|
||||
# clang warns about it).
|
||||
#
|
||||
MOZ_CXX_SUPPORTS_WARNING(-Wno-, invalid-offsetof, ac_cxx_has_wno_invalid_offsetof)
|
||||
MOZ_CXX_SUPPORTS_WARNING(-Wno-, inline-new-delete, ac_cxx_has_wno_inline_new_delete)
|
||||
|
||||
if test -z "$INTEL_CXX" -a -z "$CLANG_CXX"; then
|
||||
# Don't use -Wcast-align with ICC or clang
|
||||
@ -5509,6 +5513,8 @@ MOZ_ARG_ENABLE_STRING(gstreamer,
|
||||
# API version, eg 0.10, 1.0 etc
|
||||
if test -z "$enableval" -o "$enableval" = "yes"; then
|
||||
GST_API_VERSION=0.10
|
||||
elif test "$enableval" = "no"; then
|
||||
MOZ_GSTREAMER=
|
||||
else
|
||||
GST_API_VERSION=$enableval
|
||||
fi],
|
||||
@ -7683,14 +7689,6 @@ dnl =
|
||||
dnl ========================================================
|
||||
MOZ_ARG_HEADER(Static build options)
|
||||
|
||||
if test -n "$JS_SHARED_LIBRARY"; then
|
||||
MOZ_JS_LIBS="$MOZ_JS_SHARED_LIBS"
|
||||
else
|
||||
MOZ_JS_LIBS="$MOZ_JS_STATIC_LIBS"
|
||||
AC_DEFINE(MOZ_STATIC_JS)
|
||||
fi
|
||||
AC_SUBST(JS_SHARED_LIBRARY)
|
||||
|
||||
AC_SUBST(LIBXUL_LIBS)
|
||||
XPCOM_LIBS="$LIBXUL_LIBS"
|
||||
|
||||
@ -8746,6 +8744,14 @@ if test -n "$MOZ_NATIVE_ICU"; then
|
||||
MOZ_JS_STATIC_LIBS="$MOZ_JS_STATIC_LIBS $MOZ_ICU_LIBS"
|
||||
fi
|
||||
|
||||
if test -n "$JS_SHARED_LIBRARY"; then
|
||||
MOZ_JS_LIBS="$MOZ_JS_SHARED_LIBS"
|
||||
else
|
||||
MOZ_JS_LIBS="$MOZ_JS_STATIC_LIBS"
|
||||
AC_DEFINE(MOZ_STATIC_JS)
|
||||
fi
|
||||
AC_SUBST(JS_SHARED_LIBRARY)
|
||||
|
||||
MOZ_CREATE_CONFIG_STATUS()
|
||||
|
||||
# No need to run subconfigures when building with LIBXUL_SDK_DIR
|
||||
|
@ -1640,17 +1640,16 @@ public:
|
||||
MOZ_WARN_UNUSED_RESULT
|
||||
static nsresult WrapNative(JSContext *cx, JS::Handle<JSObject*> scope,
|
||||
nsISupports *native, const nsIID* aIID,
|
||||
JS::MutableHandle<JS::Value> vp,
|
||||
bool aAllowWrapping = false)
|
||||
JS::MutableHandle<JS::Value> vp)
|
||||
{
|
||||
return WrapNative(cx, scope, native, nullptr, aIID, vp, aAllowWrapping);
|
||||
return WrapNative(cx, scope, native, nullptr, aIID, vp, true);
|
||||
}
|
||||
|
||||
// Same as the WrapNative above, but use this one if aIID is nsISupports' IID.
|
||||
MOZ_WARN_UNUSED_RESULT
|
||||
static nsresult WrapNative(JSContext *cx, JS::Handle<JSObject*> scope,
|
||||
nsISupports *native, JS::MutableHandle<JS::Value> vp,
|
||||
bool aAllowWrapping = false)
|
||||
bool aAllowWrapping = true)
|
||||
{
|
||||
return WrapNative(cx, scope, native, nullptr, nullptr, vp, aAllowWrapping);
|
||||
}
|
||||
@ -1659,7 +1658,7 @@ public:
|
||||
static nsresult WrapNative(JSContext *cx, JS::Handle<JSObject*> scope,
|
||||
nsISupports *native, nsWrapperCache *cache,
|
||||
JS::MutableHandle<JS::Value> vp,
|
||||
bool aAllowWrapping = false)
|
||||
bool aAllowWrapping = true)
|
||||
{
|
||||
return WrapNative(cx, scope, native, cache, nullptr, vp, aAllowWrapping);
|
||||
}
|
||||
|
@ -5672,7 +5672,7 @@ nsContentUtils::CreateBlobBuffer(JSContext* aCx,
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
JS::Rooted<JSObject*> scope(aCx, JS::CurrentGlobalOrNull(aCx));
|
||||
return nsContentUtils::WrapNative(aCx, scope, blob, aBlob, true);
|
||||
return nsContentUtils::WrapNative(aCx, scope, blob, aBlob);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -11447,7 +11447,7 @@ nsDocument::Evaluate(const nsAString& aExpression, nsIDOMNode* aContextNode,
|
||||
{
|
||||
return XPathEvaluator()->Evaluate(aExpression, aContextNode, aResolver, aType,
|
||||
aInResult, aResult);
|
||||
}
|
||||
}
|
||||
|
||||
// This is just a hack around the fact that window.document is not
|
||||
// [Unforgeable] yet.
|
||||
@ -11477,13 +11477,15 @@ nsIDocument::WrapObject(JSContext *aCx, JS::Handle<JSObject*> aScope)
|
||||
JS::Rooted<JS::Value> winVal(aCx);
|
||||
nsresult rv = nsContentUtils::WrapNative(aCx, obj, win,
|
||||
&NS_GET_IID(nsIDOMWindow),
|
||||
&winVal,
|
||||
false);
|
||||
&winVal);
|
||||
if (NS_FAILED(rv)) {
|
||||
Throw(aCx, rv);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
MOZ_ASSERT(&winVal.toObject() == js::UncheckedUnwrap(&winVal.toObject()),
|
||||
"WrapNative shouldn't create a cross-compartment wrapper");
|
||||
|
||||
NS_NAMED_LITERAL_STRING(doc_str, "document");
|
||||
|
||||
if (!JS_DefineUCProperty(aCx, JSVAL_TO_OBJECT(winVal), doc_str.get(),
|
||||
|
@ -927,7 +927,7 @@ nsFrameMessageManager::ReceiveMessage(nsISupports* aTarget,
|
||||
|
||||
JS::Rooted<JS::Value> targetv(cx);
|
||||
JS::Rooted<JSObject*> global(cx, JS_GetGlobalForObject(cx, object));
|
||||
nsresult rv = nsContentUtils::WrapNative(cx, global, aTarget, &targetv, true);
|
||||
nsresult rv = nsContentUtils::WrapNative(cx, global, aTarget, &targetv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
JS::Rooted<JSObject*> cpows(cx);
|
||||
@ -1018,7 +1018,7 @@ nsFrameMessageManager::ReceiveMessage(nsISupports* aTarget,
|
||||
defaultThisValue = aTarget;
|
||||
}
|
||||
JS::Rooted<JSObject*> global(cx, JS_GetGlobalForObject(cx, object));
|
||||
nsresult rv = nsContentUtils::WrapNative(cx, global, defaultThisValue, &thisValue, true);
|
||||
nsresult rv = nsContentUtils::WrapNative(cx, global, defaultThisValue, &thisValue);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
} else {
|
||||
// If the listener is a JS object which has receiveMessage function:
|
||||
|
@ -992,8 +992,7 @@ nsXMLHttpRequest::GetResponse(JSContext* aCx, ErrorResult& aRv)
|
||||
|
||||
JS::Rooted<JS::Value> result(aCx, JSVAL_NULL);
|
||||
JS::Rooted<JSObject*> scope(aCx, JS::CurrentGlobalOrNull(aCx));
|
||||
aRv = nsContentUtils::WrapNative(aCx, scope, mResponseBlob, &result,
|
||||
true);
|
||||
aRv = nsContentUtils::WrapNative(aCx, scope, mResponseBlob, &result);
|
||||
return result;
|
||||
}
|
||||
case XML_HTTP_RESPONSE_TYPE_DOCUMENT:
|
||||
@ -1004,8 +1003,7 @@ nsXMLHttpRequest::GetResponse(JSContext* aCx, ErrorResult& aRv)
|
||||
|
||||
JS::Rooted<JSObject*> scope(aCx, JS::CurrentGlobalOrNull(aCx));
|
||||
JS::Rooted<JS::Value> result(aCx, JSVAL_NULL);
|
||||
aRv = nsContentUtils::WrapNative(aCx, scope, mResponseXML, &result,
|
||||
true);
|
||||
aRv = nsContentUtils::WrapNative(aCx, scope, mResponseXML, &result);
|
||||
return result;
|
||||
}
|
||||
case XML_HTTP_RESPONSE_TYPE_JSON:
|
||||
|
@ -37,10 +37,11 @@ const JSClass sHTMLDocumentAllClass = {
|
||||
JS_DeletePropertyStub, /* delProperty */
|
||||
nsHTMLDocumentSH::DocumentAllGetProperty, /* getProperty */
|
||||
JS_StrictPropertyStub, /* setProperty */
|
||||
JS_EnumerateStub, /* enumerate */
|
||||
(JSResolveOp)nsHTMLDocumentSH::DocumentAllNewResolve, /* resolve */
|
||||
JS_ConvertStub, /* convert */
|
||||
nsHTMLDocumentSH::ReleaseDocument /* finalize */
|
||||
JS_EnumerateStub,
|
||||
(JSResolveOp)nsHTMLDocumentSH::DocumentAllNewResolve,
|
||||
JS_ConvertStub,
|
||||
nsHTMLDocumentSH::ReleaseDocument,
|
||||
nsHTMLDocumentSH::CallToGetPropMapper
|
||||
};
|
||||
|
||||
namespace mozilla {
|
||||
@ -371,12 +372,14 @@ bool
|
||||
nsHTMLDocumentSH::CallToGetPropMapper(JSContext *cx, unsigned argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
// Handle document.all("foo") style access to document.all.
|
||||
|
||||
if (args.length() != 1) {
|
||||
// XXX: Should throw NS_ERROR_XPC_NOT_ENOUGH_ARGS for argc < 1,
|
||||
// and create a new NS_ERROR_XPC_TOO_MANY_ARGS for argc > 1? IE
|
||||
// accepts nothing other than one arg.
|
||||
xpc::Throw(cx, NS_ERROR_INVALID_ARG);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -386,9 +389,16 @@ nsHTMLDocumentSH::CallToGetPropMapper(JSContext *cx, unsigned argc, jsval *vp)
|
||||
return false;
|
||||
}
|
||||
|
||||
JS::Rooted<JSObject*> self(cx, JS_THIS_OBJECT(cx, vp));
|
||||
if (!self) {
|
||||
return false;
|
||||
// If we are called via document.all(id) instead of document.all.item(i) or
|
||||
// another method, use the document.all callee object as self.
|
||||
JS::Rooted<JSObject*> self(cx);
|
||||
if (args.calleev().isObject() &&
|
||||
JS_GetClass(&args.calleev().toObject()) == &sHTMLDocumentAllClass) {
|
||||
self = &args.calleev().toObject();
|
||||
} else {
|
||||
self = JS_THIS_OBJECT(cx, vp);
|
||||
if (!self)
|
||||
return false;
|
||||
}
|
||||
|
||||
size_t length;
|
||||
|
@ -153,6 +153,16 @@ ChannelMediaResource::OnStartRequest(nsIRequest* aRequest)
|
||||
nsresult rv = aRequest->GetStatus(&status);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (status == NS_BINDING_ABORTED) {
|
||||
// Request was aborted before we had a chance to receive any data, or
|
||||
// even an OnStartRequest(). Close the channel. This is important, as
|
||||
// we don't want to mess up our state, as if we're cloned that would
|
||||
// cause the clone to copy incorrect metadata (like whether we're
|
||||
// infinite for example).
|
||||
CloseChannel();
|
||||
return status;
|
||||
}
|
||||
|
||||
if (element->ShouldCheckAllowOrigin()) {
|
||||
// If the request was cancelled by nsCORSListenerProxy due to failing
|
||||
// the CORS security check, send an error through to the media element.
|
||||
|
@ -1602,7 +1602,7 @@ Navigator::DoNewResolve(JSContext* aCx, JS::Handle<JSObject*> aObject,
|
||||
}
|
||||
|
||||
if (JSVAL_IS_PRIMITIVE(prop_val) && !JSVAL_IS_NULL(prop_val)) {
|
||||
rv = nsContentUtils::WrapNative(aCx, aObject, native, &prop_val, true);
|
||||
rv = nsContentUtils::WrapNative(aCx, aObject, native, &prop_val);
|
||||
|
||||
if (NS_FAILED(rv)) {
|
||||
return Throw(aCx, rv);
|
||||
|
@ -15,7 +15,7 @@
|
||||
"use strict";
|
||||
|
||||
try {
|
||||
document.all.item();
|
||||
document.all();
|
||||
} catch (e) {
|
||||
is(typeof e, "object");
|
||||
is(e.filename, location);
|
||||
|
@ -276,6 +276,25 @@ static uint64_t gContentChildID = 1;
|
||||
// Can't be a static constant.
|
||||
#define MAGIC_PREALLOCATED_APP_MANIFEST_URL NS_LITERAL_STRING("{{template}}")
|
||||
|
||||
static const char* sObserverTopics[] = {
|
||||
"xpcom-shutdown",
|
||||
NS_IPC_IOSERVICE_SET_OFFLINE_TOPIC,
|
||||
"child-memory-reporter-request",
|
||||
"memory-pressure",
|
||||
"child-gc-request",
|
||||
"child-cc-request",
|
||||
"child-mmu-request",
|
||||
"last-pb-context-exited",
|
||||
"file-watcher-update",
|
||||
#ifdef MOZ_WIDGET_GONK
|
||||
NS_VOLUME_STATE_CHANGED,
|
||||
"phone-state-changed",
|
||||
#endif
|
||||
#ifdef ACCESSIBILITY
|
||||
"a11y-init-or-shutdown",
|
||||
#endif
|
||||
};
|
||||
|
||||
/* static */ already_AddRefed<ContentParent>
|
||||
ContentParent::RunNuwaProcess()
|
||||
{
|
||||
@ -652,22 +671,10 @@ ContentParent::Init()
|
||||
{
|
||||
nsCOMPtr<nsIObserverService> obs = mozilla::services::GetObserverService();
|
||||
if (obs) {
|
||||
obs->AddObserver(this, "xpcom-shutdown", false);
|
||||
obs->AddObserver(this, NS_IPC_IOSERVICE_SET_OFFLINE_TOPIC, false);
|
||||
obs->AddObserver(this, "child-memory-reporter-request", false);
|
||||
obs->AddObserver(this, "memory-pressure", false);
|
||||
obs->AddObserver(this, "child-gc-request", false);
|
||||
obs->AddObserver(this, "child-cc-request", false);
|
||||
obs->AddObserver(this, "child-mmu-request", false);
|
||||
obs->AddObserver(this, "last-pb-context-exited", false);
|
||||
obs->AddObserver(this, "file-watcher-update", false);
|
||||
#ifdef MOZ_WIDGET_GONK
|
||||
obs->AddObserver(this, NS_VOLUME_STATE_CHANGED, false);
|
||||
obs->AddObserver(this, "phone-state-changed", false);
|
||||
#endif
|
||||
#ifdef ACCESSIBILITY
|
||||
obs->AddObserver(this, "a11y-init-or-shutdown", false);
|
||||
#endif
|
||||
size_t length = ArrayLength(sObserverTopics);
|
||||
for (size_t i = 0; i < length; ++i) {
|
||||
obs->AddObserver(this, sObserverTopics[i], false);
|
||||
}
|
||||
}
|
||||
Preferences::AddStrongObserver(this, "");
|
||||
nsCOMPtr<nsIThreadInternal>
|
||||
@ -1036,22 +1043,11 @@ ContentParent::ActorDestroy(ActorDestroyReason why)
|
||||
kungFuDeathGrip(static_cast<nsIThreadObserver*>(this));
|
||||
nsCOMPtr<nsIObserverService> obs = mozilla::services::GetObserverService();
|
||||
if (obs) {
|
||||
obs->RemoveObserver(static_cast<nsIObserver*>(this), "xpcom-shutdown");
|
||||
obs->RemoveObserver(static_cast<nsIObserver*>(this), "memory-pressure");
|
||||
obs->RemoveObserver(static_cast<nsIObserver*>(this), "child-memory-reporter-request");
|
||||
obs->RemoveObserver(static_cast<nsIObserver*>(this), NS_IPC_IOSERVICE_SET_OFFLINE_TOPIC);
|
||||
obs->RemoveObserver(static_cast<nsIObserver*>(this), "child-gc-request");
|
||||
obs->RemoveObserver(static_cast<nsIObserver*>(this), "child-cc-request");
|
||||
obs->RemoveObserver(static_cast<nsIObserver*>(this), "child-mmu-request");
|
||||
obs->RemoveObserver(static_cast<nsIObserver*>(this), "last-pb-context-exited");
|
||||
obs->RemoveObserver(static_cast<nsIObserver*>(this), "file-watcher-update");
|
||||
#ifdef MOZ_WIDGET_GONK
|
||||
obs->RemoveObserver(static_cast<nsIObserver*>(this), NS_VOLUME_STATE_CHANGED);
|
||||
obs->RemoveObserver(static_cast<nsIObserver*>(this), "phone-state-changed");
|
||||
#endif
|
||||
#ifdef ACCESSIBILITY
|
||||
obs->RemoveObserver(static_cast<nsIObserver*>(this), "a11y-init-or-shutdown");
|
||||
#endif
|
||||
size_t length = ArrayLength(sObserverTopics);
|
||||
for (size_t i = 0; i < length; ++i) {
|
||||
obs->RemoveObserver(static_cast<nsIObserver*>(this),
|
||||
sObserverTopics[i]);
|
||||
}
|
||||
}
|
||||
|
||||
if (ppm) {
|
||||
|
@ -178,7 +178,8 @@ nsXBLProtoImpl::InitTargetObjects(nsXBLPrototypeBinding* aBinding,
|
||||
bool defineOnGlobal = dom::XULElementBinding::ConstructorEnabled(cx, global);
|
||||
dom::XULElementBinding::GetConstructorObject(cx, global, defineOnGlobal);
|
||||
|
||||
rv = nsContentUtils::WrapNative(cx, global, aBoundElement, &v);
|
||||
rv = nsContentUtils::WrapNative(cx, global, aBoundElement, &v,
|
||||
/* aAllowWrapping = */ false);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
JS::Rooted<JSObject*> value(cx, &v.toObject());
|
||||
|
@ -307,8 +307,7 @@ nsXBLPrototypeHandler::ExecuteHandler(EventTarget* aTarget,
|
||||
// scope if one doesn't already exist, and potentially wraps it cross-
|
||||
// compartment into our scope (via aAllowWrapping=true).
|
||||
JS::Rooted<JS::Value> targetV(cx, JS::UndefinedValue());
|
||||
rv = nsContentUtils::WrapNative(cx, scopeObject, scriptTarget, &targetV,
|
||||
/* aAllowWrapping = */ true);
|
||||
rv = nsContentUtils::WrapNative(cx, scopeObject, scriptTarget, &targetV);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// Next, clone the generic handler to be parented to the target.
|
||||
|
@ -444,10 +444,12 @@ LayerManagerComposite::Render()
|
||||
/** Our more efficient but less powerful alter ego, if one is available. */
|
||||
nsRefPtr<Composer2D> composer2D = mCompositor->GetWidget()->GetComposer2D();
|
||||
|
||||
if (mFPS && composer2D && composer2D->TryRender(mRoot, mWorldMatrix)) {
|
||||
double fps = mFPS->mCompositionFps.AddFrameAndGetFps(TimeStamp::Now());
|
||||
if (gfxPlatform::GetPrefLayersDrawFPS()) {
|
||||
printf_stderr("HWComposer: FPS is %g\n", fps);
|
||||
if (composer2D && composer2D->TryRender(mRoot, mWorldMatrix)) {
|
||||
if (mFPS) {
|
||||
double fps = mFPS->mCompositionFps.AddFrameAndGetFps(TimeStamp::Now());
|
||||
if (gfxPlatform::GetPrefLayersDrawFPS()) {
|
||||
printf_stderr("HWComposer: FPS is %g\n", fps);
|
||||
}
|
||||
}
|
||||
mCompositor->EndFrameForExternalComposition(mWorldMatrix);
|
||||
return;
|
||||
|
@ -1274,12 +1274,30 @@ CairoTextureClientD3D9::Lock(OpenMode)
|
||||
if (!IsValid() || !IsAllocated()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!gfxWindowsPlatform::GetPlatform()->GetD3D9Device()) {
|
||||
// If the device has failed then we should not lock the surface,
|
||||
// even if we could.
|
||||
mD3D9Surface = nullptr;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!mD3D9Surface) {
|
||||
HRESULT hr = mTexture->GetSurfaceLevel(0, getter_AddRefs(mD3D9Surface));
|
||||
if (FAILED(hr)) {
|
||||
NS_WARNING("Failed to get texture surface level.");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
mIsLocked = true;
|
||||
|
||||
if (mNeedsClear) {
|
||||
mDrawTarget = GetAsDrawTarget();
|
||||
mDrawTarget->ClearRect(Rect(0, 0, GetSize().width, GetSize().height));
|
||||
mNeedsClear = false;
|
||||
}
|
||||
mIsLocked = true;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -1318,27 +1336,11 @@ CairoTextureClientD3D9::ToSurfaceDescriptor(SurfaceDescriptor& aOutDescriptor)
|
||||
TemporaryRef<gfx::DrawTarget>
|
||||
CairoTextureClientD3D9::GetAsDrawTarget()
|
||||
{
|
||||
MOZ_ASSERT(mIsLocked && mTexture);
|
||||
MOZ_ASSERT(mIsLocked && mD3D9Surface);
|
||||
if (mDrawTarget) {
|
||||
return mDrawTarget;
|
||||
}
|
||||
|
||||
if (!gfxWindowsPlatform::GetPlatform()->GetD3D9Device()) {
|
||||
// If the device has failed then we should not lock the surface,
|
||||
// even if we could.
|
||||
mD3D9Surface = nullptr;
|
||||
mTexture = nullptr;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (!mD3D9Surface) {
|
||||
HRESULT hr = mTexture->GetSurfaceLevel(0, getter_AddRefs(mD3D9Surface));
|
||||
if (FAILED(hr)) {
|
||||
NS_WARNING("Failed to get texture surface level.");
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
if (ContentForFormat(mFormat) == gfxContentType::COLOR) {
|
||||
mSurface = new gfxWindowsSurface(mD3D9Surface);
|
||||
if (!mSurface || mSurface->CairoStatus()) {
|
||||
|
10
js/src/jit-test/tests/parallel/bug971385.js
Normal file
10
js/src/jit-test/tests/parallel/bug971385.js
Normal file
@ -0,0 +1,10 @@
|
||||
// |jit-test| slow;
|
||||
load(libdir + "asserts.js");
|
||||
|
||||
function f() {
|
||||
Array.buildPar(6, function() {});
|
||||
f();
|
||||
}
|
||||
|
||||
if (getBuildConfiguration().parallelJS)
|
||||
assertThrowsInstanceOf(f, InternalError);
|
@ -975,6 +975,16 @@ InitFromBailout(JSContext *cx, HandleScript caller, jsbytecode *callerPC,
|
||||
IonSpew(IonSpew_BaselineBailouts, " Set resumeAddr=%p", opReturnAddr);
|
||||
}
|
||||
|
||||
if (cx->runtime()->spsProfiler.enabled() && blFrame->hasPushedSPSFrame()) {
|
||||
// Set PC index to 0 for the innermost frame to match what the
|
||||
// interpreter and Baseline do: they update the SPS pc for
|
||||
// JSOP_CALL ops but set it to 0 when running other ops. Ion code
|
||||
// can set the pc to NullPCIndex and this will confuse SPS when
|
||||
// Baseline calls into the VM at non-CALL ops and re-enters JS.
|
||||
IonSpew(IonSpew_BaselineBailouts, " Setting PCidx for last frame to 0");
|
||||
cx->runtime()->spsProfiler.updatePC(script, script->code());
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -1213,7 +1213,7 @@ GetPropertyIC::tryAttachNative(JSContext *cx, IonScript *ion, HandleObject obj,
|
||||
|
||||
*emitted = true;
|
||||
|
||||
MacroAssembler masm(cx, ion);
|
||||
MacroAssembler masm(cx, ion, script_, pc_);
|
||||
SkipRoot skip(cx, &masm);
|
||||
|
||||
RepatchStubAppender attacher(*this);
|
||||
@ -1370,7 +1370,7 @@ GetPropertyIC::tryAttachDOMProxyShadowed(JSContext *cx, IonScript *ion,
|
||||
*emitted = true;
|
||||
|
||||
Label failures;
|
||||
MacroAssembler masm(cx, ion);
|
||||
MacroAssembler masm(cx, ion, script_, pc_);
|
||||
RepatchStubAppender attacher(*this);
|
||||
|
||||
// Guard on the shape of the object.
|
||||
@ -1437,7 +1437,7 @@ GetPropertyIC::tryAttachDOMProxyUnshadowed(JSContext *cx, IonScript *ion, Handle
|
||||
}
|
||||
|
||||
Label failures;
|
||||
MacroAssembler masm(cx, ion);
|
||||
MacroAssembler masm(cx, ion, script_, pc_);
|
||||
RepatchStubAppender attacher(*this);
|
||||
|
||||
// Guard on the shape of the object.
|
||||
@ -1552,7 +1552,7 @@ GetPropertyIC::tryAttachGenericProxy(JSContext *cx, IonScript *ion, HandleObject
|
||||
*emitted = true;
|
||||
|
||||
Label failures;
|
||||
MacroAssembler masm(cx, ion);
|
||||
MacroAssembler masm(cx, ion, script_, pc_);
|
||||
RepatchStubAppender attacher(*this);
|
||||
|
||||
Register scratchReg = output().valueReg().scratchReg();
|
||||
@ -2120,7 +2120,7 @@ SetPropertyIC::attachGenericProxy(JSContext *cx, IonScript *ion, void *returnAdd
|
||||
{
|
||||
JS_ASSERT(!hasGenericProxyStub());
|
||||
|
||||
MacroAssembler masm(cx, ion);
|
||||
MacroAssembler masm(cx, ion, script_, pc_);
|
||||
RepatchStubAppender attacher(*this);
|
||||
|
||||
Label failures;
|
||||
@ -2177,7 +2177,7 @@ SetPropertyIC::attachDOMProxyShadowed(JSContext *cx, IonScript *ion, HandleObjec
|
||||
JS_ASSERT(IsCacheableDOMProxy(obj));
|
||||
|
||||
Label failures;
|
||||
MacroAssembler masm(cx, ion);
|
||||
MacroAssembler masm(cx, ion, script_, pc_);
|
||||
RepatchStubAppender attacher(*this);
|
||||
|
||||
// Guard on the shape of the object.
|
||||
@ -2407,7 +2407,7 @@ SetPropertyIC::attachDOMProxyUnshadowed(JSContext *cx, IonScript *ion, HandleObj
|
||||
JS_ASSERT(IsCacheableDOMProxy(obj));
|
||||
|
||||
Label failures;
|
||||
MacroAssembler masm(cx, ion);
|
||||
MacroAssembler masm(cx, ion, script_, pc_);
|
||||
RepatchStubAppender attacher(*this);
|
||||
|
||||
// Guard on the shape of the object.
|
||||
@ -2462,7 +2462,7 @@ SetPropertyIC::attachCallSetter(JSContext *cx, IonScript *ion,
|
||||
{
|
||||
JS_ASSERT(obj->isNative());
|
||||
|
||||
MacroAssembler masm(cx, ion);
|
||||
MacroAssembler masm(cx, ion, script_, pc_);
|
||||
RepatchStubAppender attacher(*this);
|
||||
|
||||
Label failure;
|
||||
@ -4243,7 +4243,7 @@ bool
|
||||
NameIC::attachCallGetter(JSContext *cx, IonScript *ion, JSObject *obj, JSObject *holder,
|
||||
HandleShape shape, void *returnAddr)
|
||||
{
|
||||
MacroAssembler masm(cx, ion);
|
||||
MacroAssembler masm(cx, ion, script_, pc_);
|
||||
|
||||
RepatchStubAppender attacher(*this);
|
||||
if (!GenerateCallGetter(cx, ion, masm, attacher, obj, name(), holder, shape, liveRegs_,
|
||||
|
@ -172,6 +172,10 @@ class MacroAssembler : public MacroAssemblerSpecific
|
||||
bool enoughMemory_;
|
||||
bool embedsNurseryPointers_;
|
||||
|
||||
// SPS instrumentation, only used for Ion caches.
|
||||
mozilla::Maybe<IonInstrumentation> spsInstrumentation_;
|
||||
jsbytecode *spsPc_;
|
||||
|
||||
private:
|
||||
// This field is used to manage profiling instrumentation output. If
|
||||
// provided and enabled, then instrumentation will be emitted around call
|
||||
@ -212,7 +216,8 @@ class MacroAssembler : public MacroAssemblerSpecific
|
||||
|
||||
// This constructor should only be used when there is no IonContext active
|
||||
// (for example, Trampoline-$(ARCH).cpp and IonCaches.cpp).
|
||||
MacroAssembler(JSContext *cx, IonScript *ion = nullptr)
|
||||
MacroAssembler(JSContext *cx, IonScript *ion = nullptr,
|
||||
JSScript *script = nullptr, jsbytecode *pc = nullptr)
|
||||
: enoughMemory_(true),
|
||||
embedsNurseryPointers_(false),
|
||||
sps_(nullptr)
|
||||
@ -225,8 +230,17 @@ class MacroAssembler : public MacroAssemblerSpecific
|
||||
initWithAllocator();
|
||||
m_buffer.id = GetIonContext()->getNextAssemblerId();
|
||||
#endif
|
||||
if (ion)
|
||||
if (ion) {
|
||||
setFramePushed(ion->frameSize());
|
||||
if (pc && cx->runtime()->spsProfiler.enabled()) {
|
||||
// We have to update the SPS pc when this IC stub calls into
|
||||
// the VM.
|
||||
spsPc_ = pc;
|
||||
spsInstrumentation_.construct(&cx->runtime()->spsProfiler, &spsPc_);
|
||||
sps_ = spsInstrumentation_.addr();
|
||||
sps_->setPushed(script);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// asm.js compilation handles its own IonContet-pushing
|
||||
|
@ -29,6 +29,7 @@ UNIFIED_SOURCES += [
|
||||
'testException.cpp',
|
||||
'testExternalStrings.cpp',
|
||||
'testFindSCCs.cpp',
|
||||
'testFreshGlobalEvalRedefinition.cpp',
|
||||
'testFuncCallback.cpp',
|
||||
'testFunctionProperties.cpp',
|
||||
'testGCExactRooting.cpp',
|
||||
|
47
js/src/jsapi-tests/testFreshGlobalEvalRedefinition.cpp
Normal file
47
js/src/jsapi-tests/testFreshGlobalEvalRedefinition.cpp
Normal file
@ -0,0 +1,47 @@
|
||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
* vim: set ts=8 sts=4 et sw=4 tw=99:
|
||||
*/
|
||||
/* 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/. */
|
||||
|
||||
#include "jsapi-tests/tests.h"
|
||||
|
||||
static bool
|
||||
GlobalEnumerate(JSContext *cx, JS::Handle<JSObject*> obj)
|
||||
{
|
||||
return JS_EnumerateStandardClasses(cx, obj);
|
||||
}
|
||||
|
||||
static bool
|
||||
GlobalResolve(JSContext *cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id)
|
||||
{
|
||||
bool resolved = false;
|
||||
return JS_ResolveStandardClass(cx, obj, id, &resolved);
|
||||
}
|
||||
|
||||
BEGIN_TEST(testRedefineGlobalEval)
|
||||
{
|
||||
static const JSClass cls = {
|
||||
"global", JSCLASS_GLOBAL_FLAGS,
|
||||
JS_PropertyStub, JS_DeletePropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
|
||||
GlobalEnumerate, GlobalResolve, JS_ConvertStub
|
||||
};
|
||||
|
||||
/* Create the global object. */
|
||||
JS::CompartmentOptions options;
|
||||
options.setVersion(JSVERSION_LATEST);
|
||||
JS::Rooted<JSObject*> g(cx, JS_NewGlobalObject(cx, &cls, nullptr, JS::FireOnNewGlobalHook, options));
|
||||
if (!g)
|
||||
return false;
|
||||
|
||||
JSAutoCompartment ac(cx, g);
|
||||
JS::Rooted<JS::Value> v(cx);
|
||||
CHECK(JS_GetProperty(cx, g, "Object", &v));
|
||||
|
||||
static const char data[] = "Object.defineProperty(this, 'eval', { configurable: false });";
|
||||
CHECK(JS_EvaluateScript(cx, g, data, mozilla::ArrayLength(data) - 1, __FILE__, __LINE__, v.address()));
|
||||
|
||||
return true;
|
||||
}
|
||||
END_TEST(testRedefineGlobalEval)
|
@ -27,7 +27,9 @@ CONFIGURE_SUBST_FILES += [
|
||||
'js.pc',
|
||||
]
|
||||
|
||||
if not CONFIG['JS_STANDALONE']:
|
||||
if CONFIG['JS_STANDALONE']:
|
||||
DEFINES['IMPL_MFBT'] = True
|
||||
else:
|
||||
CONFIGURE_SUBST_FILES += [
|
||||
'../../config/autoconf-js.mk',
|
||||
'../../config/emptyvars-js.mk',
|
||||
|
28
js/src/tests/ecma_5/Exceptions/error-expando-reconfigure.js
Normal file
28
js/src/tests/ecma_5/Exceptions/error-expando-reconfigure.js
Normal file
@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/licenses/publicdomain/
|
||||
*/
|
||||
|
||||
var gTestfile = "error-expando-reconfigure.js"
|
||||
//-----------------------------------------------------------------------------
|
||||
var BUGNUMBER = 961494;
|
||||
var summary =
|
||||
"Reconfiguring the first expando property added to an Error object " +
|
||||
"shouldn't assert";
|
||||
|
||||
print(BUGNUMBER + ": " + summary);
|
||||
|
||||
/**************
|
||||
* BEGIN TEST *
|
||||
**************/
|
||||
|
||||
var err = new Error(); // no message argument => no err.message property
|
||||
err.expando = 17;
|
||||
Object.defineProperty(err, "expando", { configurable: false });
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
if (typeof reportCompare === "function")
|
||||
reportCompare(true, true);
|
||||
|
||||
print("Tests complete");
|
@ -130,8 +130,17 @@ SPSProfiler::enter(JSScript *script, JSFunction *maybeFun)
|
||||
if (str == nullptr)
|
||||
return false;
|
||||
|
||||
JS_ASSERT_IF(*size_ > 0 && *size_ - 1 < max_ && stack_[*size_ - 1].js(),
|
||||
stack_[*size_ - 1].pc() != nullptr);
|
||||
#ifdef DEBUG
|
||||
// In debug builds, assert the JS pseudo frames already on the stack
|
||||
// have a non-null pc. Only look at the top frames to avoid quadratic
|
||||
// behavior.
|
||||
if (*size_ > 0 && *size_ - 1 < max_) {
|
||||
size_t start = (*size_ > 4) ? *size_ - 4 : 0;
|
||||
for (size_t i = start; i < *size_ - 1; i++)
|
||||
MOZ_ASSERT_IF(stack_[i].js(), stack_[i].pc() != nullptr);
|
||||
}
|
||||
#endif
|
||||
|
||||
push(str, nullptr, script, script->code());
|
||||
return true;
|
||||
}
|
||||
|
@ -352,10 +352,20 @@ JSObject::getChildPropertyOnDictionary(ThreadSafeContext *cx, JS::HandleObject o
|
||||
return nullptr;
|
||||
child.setSlot(slot);
|
||||
} else {
|
||||
/* Slots can only be allocated out of order on objects in dictionary mode. */
|
||||
/*
|
||||
* Slots can only be allocated out of order on objects in
|
||||
* dictionary mode. Otherwise the child's slot must be after the
|
||||
* parent's slot (if it has one), because slot number determines
|
||||
* slot span for objects with that shape. Usually child slot
|
||||
* *immediately* follows parent slot, but there may be a slot gap
|
||||
* when the object uses some -- but not all -- of its reserved
|
||||
* slots to store properties.
|
||||
*/
|
||||
JS_ASSERT(obj->inDictionaryMode() ||
|
||||
parent->hasMissingSlot() ||
|
||||
child.slot() == parent->maybeSlot() + 1);
|
||||
child.slot() == parent->maybeSlot() + 1 ||
|
||||
(parent->maybeSlot() + 1 < JSSLOT_FREE(obj->getClass()) &&
|
||||
child.slot() == JSSLOT_FREE(obj->getClass())));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -549,6 +549,12 @@ ScriptFrameIter::settleOnActivation()
|
||||
data_.state_ = JIT;
|
||||
return;
|
||||
}
|
||||
|
||||
// ForkJoin activations don't contain iterable frames, so skip them.
|
||||
if (activation->isForkJoin()) {
|
||||
++data_.activations_;
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
|
||||
JS_ASSERT(activation->isInterpreter());
|
||||
|
@ -32,7 +32,7 @@ nsTArrayToJSArray(JSContext* aCx, const nsTArray<T>& aSourceArray,
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
JS::RootedValue wrappedVal(aCx);
|
||||
rv = nsContentUtils::WrapNative(aCx, global, obj, &wrappedVal, true);
|
||||
rv = nsContentUtils::WrapNative(aCx, global, obj, &wrappedVal);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (!JS_SetElement(aCx, arrayObj, index, wrappedVal)) {
|
||||
|
@ -379,8 +379,6 @@ XPCConvert::JSData2Native(void* d, HandleValue s,
|
||||
{
|
||||
NS_PRECONDITION(d, "bad param");
|
||||
|
||||
bool isDOMString = true;
|
||||
|
||||
AutoJSContext cx;
|
||||
if (pErr)
|
||||
*pErr = NS_ERROR_XPC_BAD_CONVERT_JS;
|
||||
@ -473,81 +471,62 @@ XPCConvert::JSData2Native(void* d, HandleValue s,
|
||||
|
||||
case nsXPTType::T_ASTRING:
|
||||
{
|
||||
isDOMString = false;
|
||||
if (JSVAL_IS_VOID(s)) {
|
||||
if (useAllocator)
|
||||
*((const nsAString**)d) = &NullString();
|
||||
else
|
||||
(**((nsAString**)d)).SetIsVoid(true);
|
||||
return true;
|
||||
}
|
||||
// Fall through to T_DOMSTRING case.
|
||||
}
|
||||
case nsXPTType::T_DOMSTRING:
|
||||
{
|
||||
static const char16_t EMPTY_STRING[] = { '\0' };
|
||||
static const char16_t VOID_STRING[] = { 'u', 'n', 'd', 'e', 'f', 'i', 'n', 'e', 'd', '\0' };
|
||||
|
||||
if (JSVAL_IS_NULL(s)) {
|
||||
if (useAllocator)
|
||||
*((const nsAString**)d) = &NullString();
|
||||
else
|
||||
(**((nsAString**)d)).SetIsVoid(true);
|
||||
return true;
|
||||
}
|
||||
size_t length = 0;
|
||||
const char16_t* chars = nullptr;
|
||||
JSString* str = nullptr;
|
||||
bool isNewString = false;
|
||||
uint32_t length = 0;
|
||||
|
||||
if (JSVAL_IS_VOID(s)) {
|
||||
if (isDOMString) {
|
||||
chars = VOID_STRING;
|
||||
length = ArrayLength(VOID_STRING) - 1;
|
||||
} else {
|
||||
chars = EMPTY_STRING;
|
||||
length = 0;
|
||||
}
|
||||
} else if (!JSVAL_IS_NULL(s)) {
|
||||
if (!JSVAL_IS_VOID(s)) {
|
||||
str = ToString(cx, s);
|
||||
if (!str)
|
||||
return false;
|
||||
|
||||
length = (uint32_t) JS_GetStringLength(str);
|
||||
if (length) {
|
||||
chars = JS_GetStringCharsZ(cx, str);
|
||||
if (!chars)
|
||||
return false;
|
||||
if (STRING_TO_JSVAL(str) != s)
|
||||
isNewString = true;
|
||||
} else {
|
||||
str = nullptr;
|
||||
chars = EMPTY_STRING;
|
||||
chars = useAllocator ? JS_GetStringCharsZAndLength(cx, str, &length)
|
||||
: JS_GetStringCharsAndLength(cx, str, &length);
|
||||
if (!chars)
|
||||
return false;
|
||||
|
||||
if (!length) {
|
||||
if (useAllocator)
|
||||
*((const nsAString**)d) = &EmptyString();
|
||||
else
|
||||
(**((nsAString**)d)).Truncate();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
nsString* ws;
|
||||
if (useAllocator) {
|
||||
// XXX extra string copy when isNewString
|
||||
if (str && !isNewString) {
|
||||
size_t strLength;
|
||||
const jschar *strChars = JS_GetStringCharsZAndLength(cx, str, &strLength);
|
||||
if (!strChars)
|
||||
return false;
|
||||
|
||||
XPCReadableJSStringWrapper *wrapper =
|
||||
nsXPConnect::GetRuntimeInstance()->NewStringWrapper(strChars, strLength);
|
||||
if (!wrapper)
|
||||
return false;
|
||||
|
||||
*((const nsAString**)d) = wrapper;
|
||||
} else if (JSVAL_IS_NULL(s)) {
|
||||
XPCReadableJSStringWrapper *wrapper =
|
||||
new XPCReadableJSStringWrapper();
|
||||
if (!wrapper)
|
||||
return false;
|
||||
|
||||
*((const nsAString**)d) = wrapper;
|
||||
} else {
|
||||
// use nsString to encourage sharing
|
||||
const nsAString *rs = new nsString(chars, length);
|
||||
if (!rs)
|
||||
return false;
|
||||
*((const nsAString**)d) = rs;
|
||||
}
|
||||
ws = nsXPConnect::GetRuntimeInstance()->NewShortLivedString();
|
||||
*((const nsString**)d) = ws;
|
||||
} else {
|
||||
nsAString* ws = *((nsAString**)d);
|
||||
ws = *((nsString**)d);
|
||||
}
|
||||
|
||||
if (JSVAL_IS_NULL(s) || (!isDOMString && JSVAL_IS_VOID(s))) {
|
||||
ws->Truncate();
|
||||
ws->SetIsVoid(true);
|
||||
} else
|
||||
ws->Assign(chars, length);
|
||||
if (!str) {
|
||||
ws->AssignLiteral(MOZ_UTF16("undefined"));
|
||||
} else if (useAllocator && STRING_TO_JSVAL(str) == s) {
|
||||
// The JS string will exist over the function call.
|
||||
// We don't need to copy the characters in this case.
|
||||
ws->Rebind(chars, length);
|
||||
} else {
|
||||
ws->Assign(chars, length);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@ -622,20 +601,14 @@ XPCConvert::JSData2Native(void* d, HandleValue s,
|
||||
case nsXPTType::T_UTF8STRING:
|
||||
{
|
||||
const jschar* chars;
|
||||
uint32_t length;
|
||||
size_t length;
|
||||
JSString* str;
|
||||
|
||||
if (JSVAL_IS_NULL(s) || JSVAL_IS_VOID(s)) {
|
||||
if (useAllocator) {
|
||||
nsACString *rs = new nsCString();
|
||||
if (!rs)
|
||||
return false;
|
||||
|
||||
rs->SetIsVoid(true);
|
||||
*((nsACString**)d) = rs;
|
||||
*((const nsACString**)d) = &NullCString();
|
||||
} else {
|
||||
nsCString* rs = *((nsCString**)d);
|
||||
rs->Truncate();
|
||||
rs->SetIsVoid(true);
|
||||
}
|
||||
return true;
|
||||
@ -644,11 +617,19 @@ XPCConvert::JSData2Native(void* d, HandleValue s,
|
||||
// The JS val is neither null nor void...
|
||||
|
||||
if (!(str = ToString(cx, s))||
|
||||
!(chars = JS_GetStringCharsZ(cx, str))) {
|
||||
!(chars = JS_GetStringCharsAndLength(cx, str, &length))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
length = JS_GetStringLength(str);
|
||||
if (!length) {
|
||||
if (useAllocator) {
|
||||
*((const nsACString**)d) = &EmptyCString();
|
||||
} else {
|
||||
nsCString* rs = *((nsCString**)d);
|
||||
rs->Truncate();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
nsCString *rs;
|
||||
if (useAllocator) {
|
||||
@ -661,9 +642,7 @@ XPCConvert::JSData2Native(void* d, HandleValue s,
|
||||
} else {
|
||||
rs = *((nsCString**)d);
|
||||
}
|
||||
const char16_t* start = (const char16_t*)chars;
|
||||
const char16_t* end = start + length;
|
||||
CopyUTF16toUTF8(nsDependentSubstring(start, end), *rs);
|
||||
CopyUTF16toUTF8(Substring(chars, length), *rs);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -696,6 +675,16 @@ XPCConvert::JSData2Native(void* d, HandleValue s,
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!length) {
|
||||
if (useAllocator) {
|
||||
*((const nsACString**)d) = &EmptyCString();
|
||||
} else {
|
||||
nsCString* rs = *((nsCString**)d);
|
||||
rs->Truncate();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
nsACString *rs;
|
||||
if (useAllocator) {
|
||||
rs = new nsCString();
|
||||
|
@ -1415,38 +1415,32 @@ XPCJSRuntime::SizeOfIncludingThis(MallocSizeOf mallocSizeOf)
|
||||
return n;
|
||||
}
|
||||
|
||||
XPCReadableJSStringWrapper *
|
||||
XPCJSRuntime::NewStringWrapper(const char16_t *str, uint32_t len)
|
||||
nsString*
|
||||
XPCJSRuntime::NewShortLivedString()
|
||||
{
|
||||
for (uint32_t i = 0; i < XPCCCX_STRING_CACHE_SIZE; ++i) {
|
||||
StringWrapperEntry& ent = mScratchStrings[i];
|
||||
|
||||
if (!ent.mInUse) {
|
||||
ent.mInUse = true;
|
||||
|
||||
// Construct the string using placement new.
|
||||
|
||||
return new (ent.mString.addr()) XPCReadableJSStringWrapper(str, len);
|
||||
if (mScratchStrings[i].empty()) {
|
||||
mScratchStrings[i].construct();
|
||||
return mScratchStrings[i].addr();
|
||||
}
|
||||
}
|
||||
|
||||
// All our internal string wrappers are used, allocate a new string.
|
||||
|
||||
return new XPCReadableJSStringWrapper(str, len);
|
||||
return new nsString();
|
||||
}
|
||||
|
||||
void
|
||||
XPCJSRuntime::DeleteString(nsAString *string)
|
||||
XPCJSRuntime::DeleteShortLivedString(nsString *string)
|
||||
{
|
||||
if (string == &EmptyString() || string == &NullString())
|
||||
return;
|
||||
|
||||
for (uint32_t i = 0; i < XPCCCX_STRING_CACHE_SIZE; ++i) {
|
||||
StringWrapperEntry& ent = mScratchStrings[i];
|
||||
if (string == ent.mString.addr()) {
|
||||
if (!mScratchStrings[i].empty() &&
|
||||
mScratchStrings[i].addr() == string) {
|
||||
// One of our internal strings is no longer in use, mark
|
||||
// it as such and destroy the string.
|
||||
|
||||
ent.mInUse = false;
|
||||
ent.mString.addr()->~XPCReadableJSStringWrapper();
|
||||
|
||||
// it as such and free its data.
|
||||
mScratchStrings[i].destroy();
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -1566,7 +1560,7 @@ XPCJSRuntime::~XPCJSRuntime()
|
||||
|
||||
#ifdef DEBUG
|
||||
for (uint32_t i = 0; i < XPCCCX_STRING_CACHE_SIZE; ++i) {
|
||||
MOZ_ASSERT(!mScratchStrings[i].mInUse, "Uh, string wrapper still in use!");
|
||||
MOZ_ASSERT(mScratchStrings[i].empty(), "Short lived string still in use");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
@ -51,6 +51,7 @@
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_CRASHREPORTER
|
||||
#include "nsExceptionHandler.h"
|
||||
#include "nsICrashReporter.h"
|
||||
#endif
|
||||
|
||||
@ -68,7 +69,7 @@ public:
|
||||
~XPCShellDirProvider() { }
|
||||
|
||||
// The platform resource folder
|
||||
bool SetGREDir(const char *dir);
|
||||
void SetGREDir(nsIFile *greDir);
|
||||
void ClearGREDir() { mGREDir = nullptr; }
|
||||
// The application resource folder
|
||||
void SetAppDir(nsIFile *appFile);
|
||||
@ -1364,16 +1365,32 @@ XRE_XPCShellMain(int argc, char **argv, char **envp)
|
||||
|
||||
dirprovider.SetAppFile(appFile);
|
||||
|
||||
nsCOMPtr<nsIFile> greDir;
|
||||
if (argc > 1 && !strcmp(argv[1], "-g")) {
|
||||
if (argc < 3)
|
||||
return usage();
|
||||
|
||||
if (!dirprovider.SetGREDir(argv[2])) {
|
||||
printf("SetGREDir failed.\n");
|
||||
rv = XRE_GetFileFromPath(argv[2], getter_AddRefs(greDir));
|
||||
if (NS_FAILED(rv)) {
|
||||
printf("Couldn't use given GRE dir.\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
dirprovider.SetGREDir(greDir);
|
||||
|
||||
argc -= 2;
|
||||
argv += 2;
|
||||
} else {
|
||||
nsAutoString workingDir;
|
||||
if (!GetCurrentWorkingDirectory(workingDir)) {
|
||||
printf("GetCurrentWorkingDirectory failed.\n");
|
||||
return 1;
|
||||
}
|
||||
rv = NS_NewLocalFile(workingDir, true, getter_AddRefs(greDir));
|
||||
if (NS_FAILED(rv)) {
|
||||
printf("NS_NewLocalFile failed.\n");
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (argc > 1 && !strcmp(argv[1], "-a")) {
|
||||
@ -1411,10 +1428,15 @@ XRE_XPCShellMain(int argc, char **argv, char **envp)
|
||||
}
|
||||
|
||||
#ifdef MOZ_CRASHREPORTER
|
||||
// This is needed during startup and also shutdown, so keep it out
|
||||
// of the nested scope.
|
||||
// Special exception: will remain usable after NS_ShutdownXPCOM
|
||||
nsCOMPtr<nsICrashReporter> crashReporter;
|
||||
const char *val = getenv("MOZ_CRASHREPORTER");
|
||||
if (val && *val) {
|
||||
rv = CrashReporter::SetExceptionHandler(greDir, true);
|
||||
if (NS_FAILED(rv)) {
|
||||
printf("CrashReporter::SetExceptionHandler failed!\n");
|
||||
return 1;
|
||||
}
|
||||
MOZ_ASSERT(CrashReporter::GetEnabled());
|
||||
}
|
||||
#endif
|
||||
|
||||
{
|
||||
@ -1442,14 +1464,6 @@ XRE_XPCShellMain(int argc, char **argv, char **envp)
|
||||
return 1;
|
||||
}
|
||||
|
||||
#ifdef MOZ_CRASHREPORTER
|
||||
const char *val = getenv("MOZ_CRASHREPORTER");
|
||||
crashReporter = do_GetService("@mozilla.org/toolkit/crash-reporter;1");
|
||||
if (val && *val) {
|
||||
crashReporter->SetEnabled(true);
|
||||
}
|
||||
#endif
|
||||
|
||||
nsCOMPtr<nsIJSRuntimeService> rtsvc = do_GetService("@mozilla.org/js/xpc/RuntimeService;1");
|
||||
// get the JSRuntime from the runtime svc
|
||||
if (!rtsvc) {
|
||||
@ -1618,10 +1632,8 @@ XRE_XPCShellMain(int argc, char **argv, char **envp)
|
||||
|
||||
#ifdef MOZ_CRASHREPORTER
|
||||
// Shut down the crashreporter service to prevent leaking some strings it holds.
|
||||
if (crashReporter) {
|
||||
crashReporter->SetEnabled(false);
|
||||
crashReporter = nullptr;
|
||||
}
|
||||
if (CrashReporter::GetEnabled())
|
||||
CrashReporter::UnsetExceptionHandler();
|
||||
#endif
|
||||
|
||||
NS_LogTerm();
|
||||
@ -1629,11 +1641,10 @@ XRE_XPCShellMain(int argc, char **argv, char **envp)
|
||||
return result;
|
||||
}
|
||||
|
||||
bool
|
||||
XPCShellDirProvider::SetGREDir(const char *dir)
|
||||
void
|
||||
XPCShellDirProvider::SetGREDir(nsIFile* greDir)
|
||||
{
|
||||
nsresult rv = XRE_GetFileFromPath(dir, getter_AddRefs(mGREDir));
|
||||
return NS_SUCCEEDED(rv);
|
||||
mGREDir = greDir;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -2311,11 +2311,15 @@ CallMethodHelper::CleanupParam(nsXPTCMiniVariant& param, nsXPTType& type)
|
||||
break;
|
||||
case nsXPTType::T_ASTRING:
|
||||
case nsXPTType::T_DOMSTRING:
|
||||
nsXPConnect::GetRuntimeInstance()->DeleteString((nsAString*)param.val.p);
|
||||
nsXPConnect::GetRuntimeInstance()->DeleteShortLivedString((nsString*)param.val.p);
|
||||
break;
|
||||
case nsXPTType::T_UTF8STRING:
|
||||
case nsXPTType::T_CSTRING:
|
||||
delete (nsCString*) param.val.p;
|
||||
{
|
||||
nsCString* rs = (nsCString*)param.val.p;
|
||||
if (rs != &EmptyCString() && rs != &NullCString())
|
||||
delete rs;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
MOZ_ASSERT(!type.IsArithmetic(), "Cleanup requested on unexpected type.");
|
||||
@ -2363,10 +2367,10 @@ CallMethodHelper::HandleDipperParam(nsXPTCVariant* dp,
|
||||
type_tag == nsXPTType::T_CSTRING,
|
||||
"Unexpected dipper type!");
|
||||
|
||||
// ASTRING and DOMSTRING are very similar, and both use nsAutoString.
|
||||
// ASTRING and DOMSTRING are very similar, and both use nsString.
|
||||
// UTF8_STRING and CSTRING are also quite similar, and both use nsCString.
|
||||
if (type_tag == nsXPTType::T_ASTRING || type_tag == nsXPTType::T_DOMSTRING)
|
||||
dp->val.p = new nsAutoString();
|
||||
dp->val.p = nsXPConnect::GetRuntimeInstance()->NewShortLivedString();
|
||||
else
|
||||
dp->val.p = new nsCString();
|
||||
|
||||
|
@ -548,7 +548,7 @@ nsXPConnect::WrapNative(JSContext * aJSContext,
|
||||
RootedObject aScope(aJSContext, aScopeArg);
|
||||
RootedValue v(aJSContext);
|
||||
return NativeInterface2JSObject(aScope, aCOMObj, nullptr, &aIID,
|
||||
false, &v, aHolder);
|
||||
true, &v, aHolder);
|
||||
}
|
||||
|
||||
/* void wrapNativeToJSVal (in JSContextPtr aJSContext, in JSObjectPtr aScope, in nsISupports aCOMObj, in nsIIDPtr aIID, out jsval aVal, out nsIXPConnectJSObjectHolder aHolder); */
|
||||
|
@ -80,6 +80,7 @@
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/CycleCollectedJSRuntime.h"
|
||||
#include "mozilla/GuardObjects.h"
|
||||
#include "mozilla/Maybe.h"
|
||||
#include "mozilla/MemoryReporting.h"
|
||||
|
||||
#include <math.h>
|
||||
@ -393,33 +394,6 @@ private:
|
||||
|
||||
/***************************************************************************/
|
||||
|
||||
// class to export a JSString as an const nsAString, no refcounting :(
|
||||
class XPCReadableJSStringWrapper : public nsDependentString
|
||||
{
|
||||
public:
|
||||
typedef nsDependentString::char_traits char_traits;
|
||||
|
||||
XPCReadableJSStringWrapper(const char16_t *chars, size_t length) :
|
||||
nsDependentString(chars, length)
|
||||
{ }
|
||||
|
||||
XPCReadableJSStringWrapper() :
|
||||
nsDependentString(char_traits::sEmptyBuffer, char_traits::sEmptyBuffer)
|
||||
{ SetIsVoid(true); }
|
||||
|
||||
bool init(JSContext* aContext, JSString* str)
|
||||
{
|
||||
size_t length;
|
||||
const jschar* chars = JS_GetStringCharsZAndLength(aContext, str, &length);
|
||||
if (!chars)
|
||||
return false;
|
||||
|
||||
MOZ_ASSERT(IsEmpty(), "init() on initialized string");
|
||||
new(static_cast<nsDependentString *>(this)) nsDependentString(chars, length);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
// In the current xpconnect system there can only be one XPCJSRuntime.
|
||||
// So, xpconnect can only be used on one JSRuntime within the process.
|
||||
|
||||
@ -580,8 +554,8 @@ public:
|
||||
|
||||
~XPCJSRuntime();
|
||||
|
||||
XPCReadableJSStringWrapper *NewStringWrapper(const char16_t *str, uint32_t len);
|
||||
void DeleteString(nsAString *string);
|
||||
nsString* NewShortLivedString();
|
||||
void DeleteShortLivedString(nsString *string);
|
||||
|
||||
void AddGCCallback(xpcGCCallback cb);
|
||||
void RemoveGCCallback(xpcGCCallback cb);
|
||||
@ -646,20 +620,7 @@ private:
|
||||
|
||||
#define XPCCCX_STRING_CACHE_SIZE 2
|
||||
|
||||
// String wrapper entry, holds a string, and a boolean that tells
|
||||
// whether the string is in use or not.
|
||||
//
|
||||
// NB: The string is not stored by value so that we avoid the cost of
|
||||
// construction/destruction.
|
||||
struct StringWrapperEntry
|
||||
{
|
||||
StringWrapperEntry() : mInUse(false) { }
|
||||
|
||||
mozilla::AlignedStorage2<XPCReadableJSStringWrapper> mString;
|
||||
bool mInUse;
|
||||
};
|
||||
|
||||
StringWrapperEntry mScratchStrings[XPCCCX_STRING_CACHE_SIZE];
|
||||
mozilla::Maybe<nsString> mScratchStrings[XPCCCX_STRING_CACHE_SIZE];
|
||||
|
||||
friend class Watchdog;
|
||||
friend class AutoLockWatchdog;
|
||||
|
@ -2392,68 +2392,64 @@ nsCSSFrameConstructor::ConstructDocElementFrame(Element* aDocEle
|
||||
else
|
||||
#endif
|
||||
if (aDocElement->IsSVG()) {
|
||||
if (aDocElement->Tag() == nsGkAtoms::svg) {
|
||||
// We're going to call the right function ourselves, so no need to give a
|
||||
// function to this FrameConstructionData.
|
||||
|
||||
// XXXbz on the other hand, if we converted this whole function to
|
||||
// FrameConstructionData/Item, then we'd need the right function
|
||||
// here... but would probably be able to get away with less code in this
|
||||
// function in general.
|
||||
// Use a null PendingBinding, since our binding is not in fact pending.
|
||||
static const FrameConstructionData rootSVGData = FCDATA_DECL(0, nullptr);
|
||||
nsRefPtr<nsStyleContext> extraRef(styleContext);
|
||||
FrameConstructionItem item(&rootSVGData, aDocElement,
|
||||
aDocElement->Tag(), kNameSpaceID_SVG,
|
||||
nullptr, extraRef.forget(), true, nullptr);
|
||||
|
||||
nsFrameItems frameItems;
|
||||
contentFrame = ConstructOuterSVG(state, item, mDocElementContainingBlock,
|
||||
styleContext->StyleDisplay(),
|
||||
frameItems);
|
||||
newFrame = frameItems.FirstChild();
|
||||
NS_ASSERTION(frameItems.OnlyChild(), "multiple root element frames");
|
||||
} else {
|
||||
if (aDocElement->Tag() != nsGkAtoms::svg) {
|
||||
return nullptr;
|
||||
}
|
||||
// We're going to call the right function ourselves, so no need to give a
|
||||
// function to this FrameConstructionData.
|
||||
|
||||
// XXXbz on the other hand, if we converted this whole function to
|
||||
// FrameConstructionData/Item, then we'd need the right function
|
||||
// here... but would probably be able to get away with less code in this
|
||||
// function in general.
|
||||
// Use a null PendingBinding, since our binding is not in fact pending.
|
||||
static const FrameConstructionData rootSVGData = FCDATA_DECL(0, nullptr);
|
||||
nsRefPtr<nsStyleContext> extraRef(styleContext);
|
||||
FrameConstructionItem item(&rootSVGData, aDocElement,
|
||||
aDocElement->Tag(), kNameSpaceID_SVG,
|
||||
nullptr, extraRef.forget(), true, nullptr);
|
||||
|
||||
nsFrameItems frameItems;
|
||||
contentFrame = ConstructOuterSVG(state, item, mDocElementContainingBlock,
|
||||
styleContext->StyleDisplay(),
|
||||
frameItems);
|
||||
newFrame = frameItems.FirstChild();
|
||||
NS_ASSERTION(frameItems.OnlyChild(), "multiple root element frames");
|
||||
} else if (display->mDisplay == NS_STYLE_DISPLAY_TABLE) {
|
||||
// We're going to call the right function ourselves, so no need to give a
|
||||
// function to this FrameConstructionData.
|
||||
|
||||
// XXXbz on the other hand, if we converted this whole function to
|
||||
// FrameConstructionData/Item, then we'd need the right function
|
||||
// here... but would probably be able to get away with less code in this
|
||||
// function in general.
|
||||
// Use a null PendingBinding, since our binding is not in fact pending.
|
||||
static const FrameConstructionData rootTableData = FCDATA_DECL(0, nullptr);
|
||||
nsRefPtr<nsStyleContext> extraRef(styleContext);
|
||||
FrameConstructionItem item(&rootTableData, aDocElement,
|
||||
aDocElement->Tag(), kNameSpaceID_None,
|
||||
nullptr, extraRef.forget(), true, nullptr);
|
||||
|
||||
nsFrameItems frameItems;
|
||||
// if the document is a table then just populate it.
|
||||
contentFrame = ConstructTable(state, item, mDocElementContainingBlock,
|
||||
styleContext->StyleDisplay(),
|
||||
frameItems);
|
||||
newFrame = frameItems.FirstChild();
|
||||
NS_ASSERTION(frameItems.OnlyChild(), "multiple root element frames");
|
||||
} else {
|
||||
bool docElemIsTable = (display->mDisplay == NS_STYLE_DISPLAY_TABLE);
|
||||
if (docElemIsTable) {
|
||||
// We're going to call the right function ourselves, so no need to give a
|
||||
// function to this FrameConstructionData.
|
||||
|
||||
// XXXbz on the other hand, if we converted this whole function to
|
||||
// FrameConstructionData/Item, then we'd need the right function
|
||||
// here... but would probably be able to get away with less code in this
|
||||
// function in general.
|
||||
// Use a null PendingBinding, since our binding is not in fact pending.
|
||||
static const FrameConstructionData rootTableData = FCDATA_DECL(0, nullptr);
|
||||
nsRefPtr<nsStyleContext> extraRef(styleContext);
|
||||
FrameConstructionItem item(&rootTableData, aDocElement,
|
||||
aDocElement->Tag(), kNameSpaceID_None,
|
||||
nullptr, extraRef.forget(), true, nullptr);
|
||||
|
||||
nsFrameItems frameItems;
|
||||
// if the document is a table then just populate it.
|
||||
contentFrame = ConstructTable(state, item, mDocElementContainingBlock,
|
||||
styleContext->StyleDisplay(),
|
||||
frameItems);
|
||||
newFrame = frameItems.FirstChild();
|
||||
NS_ASSERTION(frameItems.OnlyChild(), "multiple root element frames");
|
||||
} else {
|
||||
contentFrame = NS_NewBlockFormattingContext(mPresShell, styleContext);
|
||||
nsFrameItems frameItems;
|
||||
// Use a null PendingBinding, since our binding is not in fact pending.
|
||||
ConstructBlock(state, display, aDocElement,
|
||||
state.GetGeometricParent(display,
|
||||
mDocElementContainingBlock),
|
||||
mDocElementContainingBlock, styleContext,
|
||||
&contentFrame, frameItems,
|
||||
display->IsPositioned(contentFrame) ? contentFrame : nullptr,
|
||||
nullptr);
|
||||
newFrame = frameItems.FirstChild();
|
||||
NS_ASSERTION(frameItems.OnlyChild(), "multiple root element frames");
|
||||
}
|
||||
contentFrame = NS_NewBlockFormattingContext(mPresShell, styleContext);
|
||||
nsFrameItems frameItems;
|
||||
// Use a null PendingBinding, since our binding is not in fact pending.
|
||||
ConstructBlock(state, display, aDocElement,
|
||||
state.GetGeometricParent(display,
|
||||
mDocElementContainingBlock),
|
||||
mDocElementContainingBlock, styleContext,
|
||||
&contentFrame, frameItems,
|
||||
display->IsPositioned(contentFrame) ? contentFrame : nullptr,
|
||||
nullptr);
|
||||
newFrame = frameItems.FirstChild();
|
||||
NS_ASSERTION(frameItems.OnlyChild(), "multiple root element frames");
|
||||
}
|
||||
|
||||
MOZ_ASSERT(newFrame);
|
||||
|
@ -192,6 +192,21 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
// For unicode-bidi: plaintext, reset the direction of the writing mode from
|
||||
// the bidi paragraph level of the content
|
||||
|
||||
//XXX change uint8_t to UBiDiLevel after bug 924851
|
||||
void SetDirectionFromBidiLevel(uint8_t level)
|
||||
{
|
||||
if (level & 1) {
|
||||
// odd level, set RTL
|
||||
mWritingMode |= eBidiMask;
|
||||
} else {
|
||||
// even level, set LTR
|
||||
mWritingMode &= ~eBidiMask;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Compare two WritingModes for equality.
|
||||
*/
|
||||
|
@ -3087,9 +3087,11 @@ nsFlexContainerFrame::DoFlexLayout(nsPresContext* aPresContext,
|
||||
/* virtual */ nscoord
|
||||
nsFlexContainerFrame::GetMinWidth(nsRenderingContext* aRenderingContext)
|
||||
{
|
||||
nscoord minWidth = 0;
|
||||
DISPLAY_MIN_WIDTH(this, minWidth);
|
||||
|
||||
FlexboxAxisTracker axisTracker(this);
|
||||
|
||||
nscoord minWidth = 0;
|
||||
for (nsFrameList::Enumerator e(mFrames); !e.AtEnd(); e.Next()) {
|
||||
nscoord childMinWidth =
|
||||
nsLayoutUtils::IntrinsicForContainer(aRenderingContext, e.get(),
|
||||
@ -3111,6 +3113,9 @@ nsFlexContainerFrame::GetMinWidth(nsRenderingContext* aRenderingContext)
|
||||
/* virtual */ nscoord
|
||||
nsFlexContainerFrame::GetPrefWidth(nsRenderingContext* aRenderingContext)
|
||||
{
|
||||
nscoord prefWidth = 0;
|
||||
DISPLAY_PREF_WIDTH(this, prefWidth);
|
||||
|
||||
// XXXdholbert Optimization: We could cache our intrinsic widths like
|
||||
// nsBlockFrame does (and return it early from this function if it's set).
|
||||
// Whenever anything happens that might change it, set it to
|
||||
@ -3118,7 +3123,6 @@ nsFlexContainerFrame::GetPrefWidth(nsRenderingContext* aRenderingContext)
|
||||
// does)
|
||||
FlexboxAxisTracker axisTracker(this);
|
||||
|
||||
nscoord prefWidth = 0;
|
||||
for (nsFrameList::Enumerator e(mFrames); !e.AtEnd(); e.Next()) {
|
||||
nscoord childPrefWidth =
|
||||
nsLayoutUtils::IntrinsicForContainer(aRenderingContext, e.get(),
|
||||
|
@ -686,6 +686,15 @@ public:
|
||||
nsRect GetRectRelativeToSelf() const {
|
||||
return nsRect(nsPoint(0, 0), mRect.Size());
|
||||
}
|
||||
/**
|
||||
* Rect and position in logical coordinates in the frame's writing mode
|
||||
*/
|
||||
mozilla::LogicalRect GetLogicalRect(nscoord aContainerWidth) const {
|
||||
return mozilla::LogicalRect(GetWritingMode(), GetRect(), aContainerWidth);
|
||||
}
|
||||
mozilla::LogicalPoint GetLogicalPosition(nscoord aContainerWidth) const {
|
||||
return GetLogicalRect(aContainerWidth).Origin(GetWritingMode());
|
||||
}
|
||||
|
||||
/**
|
||||
* When we change the size of the frame's border-box rect, we may need to
|
||||
@ -703,6 +712,22 @@ public:
|
||||
mRect = aRect;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Set this frame's rect from a logical rect in its own writing direction
|
||||
*/
|
||||
void SetRectFromLogicalRect(const mozilla::LogicalRect& aRect,
|
||||
nscoord aContainerWidth) {
|
||||
SetRectFromLogicalRect(GetWritingMode(), aRect, aContainerWidth);
|
||||
}
|
||||
/**
|
||||
* Set this frame's rect from a logical rect in a different writing direction
|
||||
* (GetPhysicalRect will assert if the writing mode doesn't match)
|
||||
*/
|
||||
void SetRectFromLogicalRect(mozilla::WritingMode aWritingMode,
|
||||
const mozilla::LogicalRect& aRect,
|
||||
nscoord aContainerWidth) {
|
||||
SetRect(aRect.GetPhysicalRect(aWritingMode, aContainerWidth));
|
||||
}
|
||||
void SetSize(const nsSize& aSize) {
|
||||
SetRect(nsRect(mRect.TopLeft(), aSize));
|
||||
}
|
||||
|
@ -2890,7 +2890,7 @@ public:
|
||||
const gfxSkipCharsIterator& GetEndHint() { return mTempIterator; }
|
||||
|
||||
protected:
|
||||
void SetupJustificationSpacing();
|
||||
void SetupJustificationSpacing(bool aPostReflow);
|
||||
|
||||
void InitFontGroupAndFontMetrics() {
|
||||
float inflation = (mWhichTextRun == nsTextFrame::eInflated)
|
||||
@ -3274,7 +3274,7 @@ PropertyProvider::InitializeForDisplay(bool aTrimAfter)
|
||||
mFrame->GetTrimmedOffsets(mFrag, aTrimAfter);
|
||||
mStart.SetOriginalOffset(trimmed.mStart);
|
||||
mLength = trimmed.mLength;
|
||||
SetupJustificationSpacing();
|
||||
SetupJustificationSpacing(true);
|
||||
}
|
||||
|
||||
void
|
||||
@ -3284,7 +3284,7 @@ PropertyProvider::InitializeForMeasure()
|
||||
mFrame->GetTrimmedOffsets(mFrag, true, false);
|
||||
mStart.SetOriginalOffset(trimmed.mStart);
|
||||
mLength = trimmed.mLength;
|
||||
SetupJustificationSpacing();
|
||||
SetupJustificationSpacing(false);
|
||||
}
|
||||
|
||||
|
||||
@ -3326,7 +3326,7 @@ PropertyProvider::FindJustificationRange(gfxSkipCharsIterator* aStart,
|
||||
}
|
||||
|
||||
void
|
||||
PropertyProvider::SetupJustificationSpacing()
|
||||
PropertyProvider::SetupJustificationSpacing(bool aPostReflow)
|
||||
{
|
||||
NS_PRECONDITION(mLength != INT32_MAX, "Can't call this with undefined length");
|
||||
|
||||
@ -3338,7 +3338,7 @@ PropertyProvider::SetupJustificationSpacing()
|
||||
// called with false for aTrimAfter, we still shouldn't be assigning
|
||||
// justification space to any trailing whitespace.
|
||||
nsTextFrame::TrimmedOffsets trimmed =
|
||||
mFrame->GetTrimmedOffsets(mFrag, true);
|
||||
mFrame->GetTrimmedOffsets(mFrag, true, aPostReflow);
|
||||
end.AdvanceOriginal(trimmed.mLength);
|
||||
gfxSkipCharsIterator realEnd(end);
|
||||
FindJustificationRange(&start, &end);
|
||||
|
@ -738,12 +738,12 @@ pref("javascript.options.strict.debug", true);
|
||||
pref("javascript.options.baselinejit.content", true);
|
||||
pref("javascript.options.baselinejit.chrome", true);
|
||||
pref("javascript.options.ion.content", true);
|
||||
pref("javascript.options.ion.chrome", false);
|
||||
pref("javascript.options.ion.chrome", true);
|
||||
pref("javascript.options.asmjs", true);
|
||||
pref("javascript.options.parallel_parsing", true);
|
||||
pref("javascript.options.ion.parallel_compilation", true);
|
||||
pref("javascript.options.typeinference.content", true);
|
||||
pref("javascript.options.typeinference.chrome", false);
|
||||
pref("javascript.options.typeinference.chrome", true);
|
||||
// This preference limits the memory usage of javascript.
|
||||
// If you want to change these values for your device,
|
||||
// please find Bug 417052 comment 17 and Bug 456721
|
||||
|
@ -27,8 +27,8 @@ using mozilla::unused;
|
||||
|
||||
namespace {
|
||||
|
||||
static Atomic<int32_t> sCertOverrideSvcExists(0);
|
||||
static Atomic<int32_t> sCertDBExists(0);
|
||||
static Atomic<bool> sCertOverrideSvcExists(false);
|
||||
static Atomic<bool> sCertDBExists(false);
|
||||
|
||||
class MainThreadClearer : public SyncRunnableBase
|
||||
{
|
||||
@ -40,9 +40,9 @@ public:
|
||||
// is in progress. We want to avoid this, since they do not handle the situation well,
|
||||
// hence the flags to avoid instantiating the services if they don't already exist.
|
||||
|
||||
bool certOverrideSvcExists = (bool)sCertOverrideSvcExists.exchange(0);
|
||||
bool certOverrideSvcExists = sCertOverrideSvcExists.exchange(false);
|
||||
if (certOverrideSvcExists) {
|
||||
sCertOverrideSvcExists = 1;
|
||||
sCertOverrideSvcExists = true;
|
||||
nsCOMPtr<nsICertOverrideService> icos = do_GetService(NS_CERTOVERRIDE_CONTRACTID);
|
||||
if (icos) {
|
||||
icos->ClearValidityOverride(
|
||||
@ -51,9 +51,9 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
bool certDBExists = (bool)sCertDBExists.exchange(0);
|
||||
bool certDBExists = sCertDBExists.exchange(false);
|
||||
if (certDBExists) {
|
||||
sCertDBExists = 1;
|
||||
sCertDBExists = true;
|
||||
nsCOMPtr<nsIX509CertDB> certdb = do_GetService(NS_X509CERTDB_CONTRACTID);
|
||||
if (certdb) {
|
||||
nsCOMPtr<nsIRecentBadCerts> badCerts;
|
||||
@ -206,13 +206,13 @@ SharedSSLState::GlobalCleanup()
|
||||
/*static*/ void
|
||||
SharedSSLState::NoteCertOverrideServiceInstantiated()
|
||||
{
|
||||
sCertOverrideSvcExists = 1;
|
||||
sCertOverrideSvcExists = true;
|
||||
}
|
||||
|
||||
/*static*/ void
|
||||
SharedSSLState::NoteCertDBServiceInstantiated()
|
||||
{
|
||||
sCertDBExists = 1;
|
||||
sCertDBExists = true;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -12,6 +12,7 @@
|
||||
"b2g/chrome/content/test/mochitest": "require OOP support for mochitest-b2g-desktop, Bug 957554",
|
||||
"content/xul":"tests that use xul",
|
||||
"layout/xul" : "",
|
||||
"dom/plugins": "tests that use plugins",
|
||||
"dom/tests/mochitest/general/test_focusrings.xul":"",
|
||||
"layout/base/tests/test_bug465448.xul":"",
|
||||
|
||||
@ -639,69 +640,6 @@
|
||||
"dom/indexedDB/test/test_webapp_clearBrowserData_oop_inproc.html": "Bug 931116, b2g desktop specific, initial triage",
|
||||
"dom/permission/tests/test_embed-apps.html": "Bug 931116, b2g desktop specific, initial triage",
|
||||
"dom/permission/tests/test_wifi-manage.html": "Bug 931116, b2g desktop specific, initial triage",
|
||||
"dom/plugins/test/mochitest/test_GCrace.html": "Bug 931116, b2g desktop specific, initial triage",
|
||||
"dom/plugins/test/mochitest/test_NPNVdocumentOrigin.html": "Bug 931116, b2g desktop specific, initial triage",
|
||||
"dom/plugins/test/mochitest/test_NPPVpluginWantsAllNetworkStreams.html": "Bug 931116, b2g desktop specific, initial triage",
|
||||
"dom/plugins/test/mochitest/test_bug532208.html": "Bug 931116, b2g desktop specific, initial triage",
|
||||
"dom/plugins/test/mochitest/test_bug539565-1.html": "Bug 931116, b2g desktop specific, initial triage",
|
||||
"dom/plugins/test/mochitest/test_bug539565-2.html": "Bug 931116, b2g desktop specific, initial triage",
|
||||
"dom/plugins/test/mochitest/test_bug771202.html": "Bug 931116, b2g desktop specific, initial triage",
|
||||
"dom/plugins/test/mochitest/test_bug777098.html": "Bug 931116, b2g desktop specific, initial triage",
|
||||
"dom/plugins/test/mochitest/test_bug784131.html": "Bug 931116, b2g desktop specific, initial triage",
|
||||
"dom/plugins/test/mochitest/test_bug813906.html": "Bug 931116, b2g desktop specific, initial triage",
|
||||
"dom/plugins/test/mochitest/test_bug854082.html": "Bug 931116, b2g desktop specific, initial triage",
|
||||
"dom/plugins/test/mochitest/test_bug863792.html": "Bug 931116, b2g desktop specific, initial triage",
|
||||
"dom/plugins/test/mochitest/test_bug967694.html": "Bug 967694, b2g desktop doesn't allow plugins",
|
||||
"dom/plugins/test/mochitest/test_cookies.html": "Bug 931116, b2g desktop specific, initial triage",
|
||||
"dom/plugins/test/mochitest/test_copyText.html": "Bug 931116, b2g desktop specific, initial triage",
|
||||
"dom/plugins/test/mochitest/test_crash_nested_loop.html": "Bug 931116, b2g desktop specific, initial triage",
|
||||
"dom/plugins/test/mochitest/test_crashing.html": "Bug 931116, b2g desktop specific, initial triage",
|
||||
"dom/plugins/test/mochitest/test_defaultValue.html": "Bug 931116, b2g desktop specific, initial triage",
|
||||
"dom/plugins/test/mochitest/test_enumerate.html": "Bug 931116, b2g desktop specific, initial triage",
|
||||
"dom/plugins/test/mochitest/test_fullpage.html": "Bug 931116, b2g desktop specific, initial triage",
|
||||
"dom/plugins/test/mochitest/test_getauthenticationinfo.html": "Bug 931116, b2g desktop specific, initial triage",
|
||||
"dom/plugins/test/mochitest/test_hanging.html": "Bug 931116, b2g desktop specific, initial triage",
|
||||
"dom/plugins/test/mochitest/test_instance_re-parent.html": "Bug 931116, b2g desktop specific, initial triage",
|
||||
"dom/plugins/test/mochitest/test_instance_unparent1.html": "Bug 931116, b2g desktop specific, initial triage",
|
||||
"dom/plugins/test/mochitest/test_instance_unparent2.html": "Bug 931116, b2g desktop specific, initial triage",
|
||||
"dom/plugins/test/mochitest/test_instance_unparent3.html": "Bug 931116, b2g desktop specific, initial triage",
|
||||
"dom/plugins/test/mochitest/test_instantiation.html": "Bug 931116, b2g desktop specific, initial triage",
|
||||
"dom/plugins/test/mochitest/test_mixed_case_mime.html": "Bug 931116, b2g desktop specific",
|
||||
"dom/plugins/test/mochitest/test_multipleinstanceobjects.html": "Bug 931116, b2g desktop specific, initial triage",
|
||||
"dom/plugins/test/mochitest/test_newstreamondestroy.html": "Bug 931116, b2g desktop specific, initial triage",
|
||||
"dom/plugins/test/mochitest/test_npn_asynccall.html": "Bug 931116, b2g desktop specific, initial triage",
|
||||
"dom/plugins/test/mochitest/test_npn_timers.html": "Bug 931116, b2g desktop specific, initial triage",
|
||||
"dom/plugins/test/mochitest/test_npobject_getters.html": "Bug 931116, b2g desktop specific, initial triage",
|
||||
"dom/plugins/test/mochitest/test_npruntime_construct.html": "Bug 931116, b2g desktop specific, initial triage",
|
||||
"dom/plugins/test/mochitest/test_npruntime_identifiers.html": "Bug 931116, b2g desktop specific, initial triage",
|
||||
"dom/plugins/test/mochitest/test_npruntime_npnevaluate.html": "Bug 931116, b2g desktop specific, initial triage",
|
||||
"dom/plugins/test/mochitest/test_npruntime_npninvoke.html": "Bug 931116, b2g desktop specific, initial triage",
|
||||
"dom/plugins/test/mochitest/test_npruntime_npninvokedefault.html": "Bug 931116, b2g desktop specific, initial triage",
|
||||
"dom/plugins/test/mochitest/test_npruntime_npnsetexception.html": "Bug 931116, b2g desktop specific, initial triage",
|
||||
"dom/plugins/test/mochitest/test_painting.html": "Bug 931116, b2g desktop specific, initial triage",
|
||||
"dom/plugins/test/mochitest/test_pluginstream_asfile.html": "Bug 931116, b2g desktop specific, initial triage",
|
||||
"dom/plugins/test/mochitest/test_pluginstream_asfileonly.html": "Bug 931116, b2g desktop specific, initial triage",
|
||||
"dom/plugins/test/mochitest/test_pluginstream_err.html": "Bug 931116, b2g desktop specific, initial triage",
|
||||
"dom/plugins/test/mochitest/test_pluginstream_geturl.html": "Bug 931116, b2g desktop specific, initial triage",
|
||||
"dom/plugins/test/mochitest/test_pluginstream_geturlnotify.html": "Bug 931116, b2g desktop specific, initial triage",
|
||||
"dom/plugins/test/mochitest/test_pluginstream_newstream.html": "Bug 931116, b2g desktop specific, initial triage",
|
||||
"dom/plugins/test/mochitest/test_pluginstream_post.html": "Bug 931116, b2g desktop specific, initial triage",
|
||||
"dom/plugins/test/mochitest/test_pluginstream_poststream.html": "Bug 931116, b2g desktop specific, initial triage",
|
||||
"dom/plugins/test/mochitest/test_pluginstream_referer.html": "Bug 931116, b2g desktop specific, initial triage",
|
||||
"dom/plugins/test/mochitest/test_pluginstream_seek.html": "Bug 931116, b2g desktop specific, initial triage",
|
||||
"dom/plugins/test/mochitest/test_pluginstream_seek_close.html": "Bug 931116, b2g desktop specific, initial triage",
|
||||
"dom/plugins/test/mochitest/test_pluginstream_src.html": "Bug 931116, b2g desktop specific, initial triage",
|
||||
"dom/plugins/test/mochitest/test_pluginstream_src_dynamic.html": "Bug 931116, b2g desktop specific, initial triage",
|
||||
"dom/plugins/test/mochitest/test_pluginstream_src_referer.html": "Bug 931116, b2g desktop specific, initial triage",
|
||||
"dom/plugins/test/mochitest/test_propertyAndMethod.html": "Bug 931116, b2g desktop specific, initial triage",
|
||||
"dom/plugins/test/mochitest/test_redirect_handling.html": "Bug 931116, b2g desktop specific, initial triage",
|
||||
"dom/plugins/test/mochitest/test_secondPlugin.html": "Bug 931116, b2g desktop specific, initial triage",
|
||||
"dom/plugins/test/mochitest/test_src_url_change.html": "Bug 931116, b2g desktop specific, initial triage",
|
||||
"dom/plugins/test/mochitest/test_streamNotify.html": "Bug 931116, b2g desktop specific, initial triage",
|
||||
"dom/plugins/test/mochitest/test_streamatclose.html": "Bug 931116, b2g desktop specific, initial triage",
|
||||
"dom/plugins/test/mochitest/test_twostreams.html": "Bug 931116, b2g desktop specific, initial triage",
|
||||
"dom/plugins/test/mochitest/test_visibility.html": "Bug 931116, b2g desktop specific, initial triage",
|
||||
"dom/plugins/test/mochitest/test_zero_opacity.html": "Bug 931116, b2g desktop specific, initial triage",
|
||||
"dom/tests/mochitest/bugs/test_bug346659.html": "Bug 931116, b2g desktop specific, initial triage",
|
||||
"dom/tests/mochitest/bugs/test_bug38959.html": "Bug 931116, b2g desktop specific, initial triage",
|
||||
"dom/tests/mochitest/bugs/test_bug458091.html": "Bug 931116, b2g desktop specific, initial triage",
|
||||
|
@ -2,7 +2,7 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Video controls test</title>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
</head>
|
||||
@ -10,7 +10,7 @@
|
||||
<p id="display"></p>
|
||||
|
||||
<div id="content">
|
||||
<video width="320" height="240" id="video" src="seek_with_sound.ogg" controls mozNoDynamicControls preload="auto"></video>
|
||||
<video width="320" height="240" id="video" controls mozNoDynamicControls preload="auto"></video>
|
||||
</div>
|
||||
|
||||
<pre id="test">
|
||||
@ -166,7 +166,7 @@ function runTest(event) {
|
||||
synthesizeMouse(video, endDragX, scrubberCenterY, { type: "mousemove", button: 0 });
|
||||
synthesizeMouse(video, endDragX, scrubberCenterY, { type: "mouseup", button: 0 });
|
||||
break;
|
||||
|
||||
|
||||
case 12:
|
||||
is(event.type, "seeking", "checking event type");
|
||||
ok(true, "video position is at " + video.currentTime);
|
||||
@ -211,47 +211,34 @@ function runTest(event) {
|
||||
testnum++;
|
||||
}
|
||||
|
||||
var canplaythroughsavedevent = null;
|
||||
var gotcanplaythroughevent = false;
|
||||
var gotloadevent = false;
|
||||
|
||||
function canplaythroughevent(event) {
|
||||
canplaythroughsavedevent = event;
|
||||
gotcanplaythroughevent = true;
|
||||
video.removeEventListener("canplaythrough", canplaythroughevent, false);
|
||||
maybeStartTest();
|
||||
}
|
||||
|
||||
function loadevent(event) {
|
||||
gotloadevent = true;
|
||||
maybeStartTest();
|
||||
}
|
||||
|
||||
// setTimeout so that test starts after paint suppression ends
|
||||
function maybeStartTest() {
|
||||
if (!gotcanplaythroughevent || !gotloadevent)
|
||||
return;
|
||||
|
||||
setTimeout("runTest(canplaythroughsavedevent);", 0);
|
||||
}
|
||||
|
||||
var testnum = 1;
|
||||
var video = document.getElementById("video");
|
||||
|
||||
SpecialPowers.pushPrefEnv({"set": [["media.cache_size", 40000]]}, startTest);
|
||||
function startTest() {
|
||||
// Kick off test once video has loaded.
|
||||
video.addEventListener("canplaythrough", canplaythroughevent, false);
|
||||
window.addEventListener("load", loadevent, false);
|
||||
|
||||
function canplaythroughevent(event) {
|
||||
video.removeEventListener("canplaythrough", canplaythroughevent, false);
|
||||
// Other events expected by the test.
|
||||
video.addEventListener("play", runTest, false);
|
||||
video.addEventListener("pause", runTest, false);
|
||||
video.addEventListener("volumechange", runTest, false);
|
||||
video.addEventListener("seeking", runTest, false);
|
||||
video.addEventListener("seeked", runTest, false);
|
||||
// Begin the test.
|
||||
runTest(event);
|
||||
}
|
||||
|
||||
function startMediaLoad() {
|
||||
// Kick off test once video has loaded, in its canplaythrough event handler.
|
||||
video.src = "seek_with_sound.ogg";
|
||||
video.addEventListener("canplaythrough", canplaythroughevent, false);
|
||||
}
|
||||
|
||||
function loadevent(event) {
|
||||
SpecialPowers.pushPrefEnv({"set": [["media.cache_size", 40000]]}, startMediaLoad);
|
||||
}
|
||||
|
||||
window.addEventListener("load", loadevent, false);
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
</script>
|
||||
|
@ -1,27 +0,0 @@
|
||||
# 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/.
|
||||
|
||||
include client.mk
|
||||
|
||||
.PHONY : check-l10n
|
||||
|
||||
check-l10n:
|
||||
for loc in $(MOZ_CO_LOCALES); do \
|
||||
for mod in $(sort $(foreach project,$(MOZ_PROJECT_LIST),$(LOCALES_$(project)))); do \
|
||||
echo Comparing $(TOPSRCDIR)/$$mod/locales/en-US with $(TOPSRCDIR)/../l10n/$$loc/$$mod; \
|
||||
perl $(TOPSRCDIR)/toolkit/locales/compare-locales.pl $(TOPSRCDIR)/$$mod/locales/en-US $(TOPSRCDIR)/../l10n/$$loc/$$mod; \
|
||||
done; \
|
||||
done;
|
||||
|
||||
create-%:
|
||||
for mod in $(sort $(foreach project,$(MOZ_PROJECT_LIST),$(LOCALES_$(project)))); do \
|
||||
if test -d $(TOPSRCDIR)/../l10n/$*/$$mod; then \
|
||||
echo $(TOPSRCDIR)/../l10n/$*/$$mod already exists; \
|
||||
else \
|
||||
echo Creating $(TOPSRCDIR)/../l10n/$*/$$mod from $(TOPSRCDIR)/$$mod/locales/en-US; \
|
||||
mkdir -p ../l10n/$*/$$mod; \
|
||||
cp -r $(TOPSRCDIR)/$$mod/locales/en-US/* $(TOPSRCDIR)/../l10n/$*/$$mod; \
|
||||
find $(TOPSRCDIR)/../l10n/$*/$$mod -name CVS | xargs rm -rf; \
|
||||
fi; \
|
||||
done;
|
@ -1,121 +0,0 @@
|
||||
#!/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/.
|
||||
|
||||
import logging
|
||||
from optparse import OptionParser
|
||||
import os
|
||||
import os.path
|
||||
import re
|
||||
from subprocess import Popen, PIPE
|
||||
from shutil import copy2
|
||||
import sys
|
||||
|
||||
def walk(base):
|
||||
for root, dirs, files in os.walk(base):
|
||||
try:
|
||||
dirs.remove('CVS')
|
||||
except ValueError:
|
||||
pass
|
||||
yield (os.path.normpath(root[len(base)+1:]), files)
|
||||
|
||||
def createLocalization(source, dest, apps, exceptions = {}):
|
||||
'''
|
||||
Creates a new localization.
|
||||
|
||||
@type source: string
|
||||
@param source: path to the mozilla sources to use
|
||||
|
||||
@type dest: string
|
||||
@param dest: path to the localization to create or update
|
||||
|
||||
@type apps: array of strings
|
||||
@param apps: the applications for which to create or update the
|
||||
localization
|
||||
|
||||
@type exceptions: mapping
|
||||
@param exceptions: stuff to ignore
|
||||
'''
|
||||
|
||||
assert os.path.isdir(source), "source directory is not a directory"
|
||||
clientmk = os.path.join(source,'client.mk')
|
||||
assert os.path.isfile(clientmk), "client.mk missing"
|
||||
|
||||
if not apps or not len(apps):
|
||||
apps=['browser']
|
||||
|
||||
if not os.path.isdir(dest):
|
||||
os.makedirs(dest)
|
||||
|
||||
assert os.path.isdir(dest), "target should be a directory"
|
||||
|
||||
# get the directories to iterate over
|
||||
dirs = set()
|
||||
cmd = ['make', '-f', clientmk] + \
|
||||
['echo-variable-LOCALES_' + app for app in apps]
|
||||
p = Popen(cmd, stdout = PIPE)
|
||||
for ln in p.stdout.readlines():
|
||||
dirs.update(ln.strip().split())
|
||||
dirs = sorted(list(dirs))
|
||||
|
||||
for d in dirs:
|
||||
assert os.path.isdir(os.path.join(source, d)), \
|
||||
"expecting source directory %s" % d
|
||||
|
||||
for d in dirs:
|
||||
logging.debug('processing %s' % d)
|
||||
if d in exceptions and exceptions[d] == 'all':
|
||||
continue
|
||||
|
||||
basepath = os.path.join(source, d, 'locales', 'en-US')
|
||||
|
||||
ign_mod = {}
|
||||
if d in exceptions:
|
||||
ign_mod = exceptions[d]
|
||||
logging.debug('using exceptions: %s' % str(ign_mod))
|
||||
|
||||
l10nbase = os.path.join(dest, d)
|
||||
if not os.path.isdir(l10nbase):
|
||||
os.makedirs(l10nbase)
|
||||
|
||||
for root, files in walk(basepath):
|
||||
ignore = None
|
||||
if root in ign_mod:
|
||||
if ign_mod[root] == '.':
|
||||
continue
|
||||
ignore = re.compile(ign_mod[root])
|
||||
l10npath = os.path.join(l10nbase, root)
|
||||
if not os.path.isdir(l10npath):
|
||||
os.mkdir(l10npath)
|
||||
|
||||
for f in files:
|
||||
if ignore and ignore.search(f):
|
||||
# ignoring some files
|
||||
continue
|
||||
if not os.path.exists(os.path.join(l10npath,f)):
|
||||
copy2(os.path.join(basepath, root, f), l10npath)
|
||||
|
||||
if __name__ == '__main__':
|
||||
p = OptionParser()
|
||||
p.add_option('--source', default = '.',
|
||||
help='Mozilla sources')
|
||||
p.add_option('--dest', default = '../l10n',
|
||||
help='Localization target directory')
|
||||
p.add_option('--app', action="append",
|
||||
help='Create localization for this application ' + \
|
||||
'(multiple applications allowed, default: browser)')
|
||||
p.add_option('-v', '--verbose', action="store_true", default=False,
|
||||
help='report debugging information')
|
||||
(opts, args) = p.parse_args()
|
||||
if opts.verbose:
|
||||
logging.basicConfig(level=logging.DEBUG)
|
||||
assert len(args) == 1, "language code expected"
|
||||
|
||||
# hardcoding exceptions, work for both trunk and 1.8 branch
|
||||
exceptions = {'browser':
|
||||
{'searchplugins': '\\.xml$'},
|
||||
'extensions/spellcheck': 'all'}
|
||||
createLocalization(opts.source, os.path.join(opts.dest, args[0]),
|
||||
opts.app, exceptions=exceptions)
|
@ -3343,11 +3343,6 @@ nsWindow::GetLayerManager(PLayerTransactionChild* aShadowManager,
|
||||
|
||||
gfxASurface *nsWindow::GetThebesSurface()
|
||||
{
|
||||
#ifdef CAIRO_HAS_D2D_SURFACE
|
||||
if (mD2DWindowSurface) {
|
||||
return mD2DWindowSurface;
|
||||
}
|
||||
#endif
|
||||
if (mPaintDC)
|
||||
return (new gfxWindowsSurface(mPaintDC));
|
||||
|
||||
@ -6442,13 +6437,6 @@ void nsWindow::OnDestroy()
|
||||
// Send a resize message to the listener
|
||||
bool nsWindow::OnResize(nsIntRect &aWindowRect)
|
||||
{
|
||||
#ifdef CAIRO_HAS_D2D_SURFACE
|
||||
if (mD2DWindowSurface) {
|
||||
mD2DWindowSurface = nullptr;
|
||||
Invalidate();
|
||||
}
|
||||
#endif
|
||||
|
||||
bool result = mWidgetListener ?
|
||||
mWidgetListener->WindowResized(this, aWindowRect.width, aWindowRect.height) : false;
|
||||
|
||||
@ -6836,14 +6824,6 @@ nsresult nsWindow::UpdateTranslucentWindow()
|
||||
::UpdateLayeredWindow(hWnd, nullptr, (POINT*)&winRect, &winSize, mMemoryDC,
|
||||
&srcPos, 0, &bf, ULW_ALPHA);
|
||||
|
||||
#ifdef CAIRO_HAS_D2D_SURFACE
|
||||
if (gfxWindowsPlatform::GetPlatform()->GetRenderMode() ==
|
||||
gfxWindowsPlatform::RENDER_DIRECT2D) {
|
||||
nsIntRect r(0, 0, 0, 0);
|
||||
static_cast<gfxD2DSurface*>(mTransparentSurface.get())->ReleaseDC(&r);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!updateSuccesful) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
@ -7091,9 +7071,6 @@ BOOL CALLBACK nsWindow::ClearResourcesCallback(HWND aWnd, LPARAM aMsg)
|
||||
void
|
||||
nsWindow::ClearCachedResources()
|
||||
{
|
||||
#ifdef CAIRO_HAS_D2D_SURFACE
|
||||
mD2DWindowSurface = nullptr;
|
||||
#endif
|
||||
if (mLayerManager &&
|
||||
mLayerManager->GetBackendType() == LayersBackend::LAYERS_BASIC) {
|
||||
mLayerManager->ClearCachedResources();
|
||||
|
@ -29,10 +29,6 @@
|
||||
#include "mozilla/TimeStamp.h"
|
||||
#include "nsMargin.h"
|
||||
|
||||
#ifdef CAIRO_HAS_D2D_SURFACE
|
||||
#include "gfxD2DSurface.h"
|
||||
#endif
|
||||
|
||||
#include "nsWinGesture.h"
|
||||
|
||||
#include "WindowHook.h"
|
||||
@ -548,10 +544,6 @@ protected:
|
||||
|
||||
nsIntRect mLastPaintBounds;
|
||||
|
||||
#ifdef CAIRO_HAS_D2D_SURFACE
|
||||
nsRefPtr<gfxD2DSurface> mD2DWindowSurface; // Surface for this window.
|
||||
#endif
|
||||
|
||||
// Transparency
|
||||
#ifdef MOZ_XUL
|
||||
// Use layered windows to support full 256 level alpha translucency
|
||||
|
@ -323,27 +323,6 @@ bool nsWindow::OnPaint(HDC aDC, uint32_t aNestingLevel)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CAIRO_HAS_D2D_SURFACE
|
||||
if (!targetSurface &&
|
||||
IsRenderMode(gfxWindowsPlatform::RENDER_DIRECT2D))
|
||||
{
|
||||
if (!mD2DWindowSurface) {
|
||||
gfxContentType content = gfxContentType::COLOR;
|
||||
#if defined(MOZ_XUL)
|
||||
if (mTransparencyMode != eTransparencyOpaque) {
|
||||
content = gfxContentType::COLOR_ALPHA;
|
||||
}
|
||||
#endif
|
||||
mD2DWindowSurface = new gfxD2DSurface(mWnd, content);
|
||||
}
|
||||
if (!mD2DWindowSurface->CairoStatus()) {
|
||||
targetSurface = mD2DWindowSurface;
|
||||
} else {
|
||||
mD2DWindowSurface = nullptr;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
nsRefPtr<gfxWindowsSurface> targetSurfaceWin;
|
||||
if (!targetSurface &&
|
||||
(IsRenderMode(gfxWindowsPlatform::RENDER_GDI) ||
|
||||
@ -451,13 +430,7 @@ bool nsWindow::OnPaint(HDC aDC, uint32_t aNestingLevel)
|
||||
UpdateTranslucentWindow();
|
||||
} else
|
||||
#endif
|
||||
#ifdef CAIRO_HAS_D2D_SURFACE
|
||||
if (result) {
|
||||
if (mD2DWindowSurface) {
|
||||
mD2DWindowSurface->Present();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (result) {
|
||||
if (IsRenderMode(gfxWindowsPlatform::RENDER_IMAGE_STRETCH24) ||
|
||||
IsRenderMode(gfxWindowsPlatform::RENDER_IMAGE_STRETCH32))
|
||||
|
@ -8,7 +8,6 @@
|
||||
#include "MetroWidget.h"
|
||||
#include "MetroInput.h"
|
||||
#include "gfxWindowsPlatform.h"
|
||||
#include "gfxD2DSurface.h"
|
||||
#include "nsDataHashtable.h"
|
||||
|
||||
#include "mozwrlbase.h"
|
||||
|
@ -23,7 +23,7 @@ nsBaseAppShell::nsBaseAppShell()
|
||||
, mEventloopNestingLevel(0)
|
||||
, mBlockedWait(nullptr)
|
||||
, mFavorPerf(0)
|
||||
, mNativeEventPending(0)
|
||||
, mNativeEventPending(false)
|
||||
, mStarvationDelay(0)
|
||||
, mSwitchTime(0)
|
||||
, mLastNativeEventTime(0)
|
||||
@ -61,7 +61,7 @@ nsBaseAppShell::Init()
|
||||
void
|
||||
nsBaseAppShell::NativeEventCallback()
|
||||
{
|
||||
if (!mNativeEventPending.exchange(0))
|
||||
if (!mNativeEventPending.exchange(false))
|
||||
return;
|
||||
|
||||
// If DoProcessNextNativeEvent is on the stack, then we assume that we can
|
||||
@ -106,7 +106,7 @@ nsBaseAppShell::NativeEventCallback()
|
||||
}
|
||||
|
||||
// Note, this is currently overidden on windows, see comments in nsAppShell for
|
||||
// details.
|
||||
// details.
|
||||
void
|
||||
nsBaseAppShell::DoProcessMoreGeckoEvents()
|
||||
{
|
||||
@ -225,7 +225,7 @@ nsBaseAppShell::OnDispatchedEvent(nsIThreadInternal *thr)
|
||||
if (mBlockNativeEvent)
|
||||
return NS_OK;
|
||||
|
||||
if (mNativeEventPending.exchange(1))
|
||||
if (mNativeEventPending.exchange(true))
|
||||
return NS_OK;
|
||||
|
||||
// Returns on the main thread in NativeEventCallback above
|
||||
@ -402,7 +402,7 @@ nsBaseAppShell::AfterProcessNextEvent(nsIThreadInternal *thr,
|
||||
uint32_t recursionDepth,
|
||||
bool eventWasProcessed)
|
||||
{
|
||||
// We've just finished running an event, so we're in a stable state.
|
||||
// We've just finished running an event, so we're in a stable state.
|
||||
RunSyncSections(true, recursionDepth);
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -120,7 +120,7 @@ private:
|
||||
*/
|
||||
bool *mBlockedWait;
|
||||
int32_t mFavorPerf;
|
||||
mozilla::Atomic<uint32_t> mNativeEventPending;
|
||||
mozilla::Atomic<bool> mNativeEventPending;
|
||||
PRIntervalTime mStarvationDelay;
|
||||
PRIntervalTime mSwitchTime;
|
||||
PRIntervalTime mLastNativeEventTime;
|
||||
@ -147,7 +147,7 @@ private:
|
||||
* Tracks whether we have processed any gecko events in NativeEventCallback so
|
||||
* that we can avoid erroneously entering a blocking loop waiting for gecko
|
||||
* events to show up during OnProcessNextEvent. This is required because on
|
||||
* OS X ProcessGeckoEvents may be invoked inside the context of
|
||||
* OS X ProcessGeckoEvents may be invoked inside the context of
|
||||
* ProcessNextNativeEvent and may result in NativeEventCallback being invoked
|
||||
* and in turn invoking NS_ProcessPendingEvents. Because
|
||||
* ProcessNextNativeEvent may be invoked prior to the NS_HasPendingEvents
|
||||
|
@ -116,6 +116,12 @@ public:
|
||||
{
|
||||
NS_StringSetData(*this, &aChar, 1);
|
||||
}
|
||||
#ifdef MOZ_USE_CHAR16_WRAPPER
|
||||
NS_HIDDEN_(void) Assign(char16ptr_t aData, size_type aLength = UINT32_MAX)
|
||||
{
|
||||
NS_StringSetData(*this, aData, aLength);
|
||||
}
|
||||
#endif
|
||||
|
||||
NS_HIDDEN_(void) AssignLiteral(const char *aStr);
|
||||
NS_HIDDEN_(void) AssignASCII(const char *aStr) { AssignLiteral(aStr); }
|
||||
@ -123,6 +129,9 @@ public:
|
||||
NS_HIDDEN_(self_type&) operator=(const self_type& aString) { Assign(aString); return *this; }
|
||||
NS_HIDDEN_(self_type&) operator=(const char_type* aPtr) { Assign(aPtr); return *this; }
|
||||
NS_HIDDEN_(self_type&) operator=(char_type aChar) { Assign(aChar); return *this; }
|
||||
#ifdef MOZ_USE_CHAR16_WRAPPER
|
||||
NS_HIDDEN_(self_type&) operator=(char16ptr_t aPtr) { Assign(aPtr); return *this; }
|
||||
#endif
|
||||
|
||||
NS_HIDDEN_(void) Replace( index_type cutStart, size_type cutLength, const char_type* data, size_type length = size_type(-1) )
|
||||
{
|
||||
@ -224,6 +233,12 @@ public:
|
||||
{
|
||||
return Equals(other);
|
||||
}
|
||||
#ifdef MOZ_USE_CHAR16_WRAPPER
|
||||
NS_HIDDEN_(bool) operator == (char16ptr_t other) const
|
||||
{
|
||||
return Equals(other);
|
||||
}
|
||||
#endif
|
||||
|
||||
NS_HIDDEN_(bool) operator >= (const self_type &other) const
|
||||
{
|
||||
|
@ -49,7 +49,7 @@ HandleToFilename(HANDLE aHandle, const LARGE_INTEGER& aOffset,
|
||||
do {
|
||||
mappedFilename.SetLength(mappedFilename.Length() + MAX_PATH);
|
||||
len = GetMappedFileNameW(GetCurrentProcess(), view,
|
||||
mappedFilename.BeginWriting(),
|
||||
wwc(mappedFilename.BeginWriting()),
|
||||
mappedFilename.Length());
|
||||
} while (!len && GetLastError() == ERROR_INSUFFICIENT_BUFFER);
|
||||
if (!len) {
|
||||
|
@ -35,7 +35,7 @@ NtPathToDosPath(const nsAString& aNtPath, nsAString& aDosPath)
|
||||
nsAutoString logicalDrives;
|
||||
DWORD len = 0;
|
||||
while(true) {
|
||||
len = GetLogicalDriveStringsW(len, logicalDrives.BeginWriting());
|
||||
len = GetLogicalDriveStringsW(len, reinterpret_cast<wchar_t*>(logicalDrives.BeginWriting()));
|
||||
if (!len) {
|
||||
return false;
|
||||
} else if (len > logicalDrives.Length()) {
|
||||
@ -56,7 +56,7 @@ NtPathToDosPath(const nsAString& aNtPath, nsAString& aDosPath)
|
||||
DWORD targetPathLen = 0;
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
while (true) {
|
||||
targetPathLen = QueryDosDeviceW(driveTemplate, targetPath.BeginWriting(),
|
||||
targetPathLen = QueryDosDeviceW(driveTemplate, reinterpret_cast<wchar_t*>(targetPath.BeginWriting()),
|
||||
targetPath.Length());
|
||||
if (targetPathLen || GetLastError() != ERROR_INSUFFICIENT_BUFFER) {
|
||||
break;
|
||||
@ -68,7 +68,7 @@ NtPathToDosPath(const nsAString& aNtPath, nsAString& aDosPath)
|
||||
size_t firstTargetPathLen = wcslen(targetPath.get());
|
||||
const char16_t* pathComponent = aNtPath.BeginReading() +
|
||||
firstTargetPathLen;
|
||||
bool found = _wcsnicmp(aNtPath.BeginReading(), targetPath.get(),
|
||||
bool found = _wcsnicmp(char16ptr_t(aNtPath.BeginReading()), targetPath.get(),
|
||||
firstTargetPathLen) == 0 &&
|
||||
*pathComponent == L'\\';
|
||||
if (found) {
|
||||
|
@ -380,6 +380,11 @@ class nsTString_CharT : public nsTSubstring_CharT
|
||||
|
||||
#endif // !MOZ_STRING_WITH_OBSOLETE_API
|
||||
|
||||
/**
|
||||
* Allow this string to be bound to a character buffer
|
||||
* until the string is rebound or mutated; the caller
|
||||
* must ensure that the buffer outlives the string.
|
||||
*/
|
||||
void Rebind( const char_type* data, size_type length );
|
||||
|
||||
/**
|
||||
|
@ -10,6 +10,8 @@
|
||||
#include <winnetwk.h>
|
||||
|
||||
#include "mozilla/FileUtilsWin.h"
|
||||
#include "mozilla/DebugOnly.h"
|
||||
#include "nsCRTGlue.h"
|
||||
|
||||
class DriveMapping
|
||||
{
|
||||
@ -35,8 +37,8 @@ private:
|
||||
};
|
||||
|
||||
DriveMapping::DriveMapping(const nsAString& aRemoteUNCPath)
|
||||
: mRemoteUNCPath(aRemoteUNCPath)
|
||||
, mDriveLetter(0)
|
||||
: mDriveLetter(0)
|
||||
, mRemoteUNCPath(aRemoteUNCPath)
|
||||
{
|
||||
}
|
||||
|
||||
@ -56,7 +58,7 @@ DriveMapping::DoMapping()
|
||||
NETRESOURCEW netRes = {0};
|
||||
netRes.dwType = RESOURCETYPE_DISK;
|
||||
netRes.lpLocalName = drvTemplate;
|
||||
netRes.lpRemoteName = mRemoteUNCPath.BeginWriting();
|
||||
netRes.lpRemoteName = reinterpret_cast<wchar_t*>(mRemoteUNCPath.BeginWriting());
|
||||
wchar_t driveLetter = L'D';
|
||||
DWORD result = NO_ERROR;
|
||||
do {
|
||||
@ -86,7 +88,7 @@ void
|
||||
DriveMapping::Disconnect(wchar_t aDriveLetter)
|
||||
{
|
||||
wchar_t drvTemplate[] = {aDriveLetter, L':', L'\0'};
|
||||
DWORD result = WNetCancelConnection2W(drvTemplate, 0, TRUE);
|
||||
mozilla::DebugOnly<DWORD> result = WNetCancelConnection2W(drvTemplate, 0, TRUE);
|
||||
MOZ_ASSERT(result == NO_ERROR);
|
||||
}
|
||||
|
||||
@ -104,7 +106,7 @@ DriveToNtPath(const wchar_t aDriveLetter, nsAString& aNtPath)
|
||||
aNtPath.SetLength(MAX_PATH);
|
||||
DWORD pathLen;
|
||||
while (true) {
|
||||
pathLen = QueryDosDeviceW(drvTpl, aNtPath.BeginWriting(), aNtPath.Length());
|
||||
pathLen = QueryDosDeviceW(drvTpl, reinterpret_cast<wchar_t*>(aNtPath.BeginWriting()), aNtPath.Length());
|
||||
if (pathLen || GetLastError() != ERROR_INSUFFICIENT_BUFFER) {
|
||||
break;
|
||||
}
|
||||
@ -115,7 +117,7 @@ DriveToNtPath(const wchar_t aDriveLetter, nsAString& aNtPath)
|
||||
}
|
||||
// aNtPath contains embedded NULLs, so we need to figure out the real length
|
||||
// via wcslen.
|
||||
aNtPath.SetLength(wcslen(aNtPath.BeginReading()));
|
||||
aNtPath.SetLength(NS_strlen(aNtPath.BeginReading()));
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -191,7 +193,7 @@ int main(int argc, char* argv[])
|
||||
fail("Querying network drive");
|
||||
return 1;
|
||||
}
|
||||
networkPath += L"\\";
|
||||
networkPath += MOZ_UTF16("\\");
|
||||
if (!TestNtPathToDosPath(networkPath.get(), expected)) {
|
||||
fail("Mapped UNC path");
|
||||
result = 1;
|
||||
@ -208,7 +210,7 @@ int main(int argc, char* argv[])
|
||||
fail("Querying second network drive");
|
||||
return 1;
|
||||
}
|
||||
networkPath += L"\\";
|
||||
networkPath += MOZ_UTF16("\\");
|
||||
if (!TestNtPathToDosPath(networkPath.get(), expected)) {
|
||||
fail("Re-mapped UNC path");
|
||||
result = 1;
|
||||
|
Loading…
Reference in New Issue
Block a user