diff --git a/accessible/ipc/DocAccessibleParent.cpp b/accessible/ipc/DocAccessibleParent.cpp index d82e546a4a37..92ee44fef646 100644 --- a/accessible/ipc/DocAccessibleParent.cpp +++ b/accessible/ipc/DocAccessibleParent.cpp @@ -496,7 +496,9 @@ DocAccessibleParent::RecvGetWindowedPluginIAccessible( // one that belongs to its child (see HTMLWin32ObjectAccessible). HWND childWnd = ::GetWindow(reinterpret_cast(aHwnd), GW_CHILD); if (!childWnd) { - return IPC_FAIL(this, "GetWindow failed"); + // We're seeing this in the wild - the plugin is windowed but we no longer + // have a window. + return IPC_OK(); } IAccessible* rawAccPlugin = nullptr; diff --git a/accessible/windows/msaa/HTMLWin32ObjectAccessible.cpp b/accessible/windows/msaa/HTMLWin32ObjectAccessible.cpp index 41730d21ef60..3644db68d7d8 100644 --- a/accessible/windows/msaa/HTMLWin32ObjectAccessible.cpp +++ b/accessible/windows/msaa/HTMLWin32ObjectAccessible.cpp @@ -85,10 +85,7 @@ HTMLWin32ObjectAccessible::HTMLWin32ObjectAccessible(void* aHwnd, // use its inner child owned by the plugin so that we don't get // in an infinite loop, where the WM_GETOBJECT's get forwarded // back to us and create another HTMLWin32ObjectAccessible - HWND childWnd = ::GetWindow((HWND)aHwnd, GW_CHILD); - if (childWnd) { - mHwnd = childWnd; - } + mHwnd = ::GetWindow((HWND)aHwnd, GW_CHILD); } } diff --git a/browser/base/content/tabbrowser.xml b/browser/base/content/tabbrowser.xml index a132347dbda6..ec5ef340e9fd 100644 --- a/browser/base/content/tabbrowser.xml +++ b/browser/base/content/tabbrowser.xml @@ -4810,6 +4810,14 @@ } break; } + case "contextual-identity-updated": { + for (let tab of this.tabs) { + if (tab.getAttribute("usercontextid") == aData) { + ContextualIdentityService.setTabStyle(tab); + } + } + break; + } case "nsPref:changed": { // This is the only pref observed. this._findAsYouType = Services.prefs.getBoolPref("accessibility.typeaheadfind"); @@ -4826,6 +4834,7 @@ Services.obs.addObserver(this, "live-resize-start", false); Services.obs.addObserver(this, "live-resize-end", false); + Services.obs.addObserver(this, "contextual-identity-updated", false); this.mCurrentTab = this.tabContainer.firstChild; const nsIEventListenerService = @@ -4925,6 +4934,7 @@ & aTarget) void KeyframeEffect::SetIterationComposite( - const IterationCompositeOperation& aIterationComposite) + const IterationCompositeOperation& aIterationComposite, + CallerType aCallerType) { // Ignore iterationComposite if the Web Animations API is not enabled, // then the default value 'Replace' will be used. - if (!AnimationUtils::IsCoreAPIEnabledForCaller()) { + if (!AnimationUtils::IsCoreAPIEnabledForCaller(aCallerType)) { return; } @@ -156,6 +157,7 @@ KeyframeEffect::SetIterationComposite( void KeyframeEffect::SetSpacing(JSContext* aCx, const nsAString& aSpacing, + CallerType aCallerType, ErrorResult& aRv) { SpacingMode spacingMode = SpacingMode::distribute; @@ -165,6 +167,7 @@ KeyframeEffect::SetSpacing(JSContext* aCx, spacingMode, pacedProperty, invalidPacedProperty, + aCallerType, aRv); if (aRv.Failed()) { return; diff --git a/dom/animation/KeyframeEffect.h b/dom/animation/KeyframeEffect.h index 3c704a82025c..c6db3d4c9a3b 100644 --- a/dom/animation/KeyframeEffect.h +++ b/dom/animation/KeyframeEffect.h @@ -8,6 +8,7 @@ #define mozilla_dom_KeyframeEffect_h #include "nsWrapperCache.h" +#include "mozilla/dom/BindingDeclarations.h" #include "mozilla/dom/KeyframeEffectReadOnly.h" #include "mozilla/AnimationTarget.h" // For (Non)OwningAnimationTarget #include "mozilla/Maybe.h" @@ -71,9 +72,19 @@ public: // GetStyleContextForElement. void SetTarget(const Nullable& aTarget); - void SetSpacing(JSContext* aCx, const nsAString& aSpacing, ErrorResult& aRv); + void GetSpacing(nsString& aRetVal, CallerType aCallerType) + { + KeyframeEffectReadOnly::GetSpacing(aRetVal); + } + void SetSpacing(JSContext* aCx, const nsAString& aSpacing, + CallerType aCallerType, ErrorResult& aRv); + IterationCompositeOperation IterationComposite(CallerType aCallerType) + { + return KeyframeEffectReadOnly::IterationComposite(); + } void SetIterationComposite( - const IterationCompositeOperation& aIterationComposite); + const IterationCompositeOperation& aIterationComposite, + CallerType aCallerType); }; } // namespace dom diff --git a/dom/animation/KeyframeEffectParams.cpp b/dom/animation/KeyframeEffectParams.cpp index 25764069194c..ff51d7f58958 100644 --- a/dom/animation/KeyframeEffectParams.cpp +++ b/dom/animation/KeyframeEffectParams.cpp @@ -109,13 +109,14 @@ KeyframeEffectParams::ParseSpacing(const nsAString& aSpacing, SpacingMode& aSpacingMode, nsCSSPropertyID& aPacedProperty, nsAString& aInvalidPacedProperty, + dom::CallerType aCallerType, ErrorResult& aRv) { aInvalidPacedProperty.Truncate(); // Ignore spacing if the core API is not enabled since it is not yet ready to // ship. - if (!AnimationUtils::IsCoreAPIEnabledForCaller()) { + if (!AnimationUtils::IsCoreAPIEnabledForCaller(aCallerType)) { aSpacingMode = SpacingMode::distribute; return; } diff --git a/dom/animation/KeyframeEffectParams.h b/dom/animation/KeyframeEffectParams.h index 708ee6cf32bf..3c385c68b3d1 100644 --- a/dom/animation/KeyframeEffectParams.h +++ b/dom/animation/KeyframeEffectParams.h @@ -14,6 +14,7 @@ #undef None #endif #include "mozilla/dom/KeyframeEffectBinding.h" // IterationCompositeOperation +#include "mozilla/dom/BindingDeclarations.h" // CallerType namespace mozilla { @@ -54,6 +55,7 @@ struct KeyframeEffectParams SpacingMode& aSpacingMode, nsCSSPropertyID& aPacedProperty, nsAString& aInvalidPacedProperty, + dom::CallerType aCallerType, ErrorResult& aRv); dom::IterationCompositeOperation mIterationComposite = diff --git a/dom/animation/KeyframeEffectReadOnly.cpp b/dom/animation/KeyframeEffectReadOnly.cpp index 24a1fcee0b35..3afdb5447c7b 100644 --- a/dom/animation/KeyframeEffectReadOnly.cpp +++ b/dom/animation/KeyframeEffectReadOnly.cpp @@ -568,6 +568,7 @@ template static KeyframeEffectParams KeyframeEffectParamsFromUnion(const OptionsType& aOptions, nsAString& aInvalidPacedProperty, + CallerType aCallerType, ErrorResult& aRv) { KeyframeEffectParams result; @@ -578,10 +579,11 @@ KeyframeEffectParamsFromUnion(const OptionsType& aOptions, result.mSpacingMode, result.mPacedProperty, aInvalidPacedProperty, + aCallerType, aRv); // Ignore iterationComposite if the Web Animations API is not enabled, // then the default value 'Replace' will be used. - if (AnimationUtils::IsCoreAPIEnabledForCaller()) { + if (AnimationUtils::IsCoreAPIEnabledForCaller(aCallerType)) { result.mIterationComposite = options.mIterationComposite; // FIXME: Bug 1311620: We don't support additive animation yet. if (options.mComposite != dom::CompositeOperation::Add) { @@ -639,7 +641,8 @@ KeyframeEffectReadOnly::ConstructKeyframeEffect( nsAutoString invalidPacedProperty; KeyframeEffectParams effectOptions = - KeyframeEffectParamsFromUnion(aOptions, invalidPacedProperty, aRv); + KeyframeEffectParamsFromUnion(aOptions, invalidPacedProperty, + aGlobal.CallerType(), aRv); if (aRv.Failed()) { return nullptr; } diff --git a/dom/animation/KeyframeEffectReadOnly.h b/dom/animation/KeyframeEffectReadOnly.h index 356468bcfe68..2b615c7006f7 100644 --- a/dom/animation/KeyframeEffectReadOnly.h +++ b/dom/animation/KeyframeEffectReadOnly.h @@ -24,6 +24,7 @@ // associated RefPtrTraits #include "mozilla/StyleAnimationValue.h" #include "mozilla/dom/AnimationEffectReadOnly.h" +#include "mozilla/dom/BindingDeclarations.h" #include "mozilla/dom/Element.h" struct JSContext; diff --git a/dom/base/Location.cpp b/dom/base/Location.cpp index 125a956f2c71..e3b614931a5e 100644 --- a/dom/base/Location.cpp +++ b/dom/base/Location.cpp @@ -581,7 +581,7 @@ Location::GetPathname(nsAString& aPathname) result = GetURI(getter_AddRefs(uri)); - nsCOMPtr url(do_QueryInterface(uri)); + nsCOMPtr url(do_QueryInterface(uri)); if (url) { nsAutoCString file; @@ -604,12 +604,12 @@ Location::SetPathname(const nsAString& aPathname) return rv; } - rv = uri->SetPath(NS_ConvertUTF16toUTF8(aPathname)); - if (NS_WARN_IF(NS_FAILED(rv))) { - return rv; + nsCOMPtr url(do_QueryInterface(uri)); + if (url && NS_SUCCEEDED(url->SetFilePath(NS_ConvertUTF16toUTF8(aPathname)))) { + return SetURI(uri); } - return SetURI(uri); + return NS_OK; } NS_IMETHODIMP diff --git a/dom/bindings/BindingDeclarations.h b/dom/bindings/BindingDeclarations.h index c712511abd93..ed2dcdd85c3e 100644 --- a/dom/bindings/BindingDeclarations.h +++ b/dom/bindings/BindingDeclarations.h @@ -84,6 +84,8 @@ struct EnumEntry { size_t length; }; +enum class CallerType : uint32_t; + class MOZ_STACK_CLASS GlobalObject { public: @@ -113,6 +115,10 @@ public: // a nullptr is returned. nsIPrincipal* GetSubjectPrincipal() const; + // Get the caller type. Note that this needs to be called before anyone has + // had a chance to mess with the JSContext. + dom::CallerType CallerType() const; + protected: JS::Rooted mGlobalJSObject; JSContext* mCx; diff --git a/dom/bindings/BindingUtils.cpp b/dom/bindings/BindingUtils.cpp index 245baca15e51..c4ec712adb89 100644 --- a/dom/bindings/BindingUtils.cpp +++ b/dom/bindings/BindingUtils.cpp @@ -2315,6 +2315,13 @@ GlobalObject::GetSubjectPrincipal() const return nsJSPrincipals::get(principals); } +CallerType +GlobalObject::CallerType() const +{ + return nsContentUtils::ThreadsafeIsSystemCaller(mCx) ? + dom::CallerType::System : dom::CallerType::NonSystem; +} + static bool CallOrdinaryHasInstance(JSContext* cx, JS::CallArgs& args) { diff --git a/dom/canvas/WebGL2Context.h b/dom/canvas/WebGL2Context.h index 144984f355f8..99b85b16de79 100644 --- a/dom/canvas/WebGL2Context.h +++ b/dom/canvas/WebGL2Context.h @@ -314,7 +314,7 @@ public: already_AddRefed CreateSampler(); void DeleteSampler(WebGLSampler* sampler); - bool IsSampler(WebGLSampler* sampler); + bool IsSampler(const WebGLSampler* sampler); void BindSampler(GLuint unit, WebGLSampler* sampler); void SamplerParameteri(WebGLSampler& sampler, GLenum pname, GLint param); void SamplerParameterf(WebGLSampler& sampler, GLenum pname, GLfloat param); @@ -326,7 +326,7 @@ public: // Sync objects - WebGL2ContextSync.cpp already_AddRefed FenceSync(GLenum condition, GLbitfield flags); - bool IsSync(WebGLSync* sync); + bool IsSync(const WebGLSync* sync); void DeleteSync(WebGLSync* sync); GLenum ClientWaitSync(const WebGLSync& sync, GLbitfield flags, GLuint64 timeout); void WaitSync(const WebGLSync& sync, GLbitfield flags, GLint64 timeout); @@ -339,7 +339,7 @@ public: already_AddRefed CreateTransformFeedback(); void DeleteTransformFeedback(WebGLTransformFeedback* tf); - bool IsTransformFeedback(WebGLTransformFeedback* tf); + bool IsTransformFeedback(const WebGLTransformFeedback* tf); void BindTransformFeedback(GLenum target, WebGLTransformFeedback* tf); void BeginTransformFeedback(GLenum primitiveMode); void EndTransformFeedback(); diff --git a/dom/canvas/WebGL2ContextPrograms.cpp b/dom/canvas/WebGL2ContextPrograms.cpp index 277c64f72e0c..b53798e75546 100644 --- a/dom/canvas/WebGL2ContextPrograms.cpp +++ b/dom/canvas/WebGL2ContextPrograms.cpp @@ -19,7 +19,7 @@ WebGL2Context::GetFragDataLocation(const WebGLProgram& prog, const nsAString& na if (IsContextLost()) return -1; - if (!ValidateObjectRef("getFragDataLocation: program", prog)) + if (!ValidateObject("getFragDataLocation: program", prog)) return -1; return prog.GetFragDataLocation(name); diff --git a/dom/canvas/WebGL2ContextQueries.cpp b/dom/canvas/WebGL2ContextQueries.cpp index 6673554b0b5e..a2eafcfc4ca8 100644 --- a/dom/canvas/WebGL2ContextQueries.cpp +++ b/dom/canvas/WebGL2ContextQueries.cpp @@ -78,13 +78,7 @@ WebGLContext::DeleteQuery(WebGLQuery* query, const char* funcName) funcName = "deleteQuery"; } - if (IsContextLost()) - return; - - if (!query) - return; - - if (!ValidateObjectAllowDeleted(funcName, query)) + if (!ValidateDeleteObject(funcName, query)) return; query->DeleteQuery(); @@ -97,13 +91,7 @@ WebGLContext::IsQuery(const WebGLQuery* query, const char* funcName) funcName = "isQuery"; } - if (IsContextLost()) - return false; - - if (!query) - return false; - - if (!ValidateObjectAllowDeleted("isQuery", query)) + if (!ValidateIsObject(funcName, query)) return false; return query->IsQuery(); @@ -119,12 +107,9 @@ WebGLContext::BeginQuery(GLenum target, WebGLQuery& query, const char* funcName) if (IsContextLost()) return; - if (!ValidateObjectAllowDeleted(funcName, &query)) + if (!ValidateObject(funcName, query)) return; - if (query.IsDeleted()) - return ErrorInvalidOperation("%s: Cannot begin a deleted query.", funcName); - const auto& slot = ValidateQuerySlotByTarget(funcName, target); if (!slot) return; @@ -238,12 +223,9 @@ WebGLContext::GetQueryParameter(JSContext*, const WebGLQuery& query, GLenum pnam if (IsContextLost()) return; - if (!ValidateObjectAllowDeleted(funcName, &query)) + if (!ValidateObject(funcName, query)) return; - if (query.IsDeleted()) - return ErrorInvalidOperation("%s: Query must not be deleted.", funcName); - query.GetQueryParameter(pname, retval); } diff --git a/dom/canvas/WebGL2ContextSamplers.cpp b/dom/canvas/WebGL2ContextSamplers.cpp index 7594ff22234d..8c7d9bf659b8 100644 --- a/dom/canvas/WebGL2ContextSamplers.cpp +++ b/dom/canvas/WebGL2ContextSamplers.cpp @@ -26,13 +26,7 @@ WebGL2Context::CreateSampler() void WebGL2Context::DeleteSampler(WebGLSampler* sampler) { - if (IsContextLost()) - return; - - if (!ValidateObjectAllowDeletedOrNull("deleteSampler", sampler)) - return; - - if (!sampler || sampler->IsDeleted()) + if (!ValidateDeleteObject("deleteSampler", sampler)) return; for (int n = 0; n < mGLMaxTextureUnits; n++) { @@ -47,18 +41,9 @@ WebGL2Context::DeleteSampler(WebGLSampler* sampler) } bool -WebGL2Context::IsSampler(WebGLSampler* sampler) +WebGL2Context::IsSampler(const WebGLSampler* sampler) { - if (IsContextLost()) - return false; - - if (!sampler) - return false; - - if (!ValidateObjectAllowDeleted("isSampler", sampler)) - return false; - - if (sampler->IsDeleted()) + if (!ValidateIsObject("isSampler", sampler)) return false; MakeContextCurrent(); @@ -71,15 +56,12 @@ WebGL2Context::BindSampler(GLuint unit, WebGLSampler* sampler) if (IsContextLost()) return; - if (!ValidateObjectAllowDeletedOrNull("bindSampler", sampler)) + if (sampler && !ValidateObject("bindSampler", *sampler)) return; if (GLint(unit) >= mGLMaxTextureUnits) return ErrorInvalidValue("bindSampler: unit must be < %d", mGLMaxTextureUnits); - if (sampler && sampler->IsDeleted()) - return ErrorInvalidOperation("bindSampler: binding deleted sampler"); - //// gl->MakeCurrent(); @@ -96,7 +78,7 @@ WebGL2Context::SamplerParameteri(WebGLSampler& sampler, GLenum pname, GLint para if (IsContextLost()) return; - if (!ValidateObjectRef(funcName, sampler)) + if (!ValidateObject(funcName, sampler)) return; sampler.SamplerParameter(funcName, pname, paramInt); @@ -109,7 +91,7 @@ WebGL2Context::SamplerParameterf(WebGLSampler& sampler, GLenum pname, GLfloat pa if (IsContextLost()) return; - if (!ValidateObjectRef(funcName, sampler)) + if (!ValidateObject(funcName, sampler)) return; sampler.SamplerParameter(funcName, pname, WebGLIntOrFloat(paramFloat).AsInt()); @@ -125,7 +107,7 @@ WebGL2Context::GetSamplerParameter(JSContext*, const WebGLSampler& sampler, GLen if (IsContextLost()) return; - if (!ValidateObjectRef(funcName, sampler)) + if (!ValidateObject(funcName, sampler)) return; //// diff --git a/dom/canvas/WebGL2ContextSync.cpp b/dom/canvas/WebGL2ContextSync.cpp index 6ff39387fef5..3d60d45c06f1 100644 --- a/dom/canvas/WebGL2ContextSync.cpp +++ b/dom/canvas/WebGL2ContextSync.cpp @@ -16,43 +16,37 @@ namespace mozilla { already_AddRefed WebGL2Context::FenceSync(GLenum condition, GLbitfield flags) { - if (IsContextLost()) - return nullptr; + if (IsContextLost()) + return nullptr; - if (condition != LOCAL_GL_SYNC_GPU_COMMANDS_COMPLETE) { - ErrorInvalidEnum("fenceSync: condition must be SYNC_GPU_COMMANDS_COMPLETE"); - return nullptr; - } + if (condition != LOCAL_GL_SYNC_GPU_COMMANDS_COMPLETE) { + ErrorInvalidEnum("fenceSync: condition must be SYNC_GPU_COMMANDS_COMPLETE"); + return nullptr; + } - if (flags != 0) { - ErrorInvalidValue("fenceSync: flags must be 0"); - return nullptr; - } + if (flags != 0) { + ErrorInvalidValue("fenceSync: flags must be 0"); + return nullptr; + } - MakeContextCurrent(); - RefPtr globj = new WebGLSync(this, condition, flags); - return globj.forget(); + MakeContextCurrent(); + RefPtr globj = new WebGLSync(this, condition, flags); + return globj.forget(); } bool -WebGL2Context::IsSync(WebGLSync* sync) +WebGL2Context::IsSync(const WebGLSync* sync) { - if (IsContextLost()) - return false; + if (!ValidateIsObject("isSync", sync)) + return false; - return ValidateObjectAllowDeleted("isSync", sync) && !sync->IsDeleted(); + return true; } void WebGL2Context::DeleteSync(WebGLSync* sync) { - if (IsContextLost()) - return; - - if (!ValidateObjectAllowDeletedOrNull("deleteSync", sync)) - return; - - if (!sync || sync->IsDeleted()) + if (!ValidateDeleteObject("deleteSync", sync)) return; sync->RequestDelete(); @@ -65,7 +59,7 @@ WebGL2Context::ClientWaitSync(const WebGLSync& sync, GLbitfield flags, GLuint64 if (IsContextLost()) return LOCAL_GL_WAIT_FAILED; - if (!ValidateObjectRef(funcName, sync)) + if (!ValidateObject(funcName, sync)) return LOCAL_GL_WAIT_FAILED; if (flags != 0 && flags != LOCAL_GL_SYNC_FLUSH_COMMANDS_BIT) { @@ -84,7 +78,7 @@ WebGL2Context::WaitSync(const WebGLSync& sync, GLbitfield flags, GLint64 timeout if (IsContextLost()) return; - if (!ValidateObjectRef(funcName, sync)) + if (!ValidateObject(funcName, sync)) return; if (flags != 0) { @@ -110,7 +104,7 @@ WebGL2Context::GetSyncParameter(JSContext*, const WebGLSync& sync, GLenum pname, if (IsContextLost()) return; - if (!ValidateObjectRef(funcName, sync)) + if (!ValidateObject(funcName, sync)) return; //// diff --git a/dom/canvas/WebGL2ContextTransformFeedback.cpp b/dom/canvas/WebGL2ContextTransformFeedback.cpp index fe5ec00a98d0..ee2f99341535 100644 --- a/dom/canvas/WebGL2ContextTransformFeedback.cpp +++ b/dom/canvas/WebGL2ContextTransformFeedback.cpp @@ -32,10 +32,7 @@ void WebGL2Context::DeleteTransformFeedback(WebGLTransformFeedback* tf) { const char funcName[] = "deleteTransformFeedback"; - if (IsContextLost()) - return; - - if (!ValidateObject(funcName, tf)) + if (!ValidateDeleteObject(funcName, tf)) return; if (tf->mIsActive) { @@ -51,15 +48,9 @@ WebGL2Context::DeleteTransformFeedback(WebGLTransformFeedback* tf) } bool -WebGL2Context::IsTransformFeedback(WebGLTransformFeedback* tf) +WebGL2Context::IsTransformFeedback(const WebGLTransformFeedback* tf) { - if (IsContextLost()) - return false; - - if (!ValidateObjectAllowDeletedOrNull("isTransformFeedback", tf)) - return false; - - if (!tf || tf->IsDeleted()) + if (!ValidateIsObject("isTransformFeedback", tf)) return false; MakeContextCurrent(); @@ -76,12 +67,9 @@ WebGL2Context::BindTransformFeedback(GLenum target, WebGLTransformFeedback* tf) if (target != LOCAL_GL_TRANSFORM_FEEDBACK) return ErrorInvalidEnum("%s: `target` must be TRANSFORM_FEEDBACK.", funcName); - if (!ValidateObjectAllowDeletedOrNull(funcName, tf)) + if (tf && !ValidateObject(funcName, *tf)) return; - if (tf && tf->IsDeleted()) - return ErrorInvalidOperation("%s: TFO already deleted.", funcName); - if (mBoundTransformFeedback->mIsActive && !mBoundTransformFeedback->mIsPaused) { @@ -143,7 +131,7 @@ WebGL2Context::TransformFeedbackVaryings(WebGLProgram& program, if (IsContextLost()) return; - if (!ValidateObjectRef("transformFeedbackVaryings: program", program)) + if (!ValidateObject("transformFeedbackVaryings: program", program)) return; program.TransformFeedbackVaryings(varyings, bufferMode); @@ -155,7 +143,7 @@ WebGL2Context::GetTransformFeedbackVarying(const WebGLProgram& program, GLuint i if (IsContextLost()) return nullptr; - if (!ValidateObjectRef("getTransformFeedbackVarying: program", program)) + if (!ValidateObject("getTransformFeedbackVarying: program", program)) return nullptr; return program.GetTransformFeedbackVarying(index); diff --git a/dom/canvas/WebGL2ContextUniforms.cpp b/dom/canvas/WebGL2ContextUniforms.cpp index e6e1d6990d19..95ca07fbf332 100644 --- a/dom/canvas/WebGL2ContextUniforms.cpp +++ b/dom/canvas/WebGL2ContextUniforms.cpp @@ -138,7 +138,7 @@ WebGL2Context::GetUniformIndices(const WebGLProgram& program, if (IsContextLost()) return; - if (!ValidateObjectRef("getUniformIndices: program", program)) + if (!ValidateObject("getUniformIndices: program", program)) return; if (!uniformNames.Length()) @@ -179,7 +179,7 @@ WebGL2Context::GetActiveUniforms(JSContext* cx, const WebGLProgram& program, if (!ValidateUniformEnum(this, pname, funcName)) return; - if (!ValidateObjectRef("getActiveUniforms: program", program)) + if (!ValidateObject("getActiveUniforms: program", program)) return; const auto& count = uniformIndices.Length(); @@ -231,7 +231,7 @@ WebGL2Context::GetUniformBlockIndex(const WebGLProgram& program, if (IsContextLost()) return 0; - if (!ValidateObjectRef("getUniformBlockIndex: program", program)) + if (!ValidateObject("getUniformBlockIndex: program", program)) return 0; return program.GetUniformBlockIndex(uniformBlockName); @@ -247,7 +247,7 @@ WebGL2Context::GetActiveUniformBlockParameter(JSContext* cx, const WebGLProgram& if (IsContextLost()) return; - if (!ValidateObjectRef("getActiveUniformBlockParameter: program", program)) + if (!ValidateObject("getActiveUniformBlockParameter: program", program)) return; MakeContextCurrent(); @@ -278,7 +278,7 @@ WebGL2Context::GetActiveUniformBlockName(const WebGLProgram& program, if (IsContextLost()) return; - if (!ValidateObjectRef("getActiveUniformBlockName: program", program)) + if (!ValidateObject("getActiveUniformBlockName: program", program)) return; program.GetActiveUniformBlockName(uniformBlockIndex, retval); @@ -291,7 +291,7 @@ WebGL2Context::UniformBlockBinding(WebGLProgram& program, GLuint uniformBlockInd if (IsContextLost()) return; - if (!ValidateObjectRef("uniformBlockBinding: program", program)) + if (!ValidateObject("uniformBlockBinding: program", program)) return; program.UniformBlockBinding(uniformBlockIndex, uniformBlockBinding); diff --git a/dom/canvas/WebGLBuffer.cpp b/dom/canvas/WebGLBuffer.cpp index 2647bc33cbac..8bea9ffbbee4 100644 --- a/dom/canvas/WebGLBuffer.cpp +++ b/dom/canvas/WebGLBuffer.cpp @@ -13,7 +13,7 @@ namespace mozilla { WebGLBuffer::WebGLBuffer(WebGLContext* webgl, GLuint buf) - : WebGLContextBoundObject(webgl) + : WebGLRefCountedObject(webgl) , mGLName(buf) , mContent(Kind::Undefined) , mUsage(LOCAL_GL_STATIC_DRAW) diff --git a/dom/canvas/WebGLBuffer.h b/dom/canvas/WebGLBuffer.h index cb4c87edc33b..c60bc9b5d81f 100644 --- a/dom/canvas/WebGLBuffer.h +++ b/dom/canvas/WebGLBuffer.h @@ -22,7 +22,6 @@ class WebGLBuffer final : public nsWrapperCache , public WebGLRefCountedObject , public LinkedListElement - , public WebGLContextBoundObject { friend class WebGLContext; friend class WebGL2Context; diff --git a/dom/canvas/WebGLContext.cpp b/dom/canvas/WebGLContext.cpp index 86bdd7ab23b4..3e9569ad227e 100644 --- a/dom/canvas/WebGLContext.cpp +++ b/dom/canvas/WebGLContext.cpp @@ -222,7 +222,7 @@ WebGLContext::~WebGLContext() } template -static void +void ClearLinkedList(LinkedList& list) { while (!list.isEmpty()) { diff --git a/dom/canvas/WebGLContext.h b/dom/canvas/WebGLContext.h index 635ecad515af..19c65fd6d704 100644 --- a/dom/canvas/WebGLContext.h +++ b/dom/canvas/WebGLContext.h @@ -616,11 +616,11 @@ public: GetUniformLocation(const WebGLProgram& prog, const nsAString& name); void Hint(GLenum target, GLenum mode); - bool IsFramebuffer(WebGLFramebuffer* fb); - bool IsProgram(WebGLProgram* prog); - bool IsRenderbuffer(WebGLRenderbuffer* rb); - bool IsShader(WebGLShader* shader); - bool IsVertexArray(WebGLVertexArray* vao); + bool IsFramebuffer(const WebGLFramebuffer* fb); + bool IsProgram(const WebGLProgram* prog); + bool IsRenderbuffer(const WebGLRenderbuffer* rb); + bool IsShader(const WebGLShader* shader); + bool IsVertexArray(const WebGLVertexArray* vao); void LineWidth(GLfloat width); void LinkProgram(WebGLProgram& prog); void PixelStorei(GLenum pname, GLint param); @@ -1628,33 +1628,95 @@ protected: ////// public: - // Returns false if `object` is null or not valid. - template - bool ValidateObject(const char* info, const ObjectType* object); + bool ValidateObjectAllowDeleted(const char* funcName, + const WebGLContextBoundObject& object) + { + if (!object.IsCompatibleWithContext(this)) { + ErrorInvalidOperation("%s: Object from different WebGL context (or older" + " generation of this one) passed as argument.", + funcName); + return false; + } - // Returns false if `object` is not valid. - template - bool ValidateObjectRef(const char* info, const ObjectType& object); + return true; + } - // Returns false if `object` is not valid. Considers null to be valid. - template - bool ValidateObjectAllowNull(const char* info, const ObjectType* object); + bool ValidateObject(const char* funcName, const WebGLDeletableObject& object, + bool isShaderOrProgram = false) + { + if (!ValidateObjectAllowDeleted(funcName, object)) + return false; - // Returns false if `object` is not valid, but considers deleted objects and - // null objects valid. - template - bool ValidateObjectAllowDeletedOrNull(const char* info, const ObjectType* object); + if (isShaderOrProgram) { + /* GLES 3.0.5 p45: + * "Commands that accept shader or program object names will generate the + * error INVALID_VALUE if the provided name is not the name of either a + * shader or program object[.]" + * Further, shaders and programs appear to be different from other objects, + * in that their lifetimes are better defined. However, they also appear to + * allow use of objects marked for deletion, and only reject + * actually-destroyed objects. + */ + if (object.IsDeleted()) { + ErrorInvalidValue("%s: Shader or program object argument cannot have been" + " deleted.", + funcName); + return false; + } + } else { + if (object.IsDeleteRequested()) { + ErrorInvalidOperation("%s: Object argument cannot have been marked for" + " deletion.", + funcName); + return false; + } + } - // Returns false if `object` is null or not valid, but considers deleted - // objects valid. - template - bool ValidateObjectAllowDeleted(const char* info, const ObjectType* object); + return true; + } -private: - // Like ValidateObject, but only for cases when `object` is known to not be - // null already. - template - bool ValidateObjectAssumeNonNull(const char* info, const ObjectType* object); + //// + + bool ValidateObject(const char* funcName, const WebGLProgram& object); + bool ValidateObject(const char* funcName, const WebGLShader& object); + + //// + + bool ValidateIsObject(const char* funcName, + const WebGLDeletableObject* object) const + { + if (IsContextLost()) + return false; + + if (!object) + return false; + + if (!object->IsCompatibleWithContext(this)) + return false; + + if (object->IsDeleted()) + return false; + + return true; + } + + bool ValidateDeleteObject(const char* funcName, const WebGLDeletableObject* object) { + if (IsContextLost()) + return false; + + if (!object) + return false; + + if (!ValidateObjectAllowDeleted(funcName, *object)) + return false; + + if (object->IsDeleteRequested()) + return false; + + return true; + } + + //// private: // ------------------------------------------------------------------------- @@ -1953,82 +2015,6 @@ ToSupports(WebGLContext* webgl) return static_cast(webgl); } -/** - ** Template implementations - **/ - -template -inline bool -WebGLContext::ValidateObjectAllowDeletedOrNull(const char* info, const ObjectType* object) -{ - if (object && !object->IsCompatibleWithContext(this)) { - ErrorInvalidOperation("%s: object from different WebGL context " - "(or older generation of this one) " - "passed as argument", info); - return false; - } - - return true; -} - -template -inline bool -WebGLContext::ValidateObjectAssumeNonNull(const char* info, const ObjectType* object) -{ - MOZ_ASSERT(object); - - if (!ValidateObjectAllowDeletedOrNull(info, object)) - return false; - - if (object->IsDeleted()) { - ErrorInvalidValue("%s: Deleted object passed as argument.", info); - return false; - } - - return true; -} - -template -inline bool -WebGLContext::ValidateObjectAllowNull(const char* info, const ObjectType* object) -{ - if (!object) - return true; - - return ValidateObjectAssumeNonNull(info, object); -} - -template -inline bool -WebGLContext::ValidateObjectAllowDeleted(const char* info, const ObjectType* object) -{ - if (!object) { - ErrorInvalidValue("%s: null object passed as argument", info); - return false; - } - - return ValidateObjectAllowDeletedOrNull(info, object); -} - -template -inline bool -WebGLContext::ValidateObject(const char* info, const ObjectType* object) -{ - if (!object) { - ErrorInvalidValue("%s: null object passed as argument", info); - return false; - } - - return ValidateObjectAssumeNonNull(info, object); -} - -template -inline bool -WebGLContext::ValidateObjectRef(const char* info, const ObjectType& object) -{ - return ValidateObjectAssumeNonNull(info, &object); -} - // Returns `value` rounded to the next highest multiple of `multiple`. // AKA PadToAlignment, StrideForAlignment. template diff --git a/dom/canvas/WebGLContextBuffers.cpp b/dom/canvas/WebGLContextBuffers.cpp index 03bd50934b39..54c09370563d 100644 --- a/dom/canvas/WebGLContextBuffers.cpp +++ b/dom/canvas/WebGLContextBuffers.cpp @@ -119,12 +119,9 @@ WebGLContext::BindBuffer(GLenum target, WebGLBuffer* buffer) if (IsContextLost()) return; - if (!ValidateObjectAllowDeletedOrNull(funcName, buffer)) + if (buffer && !ValidateObject(funcName, *buffer)) return; - if (buffer && buffer->IsDeleted()) - return ErrorInvalidOperation("%s: Cannot bind a deleted object.", funcName); - const auto& slot = ValidateBufferSlot(funcName, target); if (!slot) return; @@ -183,12 +180,9 @@ WebGLContext::BindBufferBase(GLenum target, GLuint index, WebGLBuffer* buffer) if (IsContextLost()) return; - if (!ValidateObjectAllowDeletedOrNull(funcName, buffer)) + if (buffer && !ValidateObject(funcName, *buffer)) return; - if (buffer && buffer->IsDeleted()) - return ErrorInvalidOperation("%s: Cannot bind a deleted object.", funcName); - WebGLRefPtr* genericBinding; IndexedBufferBinding* indexedBinding; if (!ValidateIndexedBufferBinding(funcName, target, index, &genericBinding, @@ -234,12 +228,9 @@ WebGLContext::BindBufferRange(GLenum target, GLuint index, WebGLBuffer* buffer, if (IsContextLost()) return; - if (!ValidateObjectAllowDeletedOrNull(funcName, buffer)) + if (buffer && !ValidateObject(funcName, *buffer)) return; - if (buffer && buffer->IsDeleted()) - return ErrorInvalidOperation("%s: Cannot bind a deleted object.", funcName); - if (!ValidateNonNegative(funcName, "offset", offset) || !ValidateNonNegative(funcName, "size", size)) { @@ -476,13 +467,7 @@ WebGLContext::CreateBuffer() void WebGLContext::DeleteBuffer(WebGLBuffer* buffer) { - if (IsContextLost()) - return; - - if (!ValidateObjectAllowDeletedOrNull("deleteBuffer", buffer)) - return; - - if (!buffer || buffer->IsDeleted()) + if (!ValidateDeleteObject("deleteBuffer", buffer)) return; //// @@ -530,13 +515,7 @@ WebGLContext::DeleteBuffer(WebGLBuffer* buffer) bool WebGLContext::IsBuffer(WebGLBuffer* buffer) { - if (IsContextLost()) - return false; - - if (!ValidateObjectAllowDeleted("isBuffer", buffer)) - return false; - - if (buffer->IsDeleted()) + if (!ValidateIsObject("isBuffer", buffer)) return false; MakeContextCurrent(); diff --git a/dom/canvas/WebGLContextGL.cpp b/dom/canvas/WebGLContextGL.cpp index 30fb6664c9a2..acf1e2222d38 100644 --- a/dom/canvas/WebGLContextGL.cpp +++ b/dom/canvas/WebGLContextGL.cpp @@ -57,6 +57,18 @@ namespace mozilla { +bool +WebGLContext::ValidateObject(const char* funcName, const WebGLProgram& object) +{ + return ValidateObject(funcName, object, true); +} + +bool +WebGLContext::ValidateObject(const char* funcName, const WebGLShader& object) +{ + return ValidateObject(funcName, object, true); +} + using namespace mozilla::dom; using namespace mozilla::gfx; using namespace mozilla::gl; @@ -92,8 +104,8 @@ WebGLContext::AttachShader(WebGLProgram& program, WebGLShader& shader) if (IsContextLost()) return; - if (!ValidateObjectRef("attachShader: program", program) || - !ValidateObjectRef("attachShader: shader", shader)) + if (!ValidateObject("attachShader: program", program) || + !ValidateObject("attachShader: shader", shader)) { return; } @@ -108,7 +120,7 @@ WebGLContext::BindAttribLocation(WebGLProgram& prog, GLuint location, if (IsContextLost()) return; - if (!ValidateObjectRef("bindAttribLocation: program", prog)) + if (!ValidateObject("bindAttribLocation: program", prog)) return; prog.BindAttribLocation(location, name); @@ -123,12 +135,9 @@ WebGLContext::BindFramebuffer(GLenum target, WebGLFramebuffer* wfb) if (!ValidateFramebufferTarget(target, "bindFramebuffer")) return; - if (!ValidateObjectAllowDeletedOrNull("bindFramebuffer", wfb)) + if (wfb && !ValidateObject("bindFramebuffer", *wfb)) return; - if (wfb && wfb->IsDeleted()) - return ErrorInvalidOperation("bindFramebuffer: Cannot bind a deleted object."); - MakeContextCurrent(); if (!wfb) { @@ -166,12 +175,9 @@ WebGLContext::BindRenderbuffer(GLenum target, WebGLRenderbuffer* wrb) if (target != LOCAL_GL_RENDERBUFFER) return ErrorInvalidEnumInfo("bindRenderbuffer: target", target); - if (!ValidateObjectAllowDeletedOrNull("bindRenderbuffer", wrb)) + if (wrb && !ValidateObject("bindRenderbuffer", *wrb)) return; - if (wrb && wrb->IsDeleted()) - return ErrorInvalidOperation("bindRenderbuffer: Cannot bind a deleted object."); - // Usually, we would now call into glBindRenderbuffer. However, since we have to // potentially emulate packed-depth-stencil, there's not a specific renderbuffer that // we know we should bind here. @@ -320,13 +326,7 @@ WebGLContext::CullFace(GLenum face) void WebGLContext::DeleteFramebuffer(WebGLFramebuffer* fbuf) { - if (IsContextLost()) - return; - - if (!ValidateObjectAllowDeletedOrNull("deleteFramebuffer", fbuf)) - return; - - if (!fbuf || fbuf->IsDeleted()) + if (!ValidateDeleteObject("deleteFramebuffer", fbuf)) return; fbuf->RequestDelete(); @@ -348,13 +348,7 @@ WebGLContext::DeleteFramebuffer(WebGLFramebuffer* fbuf) void WebGLContext::DeleteRenderbuffer(WebGLRenderbuffer* rbuf) { - if (IsContextLost()) - return; - - if (!ValidateObjectAllowDeletedOrNull("deleteRenderbuffer", rbuf)) - return; - - if (!rbuf || rbuf->IsDeleted()) + if (!ValidateDeleteObject("deleteRenderbuffer", rbuf)) return; if (mBoundDrawFramebuffer) @@ -374,13 +368,7 @@ WebGLContext::DeleteRenderbuffer(WebGLRenderbuffer* rbuf) void WebGLContext::DeleteTexture(WebGLTexture* tex) { - if (IsContextLost()) - return; - - if (!ValidateObjectAllowDeletedOrNull("deleteTexture", tex)) - return; - - if (!tex || tex->IsDeleted()) + if (!ValidateDeleteObject("deleteTexture", tex)) return; if (mBoundDrawFramebuffer) @@ -408,13 +396,7 @@ WebGLContext::DeleteTexture(WebGLTexture* tex) void WebGLContext::DeleteProgram(WebGLProgram* prog) { - if (IsContextLost()) - return; - - if (!ValidateObjectAllowDeletedOrNull("deleteProgram", prog)) - return; - - if (!prog || prog->IsDeleted()) + if (!ValidateDeleteObject("deleteProgram", prog)) return; prog->RequestDelete(); @@ -423,13 +405,7 @@ WebGLContext::DeleteProgram(WebGLProgram* prog) void WebGLContext::DeleteShader(WebGLShader* shader) { - if (IsContextLost()) - return; - - if (!ValidateObjectAllowDeletedOrNull("deleteShader", shader)) - return; - - if (!shader || shader->IsDeleted()) + if (!ValidateDeleteObject("deleteShader", shader)) return; shader->RequestDelete(); @@ -443,8 +419,8 @@ WebGLContext::DetachShader(WebGLProgram& program, const WebGLShader& shader) // It's valid to attempt to detach a deleted shader, since it's still a // shader. - if (!ValidateObjectRef("detachShader: program", program) || - !ValidateObjectAllowDeleted("detachShader: shader", &shader)) + if (!ValidateObject("detachShader: program", program) || + !ValidateObjectAllowDeleted("detachShader: shader", shader)) { return; } @@ -569,7 +545,7 @@ WebGLContext::GetActiveAttrib(const WebGLProgram& prog, GLuint index) if (IsContextLost()) return nullptr; - if (!ValidateObjectRef("getActiveAttrib: program", prog)) + if (!ValidateObject("getActiveAttrib: program", prog)) return nullptr; return prog.GetActiveAttrib(index); @@ -581,7 +557,7 @@ WebGLContext::GetActiveUniform(const WebGLProgram& prog, GLuint index) if (IsContextLost()) return nullptr; - if (!ValidateObjectRef("getActiveUniform: program", prog)) + if (!ValidateObject("getActiveUniform: program", prog)) return nullptr; return prog.GetActiveUniform(index); @@ -595,7 +571,7 @@ WebGLContext::GetAttachedShaders(const WebGLProgram& prog, if (IsContextLost()) return; - if (!ValidateObjectRef("getAttachedShaders", prog)) + if (!ValidateObject("getAttachedShaders", prog)) return; prog.GetAttachedShaders(&retval.SetValue()); @@ -607,7 +583,7 @@ WebGLContext::GetAttribLocation(const WebGLProgram& prog, const nsAString& name) if (IsContextLost()) return -1; - if (!ValidateObjectRef("getAttribLocation: program", prog)) + if (!ValidateObject("getAttribLocation: program", prog)) return -1; return prog.GetAttribLocation(name); @@ -910,7 +886,7 @@ WebGLContext::GetProgramParameter(const WebGLProgram& prog, GLenum pname) if (IsContextLost()) return JS::NullValue(); - if (!ValidateObjectAllowDeleted("getProgramParameter: program", &prog)) + if (!ValidateObjectAllowDeleted("getProgramParameter: program", prog)) return JS::NullValue(); return prog.GetProgramParameter(pname); @@ -924,7 +900,7 @@ WebGLContext::GetProgramInfoLog(const WebGLProgram& prog, nsAString& retval) if (IsContextLost()) return; - if (!ValidateObjectRef("getProgramInfoLog: program", prog)) + if (!ValidateObject("getProgramInfoLog: program", prog)) return; prog.GetProgramInfoLog(&retval); @@ -937,10 +913,10 @@ WebGLContext::GetUniform(JSContext* js, const WebGLProgram& prog, if (IsContextLost()) return JS::NullValue(); - if (!ValidateObjectRef("getUniform: `program`", prog)) + if (!ValidateObject("getUniform: `program`", prog)) return JS::NullValue(); - if (!ValidateObjectRef("getUniform: `location`", loc)) + if (!ValidateObjectAllowDeleted("getUniform: `location`", loc)) return JS::NullValue(); if (!loc.ValidateForProgram(&prog, "getUniform")) @@ -955,7 +931,7 @@ WebGLContext::GetUniformLocation(const WebGLProgram& prog, const nsAString& name if (IsContextLost()) return nullptr; - if (!ValidateObjectRef("getUniformLocation: program", prog)) + if (!ValidateObject("getUniformLocation: program", prog)) return nullptr; return prog.GetUniformLocation(name); @@ -995,15 +971,9 @@ WebGLContext::Hint(GLenum target, GLenum mode) } bool -WebGLContext::IsFramebuffer(WebGLFramebuffer* fb) +WebGLContext::IsFramebuffer(const WebGLFramebuffer* fb) { - if (IsContextLost()) - return false; - - if (!ValidateObjectAllowDeleted("isFramebuffer", fb)) - return false; - - if (fb->IsDeleted()) + if (!ValidateIsObject("isFramebuffer", fb)) return false; #ifdef ANDROID @@ -1019,37 +989,30 @@ WebGLContext::IsFramebuffer(WebGLFramebuffer* fb) } bool -WebGLContext::IsProgram(WebGLProgram* prog) +WebGLContext::IsProgram(const WebGLProgram* prog) { - if (IsContextLost()) + if (!ValidateIsObject("isProgram", prog)) return false; - return ValidateObjectAllowDeleted("isProgram", prog) && !prog->IsDeleted(); + return true; } bool -WebGLContext::IsRenderbuffer(WebGLRenderbuffer* rb) +WebGLContext::IsRenderbuffer(const WebGLRenderbuffer* rb) { - if (IsContextLost()) - return false; - - if (!ValidateObjectAllowDeleted("isRenderBuffer", rb)) - return false; - - if (rb->IsDeleted()) + if (!ValidateIsObject("isRenderbuffer", rb)) return false; return rb->mHasBeenBound; } bool -WebGLContext::IsShader(WebGLShader* shader) +WebGLContext::IsShader(const WebGLShader* shader) { - if (IsContextLost()) + if (!ValidateIsObject("isShader", shader)) return false; - return ValidateObjectAllowDeleted("isShader", shader) && - !shader->IsDeleted(); + return true; } void @@ -1058,7 +1021,7 @@ WebGLContext::LinkProgram(WebGLProgram& prog) if (IsContextLost()) return; - if (!ValidateObjectRef("linkProgram", prog)) + if (!ValidateObject("linkProgram", prog)) return; prog.LinkProgram(); @@ -2101,7 +2064,7 @@ WebGLContext::UseProgram(WebGLProgram* prog) return; } - if (!ValidateObject("useProgram", prog)) + if (!ValidateObject("useProgram", *prog)) return; if (prog->UseProgram()) { @@ -2116,7 +2079,7 @@ WebGLContext::ValidateProgram(const WebGLProgram& prog) if (IsContextLost()) return; - if (!ValidateObjectRef("validateProgram", prog)) + if (!ValidateObject("validateProgram", prog)) return; prog.ValidateProgram(); @@ -2171,7 +2134,7 @@ WebGLContext::CompileShader(WebGLShader& shader) if (IsContextLost()) return; - if (!ValidateObjectRef("compileShader", shader)) + if (!ValidateObject("compileShader", shader)) return; shader.CompileShader(); @@ -2183,7 +2146,7 @@ WebGLContext::GetShaderParameter(const WebGLShader& shader, GLenum pname) if (IsContextLost()) return JS::NullValue(); - if (!ValidateObjectRef("getShaderParameter: shader", shader)) + if (!ValidateObjectAllowDeleted("getShaderParameter: shader", shader)) return JS::NullValue(); return shader.GetShaderParameter(pname); @@ -2197,7 +2160,7 @@ WebGLContext::GetShaderInfoLog(const WebGLShader& shader, nsAString& retval) if (IsContextLost()) return; - if (!ValidateObjectRef("getShaderInfoLog: shader", shader)) + if (!ValidateObject("getShaderInfoLog: shader", shader)) return; shader.GetShaderInfoLog(&retval); @@ -2259,7 +2222,7 @@ WebGLContext::GetShaderSource(const WebGLShader& shader, nsAString& retval) if (IsContextLost()) return; - if (!ValidateObjectRef("getShaderSource: shader", shader)) + if (!ValidateObject("getShaderSource: shader", shader)) return; shader.GetShaderSource(&retval); @@ -2271,7 +2234,7 @@ WebGLContext::ShaderSource(WebGLShader& shader, const nsAString& source) if (IsContextLost()) return; - if (!ValidateObjectRef("shaderSource: shader", shader)) + if (!ValidateObject("shaderSource: shader", shader)) return; shader.ShaderSource(source); diff --git a/dom/canvas/WebGLContextTextures.cpp b/dom/canvas/WebGLContextTextures.cpp index e5975f36f3de..033be7d33236 100644 --- a/dom/canvas/WebGLContextTextures.cpp +++ b/dom/canvas/WebGLContextTextures.cpp @@ -209,7 +209,7 @@ WebGLContext::BindTexture(GLenum rawTarget, WebGLTexture* newTex) if (IsContextLost()) return; - if (!ValidateObjectAllowDeletedOrNull("bindTexture", newTex)) + if (newTex && !ValidateObject("bindTexture", *newTex)) return; // Need to check rawTarget first before comparing against newTex->Target() as @@ -290,10 +290,7 @@ WebGLContext::GetTexParameter(GLenum rawTexTarget, GLenum pname) bool WebGLContext::IsTexture(WebGLTexture* tex) { - if (IsContextLost()) - return false; - - if (!ValidateObjectAllowDeleted("isTexture", tex)) + if (!ValidateIsObject("isTexture", tex)) return false; return tex->IsTexture(); diff --git a/dom/canvas/WebGLContextValidate.cpp b/dom/canvas/WebGLContextValidate.cpp index b3edcf3fbd15..03367140503a 100644 --- a/dom/canvas/WebGLContextValidate.cpp +++ b/dom/canvas/WebGLContextValidate.cpp @@ -207,7 +207,7 @@ WebGLContext::ValidateUniformLocation(WebGLUniformLocation* loc, const char* fun if (!loc) return false; - if (!ValidateObject(funcName, loc)) + if (!ValidateObjectAllowDeleted(funcName, *loc)) return false; if (!mCurrentProgram) { diff --git a/dom/canvas/WebGLContextVertexArray.cpp b/dom/canvas/WebGLContextVertexArray.cpp index 6a4eabf888bc..e9f16d3f75e2 100644 --- a/dom/canvas/WebGLContextVertexArray.cpp +++ b/dom/canvas/WebGLContextVertexArray.cpp @@ -18,20 +18,9 @@ WebGLContext::BindVertexArray(WebGLVertexArray* array) if (IsContextLost()) return; - if (!ValidateObjectAllowDeletedOrNull("bindVertexArrayObject", array)) + if (array && !ValidateObject("bindVertexArrayObject", *array)) return; - if (array && array->IsDeleted()) { - /* http://www.khronos.org/registry/gles/extensions/OES/OES_vertex_array_object.txt - * BindVertexArrayOES fails and an INVALID_OPERATION error is - * generated if array is not a name returned from a previous call to - * GenVertexArraysOES, or if such a name has since been deleted with - * DeleteVertexArraysOES - */ - ErrorInvalidOperation("bindVertexArray: can't bind a deleted array!"); - return; - } - InvalidateBufferFetching(); MakeContextCurrent(); @@ -68,13 +57,7 @@ WebGLContext::CreateVertexArrayImpl() void WebGLContext::DeleteVertexArray(WebGLVertexArray* array) { - if (IsContextLost()) - return; - - if (array == nullptr) - return; - - if (array->IsDeleted()) + if (!ValidateDeleteObject("deleteVertexArray", array)) return; if (mBoundVertexArray == array) @@ -84,18 +67,9 @@ WebGLContext::DeleteVertexArray(WebGLVertexArray* array) } bool -WebGLContext::IsVertexArray(WebGLVertexArray* array) +WebGLContext::IsVertexArray(const WebGLVertexArray* array) { - if (IsContextLost()) - return false; - - if (!array) - return false; - - if (!ValidateObjectAllowDeleted("isVertexArray", array)) - return false; - - if (array->IsDeleted()) + if (!ValidateIsObject("isVertexArray", array)) return false; MakeContextCurrent(); diff --git a/dom/canvas/WebGLExtensionDebugShaders.cpp b/dom/canvas/WebGLExtensionDebugShaders.cpp index a65bd5d12ef6..75880465e2dc 100644 --- a/dom/canvas/WebGLExtensionDebugShaders.cpp +++ b/dom/canvas/WebGLExtensionDebugShaders.cpp @@ -38,7 +38,7 @@ WebGLExtensionDebugShaders::GetTranslatedShaderSource(const WebGLShader& shader, if (mContext->IsContextLost()) return; - if (!mContext->ValidateObjectRef("getShaderTranslatedSource: shader", shader)) + if (!mContext->ValidateObject("getShaderTranslatedSource: shader", shader)) return; shader.GetShaderTranslatedSource(&retval); diff --git a/dom/canvas/WebGLExtensionDisjointTimerQuery.cpp b/dom/canvas/WebGLExtensionDisjointTimerQuery.cpp index 344be81b4eaf..e2e34f14e58c 100644 --- a/dom/canvas/WebGLExtensionDisjointTimerQuery.cpp +++ b/dom/canvas/WebGLExtensionDisjointTimerQuery.cpp @@ -83,7 +83,7 @@ WebGLExtensionDisjointTimerQuery::QueryCounterEXT(WebGLQuery& query, GLenum targ if (mIsLost) return; - if (!mContext->ValidateObjectRef(funcName, query)) + if (!mContext->ValidateObject(funcName, query)) return; query.QueryCounter(funcName, target); diff --git a/dom/canvas/WebGLExtensionVertexArray.cpp b/dom/canvas/WebGLExtensionVertexArray.cpp index 1dfa99d84fc6..0984582f5326 100644 --- a/dom/canvas/WebGLExtensionVertexArray.cpp +++ b/dom/canvas/WebGLExtensionVertexArray.cpp @@ -41,7 +41,7 @@ WebGLExtensionVertexArray::DeleteVertexArrayOES(WebGLVertexArray* array) } bool -WebGLExtensionVertexArray::IsVertexArrayOES(WebGLVertexArray* array) +WebGLExtensionVertexArray::IsVertexArrayOES(const WebGLVertexArray* array) { if (mIsLost) return false; diff --git a/dom/canvas/WebGLExtensions.h b/dom/canvas/WebGLExtensions.h index e1d5c4c24b42..038c8780a9ee 100644 --- a/dom/canvas/WebGLExtensions.h +++ b/dom/canvas/WebGLExtensions.h @@ -344,7 +344,7 @@ public: already_AddRefed CreateVertexArrayOES(); void DeleteVertexArrayOES(WebGLVertexArray* array); - bool IsVertexArrayOES(WebGLVertexArray* array); + bool IsVertexArrayOES(const WebGLVertexArray* array); void BindVertexArrayOES(WebGLVertexArray* array); DECL_WEBGL_EXTENSION_GOOP diff --git a/dom/canvas/WebGLFramebuffer.cpp b/dom/canvas/WebGLFramebuffer.cpp index a773dfbded9d..a9390f05366d 100644 --- a/dom/canvas/WebGLFramebuffer.cpp +++ b/dom/canvas/WebGLFramebuffer.cpp @@ -604,7 +604,7 @@ WebGLFBAttachPoint::GetParameter(const char* funcName, WebGLContext* webgl, JSCo // WebGLFramebuffer WebGLFramebuffer::WebGLFramebuffer(WebGLContext* webgl, GLuint fbo) - : WebGLContextBoundObject(webgl) + : WebGLRefCountedObject(webgl) , mGLName(fbo) #ifdef ANDROID , mIsFB(false) @@ -1301,7 +1301,7 @@ WebGLFramebuffer::FramebufferRenderbuffer(const char* funcName, GLenum attachEnu } // `rb` - if (!mContext->ValidateObjectAllowNull("framebufferRenderbuffer: rb", rb)) + if (rb && !mContext->ValidateObject("framebufferRenderbuffer: rb", *rb)) return; // End of validation. @@ -1343,10 +1343,10 @@ WebGLFramebuffer::FramebufferTexture2D(const char* funcName, GLenum attachEnum, } // `texture` - if (!mContext->ValidateObjectAllowNull("framebufferTexture2D: texture", tex)) - return; - if (tex) { + if (!mContext->ValidateObject("framebufferTexture2D: texture", *tex)) + return; + if (!tex->HasEverBeenBound()) { mContext->ErrorInvalidOperation("%s: `texture` has never been bound.", funcName); @@ -1419,15 +1419,6 @@ WebGLFramebuffer::FramebufferTextureLayer(const char* funcName, GLenum attachEnu } const auto& attach = maybeAttach.value(); - // `texture` - if (!mContext->ValidateObjectAllowNull("framebufferTextureLayer: texture", tex)) - return; - - if (tex && !tex->HasEverBeenBound()) { - mContext->ErrorInvalidOperation("%s: `texture` has never been bound.", funcName); - return; - } - // `level`, `layer` if (layer < 0) return mContext->ErrorInvalidValue("%s: `layer` must be >= 0.", funcName); @@ -1435,8 +1426,18 @@ WebGLFramebuffer::FramebufferTextureLayer(const char* funcName, GLenum attachEnu if (level < 0) return mContext->ErrorInvalidValue("%s: `level` must be >= 0.", funcName); + // `texture` TexImageTarget texImageTarget = LOCAL_GL_TEXTURE_3D; if (tex) { + if (!mContext->ValidateObject("framebufferTextureLayer: texture", *tex)) + return; + + if (!tex->HasEverBeenBound()) { + mContext->ErrorInvalidOperation("%s: `texture` has never been bound.", + funcName); + return; + } + texImageTarget = tex->Target().get(); switch (texImageTarget.get()) { case LOCAL_GL_TEXTURE_3D: diff --git a/dom/canvas/WebGLFramebuffer.h b/dom/canvas/WebGLFramebuffer.h index eb69fddb7750..3b69d1fb0f12 100644 --- a/dom/canvas/WebGLFramebuffer.h +++ b/dom/canvas/WebGLFramebuffer.h @@ -132,7 +132,6 @@ class WebGLFramebuffer final : public nsWrapperCache , public WebGLRefCountedObject , public LinkedListElement - , public WebGLContextBoundObject , public SupportsWeakPtr { friend class WebGLContext; diff --git a/dom/canvas/WebGLObjectModel.h b/dom/canvas/WebGLObjectModel.h index 307c86966a76..e19d2fd8e44d 100644 --- a/dom/canvas/WebGLObjectModel.h +++ b/dom/canvas/WebGLObjectModel.h @@ -12,8 +12,55 @@ namespace mozilla { +template class LinkedList; class WebGLContext; +//// + +// This class is a mixin for objects that are tied to a specific +// context (which is to say, all of them). They provide initialization +// as well as comparison with the current context. +class WebGLContextBoundObject +{ +public: + WebGLContext* const mContext; +private: + const uint32_t mContextGeneration; + +public: + explicit WebGLContextBoundObject(WebGLContext* webgl); + + bool IsCompatibleWithContext(const WebGLContext* other) const; +}; + +//// + +class WebGLDeletableObject : public WebGLContextBoundObject +{ + template friend class WebGLRefCountedObject; + +private: + enum DeletionStatus { Default, DeleteRequested, Deleted }; + + DeletionStatus mDeletionStatus; + + //// + + explicit WebGLDeletableObject(WebGLContext* webgl) + : WebGLContextBoundObject(webgl) + , mDeletionStatus(Default) + { } + + ~WebGLDeletableObject() { + MOZ_ASSERT(mDeletionStatus == Deleted, + "Derived class destructor must call DeleteOnce()."); + } + +public: + bool IsDeleted() const { return mDeletionStatus == Deleted; } + bool IsDeleteRequested() const { return mDeletionStatus != Default; } +}; + /* Each WebGL object class WebGLFoo wants to: * - inherit WebGLRefCountedObject * - implement a Delete() method @@ -91,22 +138,25 @@ class WebGLContext; * class, without either method being virtual. This is a common C++ pattern * known as the "curiously recursive template pattern (CRTP)". */ -template -class WebGLRefCountedObject -{ -public: - enum DeletionStatus { Default, DeleteRequested, Deleted }; - WebGLRefCountedObject() - : mDeletionStatus(Default) - {} +template +class WebGLRefCountedObject : public WebGLDeletableObject +{ + friend class WebGLContext; + template friend void ClearLinkedList(LinkedList& list); + +private: + nsAutoRefCnt mWebGLRefCnt; + +public: + explicit WebGLRefCountedObject(WebGLContext* webgl) + : WebGLDeletableObject(webgl) + { } ~WebGLRefCountedObject() { MOZ_ASSERT(mWebGLRefCnt == 0, "Destroying WebGL object still referenced by other WebGL" " objects."); - MOZ_ASSERT(mDeletionStatus == Deleted, - "Derived class destructor must call DeleteOnce()."); } // called by WebGLRefPtr @@ -129,14 +179,7 @@ public: MaybeDelete(); } - bool IsDeleted() const { - return mDeletionStatus == Deleted; - } - - bool IsDeleteRequested() const { - return mDeletionStatus != Default; - } - +protected: void DeleteOnce() { if (mDeletionStatus != Deleted) { static_cast(this)->Delete(); @@ -152,10 +195,6 @@ private: DeleteOnce(); } } - -protected: - nsAutoRefCnt mWebGLRefCnt; - DeletionStatus mDeletionStatus; }; /* This WebGLRefPtr class is meant to be used for references between WebGL @@ -259,21 +298,6 @@ protected: T* mRawPtr; }; -// This class is a mixin for objects that are tied to a specific -// context (which is to say, all of them). They provide initialization -// as well as comparison with the current context. -class WebGLContextBoundObject -{ -public: - explicit WebGLContextBoundObject(WebGLContext* webgl); - - bool IsCompatibleWithContext(const WebGLContext* other) const; - - WebGLContext* const mContext; -protected: - const uint32_t mContextGeneration; -}; - // this class is a mixin for GL objects that have dimensions // that we need to track. class WebGLRectangleObject diff --git a/dom/canvas/WebGLProgram.cpp b/dom/canvas/WebGLProgram.cpp index 8abf4edb6e4d..f80096d1ea70 100644 --- a/dom/canvas/WebGLProgram.cpp +++ b/dom/canvas/WebGLProgram.cpp @@ -443,7 +443,7 @@ CreateProgram(gl::GLContext* gl) } WebGLProgram::WebGLProgram(WebGLContext* webgl) - : WebGLContextBoundObject(webgl) + : WebGLRefCountedObject(webgl) , mGLName(CreateProgram(webgl->GL())) , mNumActiveTFOs(0) , mNextLink_TransformFeedbackBufferMode(LOCAL_GL_SEPARATE_ATTRIBS) diff --git a/dom/canvas/WebGLProgram.h b/dom/canvas/WebGLProgram.h index 1d1378b62bd7..17f3f31ca24f 100644 --- a/dom/canvas/WebGLProgram.h +++ b/dom/canvas/WebGLProgram.h @@ -130,7 +130,6 @@ class WebGLProgram final : public nsWrapperCache , public WebGLRefCountedObject , public LinkedListElement - , public WebGLContextBoundObject { friend class WebGLTransformFeedback; diff --git a/dom/canvas/WebGLQuery.cpp b/dom/canvas/WebGLQuery.cpp index 065fc6d3a071..a64a895a7f1b 100644 --- a/dom/canvas/WebGLQuery.cpp +++ b/dom/canvas/WebGLQuery.cpp @@ -40,7 +40,7 @@ GenQuery(gl::GLContext* gl) } WebGLQuery::WebGLQuery(WebGLContext* webgl) - : WebGLContextBoundObject(webgl) + : WebGLRefCountedObject(webgl) , mGLName(GenQuery(mContext->gl)) , mTarget(0) , mActiveSlot(nullptr) @@ -211,8 +211,7 @@ WebGLQuery::GetQueryParameter(GLenum pname, JS::MutableHandleValue retval) const bool WebGLQuery::IsQuery() const { - if (IsDeleted()) - return false; + MOZ_ASSERT(!IsDeleted()); if (!mTarget) return false; @@ -223,8 +222,7 @@ WebGLQuery::IsQuery() const void WebGLQuery::DeleteQuery() { - if (IsDeleted()) - return; + MOZ_ASSERT(!IsDeleteRequested()); if (mActiveSlot) { EndQuery(); diff --git a/dom/canvas/WebGLQuery.h b/dom/canvas/WebGLQuery.h index a0aa200fec5a..132e70ae97e8 100644 --- a/dom/canvas/WebGLQuery.h +++ b/dom/canvas/WebGLQuery.h @@ -18,7 +18,6 @@ class WebGLQuery final : public nsWrapperCache , public WebGLRefCountedObject , public LinkedListElement - , public WebGLContextBoundObject { friend class AvailableRunnable; friend class WebGLRefCountedObject; diff --git a/dom/canvas/WebGLRenderbuffer.cpp b/dom/canvas/WebGLRenderbuffer.cpp index 3200d6008ee7..dd0aa5d11636 100644 --- a/dom/canvas/WebGLRenderbuffer.cpp +++ b/dom/canvas/WebGLRenderbuffer.cpp @@ -47,7 +47,7 @@ EmulatePackedDepthStencil(gl::GLContext* gl) } WebGLRenderbuffer::WebGLRenderbuffer(WebGLContext* webgl) - : WebGLContextBoundObject(webgl) + : WebGLRefCountedObject(webgl) , mPrimaryRB( DoCreateRenderbuffer(webgl->gl) ) , mEmulatePackedDepthStencil( EmulatePackedDepthStencil(webgl->gl) ) , mSecondaryRB(0) diff --git a/dom/canvas/WebGLRenderbuffer.h b/dom/canvas/WebGLRenderbuffer.h index 1481441d4341..d16110375d1d 100644 --- a/dom/canvas/WebGLRenderbuffer.h +++ b/dom/canvas/WebGLRenderbuffer.h @@ -23,7 +23,6 @@ class WebGLRenderbuffer final , public WebGLRefCountedObject , public LinkedListElement , public WebGLRectangleObject - , public WebGLContextBoundObject , public WebGLFramebufferAttachable { friend class WebGLContext; diff --git a/dom/canvas/WebGLSampler.cpp b/dom/canvas/WebGLSampler.cpp index e782ccef6382..01795de3dbbf 100644 --- a/dom/canvas/WebGLSampler.cpp +++ b/dom/canvas/WebGLSampler.cpp @@ -12,7 +12,7 @@ namespace mozilla { WebGLSampler::WebGLSampler(WebGLContext* webgl, GLuint sampler) - : WebGLContextBoundObject(webgl) + : WebGLRefCountedObject(webgl) , mGLName(sampler) , mMinFilter(LOCAL_GL_NEAREST_MIPMAP_LINEAR) , mMagFilter(LOCAL_GL_LINEAR) diff --git a/dom/canvas/WebGLSampler.h b/dom/canvas/WebGLSampler.h index 34ffa565456f..282757df2bf4 100644 --- a/dom/canvas/WebGLSampler.h +++ b/dom/canvas/WebGLSampler.h @@ -17,7 +17,6 @@ class WebGLSampler final : public nsWrapperCache , public WebGLRefCountedObject , public LinkedListElement - , public WebGLContextBoundObject { friend class WebGLContext2; friend class WebGLTexture; diff --git a/dom/canvas/WebGLShader.cpp b/dom/canvas/WebGLShader.cpp index 9606505f32cc..edb2757fef9b 100644 --- a/dom/canvas/WebGLShader.cpp +++ b/dom/canvas/WebGLShader.cpp @@ -141,7 +141,7 @@ CreateShader(gl::GLContext* gl, GLenum type) } WebGLShader::WebGLShader(WebGLContext* webgl, GLenum type) - : WebGLContextBoundObject(webgl) + : WebGLRefCountedObject(webgl) , mGLName(CreateShader(webgl->GL(), type)) , mType(type) , mTranslationSuccessful(false) diff --git a/dom/canvas/WebGLShader.h b/dom/canvas/WebGLShader.h index 7cfa1624c37a..92ca3f8baaea 100644 --- a/dom/canvas/WebGLShader.h +++ b/dom/canvas/WebGLShader.h @@ -28,7 +28,6 @@ class WebGLShader final : public nsWrapperCache , public WebGLRefCountedObject , public LinkedListElement - , public WebGLContextBoundObject { friend class WebGLContext; friend class WebGLProgram; diff --git a/dom/canvas/WebGLSync.cpp b/dom/canvas/WebGLSync.cpp index d9cc56044055..c6988fba6de3 100644 --- a/dom/canvas/WebGLSync.cpp +++ b/dom/canvas/WebGLSync.cpp @@ -12,7 +12,7 @@ namespace mozilla { WebGLSync::WebGLSync(WebGLContext* webgl, GLenum condition, GLbitfield flags) - : WebGLContextBoundObject(webgl) + : WebGLRefCountedObject(webgl) { mContext->mSyncs.insertBack(this); mGLName = mContext->gl->fFenceSync(condition, flags); diff --git a/dom/canvas/WebGLSync.h b/dom/canvas/WebGLSync.h index 9893d5a76a23..7a31b9c606b5 100644 --- a/dom/canvas/WebGLSync.h +++ b/dom/canvas/WebGLSync.h @@ -16,7 +16,6 @@ class WebGLSync final : public nsWrapperCache , public WebGLRefCountedObject , public LinkedListElement - , public WebGLContextBoundObject { friend class WebGL2Context; diff --git a/dom/canvas/WebGLTexture.cpp b/dom/canvas/WebGLTexture.cpp index f491db3f906d..fcf208fe1c36 100644 --- a/dom/canvas/WebGLTexture.cpp +++ b/dom/canvas/WebGLTexture.cpp @@ -127,7 +127,7 @@ WebGLTexture::WrapObject(JSContext* cx, JS::Handle givenProto) { } WebGLTexture::WebGLTexture(WebGLContext* webgl, GLuint tex) - : WebGLContextBoundObject(webgl) + : WebGLRefCountedObject(webgl) , mGLName(tex) , mTarget(LOCAL_GL_NONE) , mFaceCount(0) diff --git a/dom/canvas/WebGLTexture.h b/dom/canvas/WebGLTexture.h index 89d278d352ae..1a2dd73ce0c1 100644 --- a/dom/canvas/WebGLTexture.h +++ b/dom/canvas/WebGLTexture.h @@ -57,7 +57,6 @@ class WebGLTexture final : public nsWrapperCache , public WebGLRefCountedObject , public LinkedListElement - , public WebGLContextBoundObject { // Friends friend class WebGLContext; diff --git a/dom/canvas/WebGLTransformFeedback.cpp b/dom/canvas/WebGLTransformFeedback.cpp index 2fa2752be879..6e5c0b745444 100644 --- a/dom/canvas/WebGLTransformFeedback.cpp +++ b/dom/canvas/WebGLTransformFeedback.cpp @@ -12,7 +12,7 @@ namespace mozilla { WebGLTransformFeedback::WebGLTransformFeedback(WebGLContext* webgl, GLuint tf) - : WebGLContextBoundObject(webgl) + : WebGLRefCountedObject(webgl) , mGLName(tf) , mIndexedBindings(webgl->mGLMaxTransformFeedbackSeparateAttribs) , mIsPaused(false) diff --git a/dom/canvas/WebGLTransformFeedback.h b/dom/canvas/WebGLTransformFeedback.h index e681242291a0..d97484a99b47 100644 --- a/dom/canvas/WebGLTransformFeedback.h +++ b/dom/canvas/WebGLTransformFeedback.h @@ -16,7 +16,6 @@ class WebGLTransformFeedback final : public nsWrapperCache , public WebGLRefCountedObject , public LinkedListElement - , public WebGLContextBoundObject { friend class ScopedDrawWithTransformFeedback; friend class WebGLContext; diff --git a/dom/canvas/WebGLVertexArray.cpp b/dom/canvas/WebGLVertexArray.cpp index 1b6f98813fe7..4669f9c3b8f5 100644 --- a/dom/canvas/WebGLVertexArray.cpp +++ b/dom/canvas/WebGLVertexArray.cpp @@ -21,7 +21,7 @@ WebGLVertexArray::WrapObject(JSContext* cx, JS::Handle givenProto) } WebGLVertexArray::WebGLVertexArray(WebGLContext* webgl) - : WebGLContextBoundObject(webgl) + : WebGLRefCountedObject(webgl) , mGLName(0) { mContext->mVertexArrays.insertBack(this); @@ -50,7 +50,7 @@ WebGLVertexArray::Delete() } bool -WebGLVertexArray::IsVertexArray() +WebGLVertexArray::IsVertexArray() const { return IsVertexArrayImpl(); } diff --git a/dom/canvas/WebGLVertexArray.h b/dom/canvas/WebGLVertexArray.h index 9d2d0ff67e49..b49ce26f319b 100644 --- a/dom/canvas/WebGLVertexArray.h +++ b/dom/canvas/WebGLVertexArray.h @@ -23,7 +23,6 @@ class WebGLVertexArray : public nsWrapperCache , public WebGLRefCountedObject , public LinkedListElement - , public WebGLContextBoundObject { public: static WebGLVertexArray* Create(WebGLContext* webgl); @@ -44,7 +43,7 @@ public: // Implement parent classes: void Delete(); - bool IsVertexArray(); + bool IsVertexArray() const; WebGLContext* GetParentObject() const { return mContext; @@ -67,7 +66,7 @@ protected: virtual void GenVertexArray() = 0; virtual void BindVertexArrayImpl() = 0; virtual void DeleteImpl() = 0; - virtual bool IsVertexArrayImpl() = 0; + virtual bool IsVertexArrayImpl() const = 0; GLuint mGLName; nsTArray mAttribs; diff --git a/dom/canvas/WebGLVertexArrayFake.cpp b/dom/canvas/WebGLVertexArrayFake.cpp index 4c9482dfbd4c..ee9df6dacba5 100644 --- a/dom/canvas/WebGLVertexArrayFake.cpp +++ b/dom/canvas/WebGLVertexArrayFake.cpp @@ -62,7 +62,7 @@ WebGLVertexArrayFake::DeleteImpl() } bool -WebGLVertexArrayFake::IsVertexArrayImpl() +WebGLVertexArrayFake::IsVertexArrayImpl() const { return mIsVAO; } diff --git a/dom/canvas/WebGLVertexArrayFake.h b/dom/canvas/WebGLVertexArrayFake.h index 6f970c965747..b7dc569e1587 100644 --- a/dom/canvas/WebGLVertexArrayFake.h +++ b/dom/canvas/WebGLVertexArrayFake.h @@ -19,7 +19,7 @@ protected: virtual void BindVertexArrayImpl() override; virtual void DeleteImpl() override; virtual void GenVertexArray() override {}; - virtual bool IsVertexArrayImpl() override; + virtual bool IsVertexArrayImpl() const override; private: explicit WebGLVertexArrayFake(WebGLContext* webgl); diff --git a/dom/canvas/WebGLVertexArrayGL.cpp b/dom/canvas/WebGLVertexArrayGL.cpp index 2ba38330ecdf..aa7313150f7c 100644 --- a/dom/canvas/WebGLVertexArrayGL.cpp +++ b/dom/canvas/WebGLVertexArrayGL.cpp @@ -47,7 +47,7 @@ WebGLVertexArrayGL::GenVertexArray() } bool -WebGLVertexArrayGL::IsVertexArrayImpl() +WebGLVertexArrayGL::IsVertexArrayImpl() const { gl::GLContext* gl = mContext->gl; if (gl->WorkAroundDriverBugs()) diff --git a/dom/canvas/WebGLVertexArrayGL.h b/dom/canvas/WebGLVertexArrayGL.h index c64291033e35..8ab172470dec 100644 --- a/dom/canvas/WebGLVertexArrayGL.h +++ b/dom/canvas/WebGLVertexArrayGL.h @@ -19,7 +19,7 @@ public: virtual void DeleteImpl() override; virtual void BindVertexArrayImpl() override; virtual void GenVertexArray() override; - virtual bool IsVertexArrayImpl() override; + virtual bool IsVertexArrayImpl() const override; protected: explicit WebGLVertexArrayGL(WebGLContext* webgl); diff --git a/dom/canvas/moz.build b/dom/canvas/moz.build index e6a27d26081e..bbbfdd644406 100644 --- a/dom/canvas/moz.build +++ b/dom/canvas/moz.build @@ -9,7 +9,7 @@ TEST_DIRS += [ ] # Change the following line(s) to avoid bug 1081323 (clobber after changing a manifest): -# * Implement ReadPixel with PBOs. +# * Adjust failure errata for webgl-conf. MOCHITEST_MANIFESTS += [ 'test/crash/mochitest.ini', diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/extensions/oes-vertex-array-object.html b/dom/canvas/test/webgl-conf/checkout/conformance/extensions/oes-vertex-array-object.html index a540eb00ef8e..118f26c2afa8 100644 --- a/dom/canvas/test/webgl-conf/checkout/conformance/extensions/oes-vertex-array-object.html +++ b/dom/canvas/test/webgl-conf/checkout/conformance/extensions/oes-vertex-array-object.html @@ -126,10 +126,10 @@ function runSupportedTest(extensionEnabled) { function runBindingTestDisabled() { debug(""); debug("Testing binding enum with extension disabled"); - + // Use the constant directly as we don't have the extension var VERTEX_ARRAY_BINDING_OES = 0x85B5; - + gl.getParameter(VERTEX_ARRAY_BINDING_OES); wtu.glErrorShouldBe(gl, gl.INVALID_ENUM, "VERTEX_ARRAY_BINDING_OES should not be queryable if extension is disabled"); } @@ -137,12 +137,12 @@ function runBindingTestDisabled() { function runBindingTestEnabled() { debug(""); debug("Testing binding enum with extension enabled"); - + shouldBe("ext.VERTEX_ARRAY_BINDING_OES", "0x85B5"); - + gl.getParameter(ext.VERTEX_ARRAY_BINDING_OES); wtu.glErrorShouldBe(gl, gl.NO_ERROR, "VERTEX_ARRAY_BINDING_OES query should succeed if extension is enabled"); - + // Default value is null if (gl.getParameter(ext.VERTEX_ARRAY_BINDING_OES) === null) { testPassed("Default value of VERTEX_ARRAY_BINDING_OES is null"); @@ -179,20 +179,20 @@ function runBindingTestEnabled() { function runObjectTest() { debug(""); debug("Testing object creation"); - + vao = ext.createVertexArrayOES(); wtu.glErrorShouldBe(gl, gl.NO_ERROR, "createVertexArrayOES should not set an error"); shouldBeNonNull("vao"); - + // Expect false if never bound shouldBeFalse("ext.isVertexArrayOES(vao)"); ext.bindVertexArrayOES(vao); shouldBeTrue("ext.isVertexArrayOES(vao)"); ext.bindVertexArrayOES(null); shouldBeTrue("ext.isVertexArrayOES(vao)"); - + shouldBeFalse("ext.isVertexArrayOES(null)"); - + ext.deleteVertexArrayOES(vao); vao = null; } @@ -200,57 +200,57 @@ function runObjectTest() { function runAttributeTests() { debug(""); debug("Testing attributes work across bindings"); - + var states = []; - + var attrCount = gl.getParameter(gl.MAX_VERTEX_ATTRIBS); for (var n = 0; n < attrCount; n++) { gl.bindBuffer(gl.ARRAY_BUFFER, null); gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, null); - + var state = {}; states.push(state); - + var vao = state.vao = ext.createVertexArrayOES(); ext.bindVertexArrayOES(vao); - + var enableArray = (n % 2 == 0); if (enableArray) { gl.enableVertexAttribArray(n); } else { gl.disableVertexAttribArray(n); } - + if (enableArray) { var buffer = state.buffer = gl.createBuffer(); gl.bindBuffer(gl.ARRAY_BUFFER, buffer); gl.bufferData(gl.ARRAY_BUFFER, 1024, gl.STATIC_DRAW); - + gl.vertexAttribPointer(n, 1 + n % 4, gl.FLOAT, true, n * 4, n * 4); } - + if (enableArray) { var elbuffer = state.elbuffer = gl.createBuffer(); gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, elbuffer); gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, 1024, gl.STATIC_DRAW); } - + ext.bindVertexArrayOES(null); } - + var anyMismatch = false; for (var n = 0; n < attrCount; n++) { var state = states[n]; - + ext.bindVertexArrayOES(state.vao); - + var shouldBeEnabled = (n % 2 == 0); var isEnabled = gl.getVertexAttrib(n, gl.VERTEX_ATTRIB_ARRAY_ENABLED); if (shouldBeEnabled != isEnabled) { testFailed("VERTEX_ATTRIB_ARRAY_ENABLED not preserved"); anyMismatch = true; } - + var buffer = gl.getVertexAttrib(n, gl.VERTEX_ATTRIB_ARRAY_BUFFER_BINDING); if (shouldBeEnabled) { if (buffer == state.buffer) { @@ -276,7 +276,7 @@ function runAttributeTests() { anyMismatch = true; } } - + var elbuffer = gl.getParameter(gl.ELEMENT_ARRAY_BUFFER_BINDING); if (shouldBeEnabled) { if (elbuffer == state.elbuffer) { @@ -298,7 +298,7 @@ function runAttributeTests() { if (!anyMismatch) { testPassed("All attributes preserved across bindings"); } - + for (var n = 0; n < attrCount; n++) { var state = states[n]; ext.deleteVertexArrayOES(state.vao); @@ -308,41 +308,41 @@ function runAttributeTests() { function runAttributeValueTests() { debug(""); debug("Testing that attribute values are not attached to bindings"); - + var v; var vao0 = ext.createVertexArrayOES(); var anyFailed = false; - + ext.bindVertexArrayOES(null); gl.vertexAttrib4f(0, 0, 1, 2, 3); - + v = gl.getVertexAttrib(0, gl.CURRENT_VERTEX_ATTRIB); if (!(v[0] == 0 && v[1] == 1 && v[2] == 2 && v[3] == 3)) { testFailed("Vertex attrib value not round-tripped?"); anyFailed = true; } - + ext.bindVertexArrayOES(vao0); - + v = gl.getVertexAttrib(0, gl.CURRENT_VERTEX_ATTRIB); if (!(v[0] == 0 && v[1] == 1 && v[2] == 2 && v[3] == 3)) { testFailed("Vertex attrib value reset across bindings"); anyFailed = true; } - + gl.vertexAttrib4f(0, 4, 5, 6, 7); ext.bindVertexArrayOES(null); - + v = gl.getVertexAttrib(0, gl.CURRENT_VERTEX_ATTRIB); if (!(v[0] == 4 && v[1] == 5 && v[2] == 6 && v[3] == 7)) { testFailed("Vertex attrib value bound to buffer"); anyFailed = true; } - + if (!anyFailed) { testPassed("Vertex attribute values are not attached to bindings") } - + ext.bindVertexArrayOES(null); ext.deleteVertexArrayOES(vao0); } @@ -350,19 +350,19 @@ function runAttributeValueTests() { function runDrawTests() { debug(""); debug("Testing draws with various VAO bindings"); - + canvas.width = 50; canvas.height = 50; gl.viewport(0, 0, canvas.width, canvas.height); - + var vao0 = ext.createVertexArrayOES(); var vao1 = ext.createVertexArrayOES(); var vao2 = ext.createVertexArrayOES(); var positionLocation = 0; var colorLocation = 1; - + var program = wtu.setupSimpleVertexColorProgram(gl, positionLocation, colorLocation); - + function setupQuad(s, colorsInArray) { var vertexObject = gl.createBuffer(); gl.bindBuffer(gl.ARRAY_BUFFER, vertexObject); @@ -393,7 +393,7 @@ function runDrawTests() { gl.disableVertexAttribArray(colorLocation); } }; - + function verifyDiagonalPixels(s, expectedInside, drawDescription) { // Tests pixels along a diagonal running from the center of the canvas to the (0, 0) corner. // Values on the points list indicate relative position along this diagonal. @@ -411,7 +411,7 @@ function runDrawTests() { var expectedInside = colorsInArray ? 0 : 128; verifyDiagonalPixels(s, expectedInside, drawDescription); }; - + // Setup all bindings setupQuad(1, true); ext.bindVertexArrayOES(vao0); @@ -422,7 +422,7 @@ function runDrawTests() { setupQuad(0.75, false); gl.vertexAttrib4f(colorLocation, 0.5, 0.5, 0.5, 1); - + // Verify drawing ext.bindVertexArrayOES(null); verifyDraw("with the default VAO", 1, true); @@ -624,25 +624,31 @@ function runBoundDeleteTests() { gl.deleteBuffer(colorBuffer); gl.deleteBuffer(positionBuffer); - // The buffers should not be accessible at this point. Deleted objects that are bound - // in the current context undergo an automatic unbinding + var expectRetained = (ii != 0); + var shouldBeStr = (expectRetained ? "retained" : "cleared"); + var boundPositionBuffer = gl.getVertexAttrib(0, gl.VERTEX_ATTRIB_ARRAY_BUFFER_BINDING); - if(boundPositionBuffer == positionBuffer) { - testFailed("Position buffer should be automatically unbound when deleted"); + if (expectRetained != (boundPositionBuffer == positionBuffer)) { + testFailed("Position attrib stored buffer should be " + shouldBeStr + "."); } + var boundColorBuffer = gl.getVertexAttrib(1, gl.VERTEX_ATTRIB_ARRAY_BUFFER_BINDING); - if(boundColorBuffer == colorBuffer) { - testFailed("Color buffer should be automatically unbound when deleted"); + if (expectRetained != (boundColorBuffer == colorBuffer)) { + testFailed("Color attrib stored buffer should be " + shouldBeStr + "."); } + // If retained, everything should still work. If cleared, drawing should now fail. gl.drawElements(gl.TRIANGLES, 6, gl.UNSIGNED_BYTE, 0); - wtu.glErrorShouldBe(gl, gl.INVALID_OPERATION, "Draw call should fail with unbound position and color buffers"); + var expectedError = (expectRetained ? gl.NO_ERROR : gl.INVALID_OPERATION); + wtu.glErrorShouldBe(gl, expectedError, + "Draw call should " + (expectRetained ? "not " : "") + "fail."); - var isPositionBuffer = gl.isBuffer(positionBuffer); - var isColorBuffer = gl.isBuffer(colorBuffer); - - if(isPositionBuffer) testFailed("Position buffer should no longer exist after last ref removed"); - if(isColorBuffer) testFailed("Color buffer should no longer exist after last ref removed"); + if (!gl.isBuffer(positionBuffer)) { + testFailed("Position buffer should count for isBuffer."); + } + if (!gl.isBuffer(colorBuffer)) { + testFailed("Color buffer should count for isBuffer."); + } } } diff --git a/dom/canvas/test/webgl-conf/generated-mochitest.ini b/dom/canvas/test/webgl-conf/generated-mochitest.ini index 23ca55c06912..c5a3b5071a5b 100644 --- a/dom/canvas/test/webgl-conf/generated-mochitest.ini +++ b/dom/canvas/test/webgl-conf/generated-mochitest.ini @@ -6028,7 +6028,6 @@ fail-if = (os == 'mac') || (os == 'win') || (os == 'android') || (os == 'linux') [generated/test_conformance__extensions__oes-vertex-array-object-bufferData.html] [generated/test_conformance__extensions__oes-vertex-array-object.html] skip-if = (os == 'mac' && os_version == '10.6') -fail-if = (os == 'win') || (os == 'mac') || (os == 'android') || (os == 'linux') [generated/test_conformance__extensions__webgl-compressed-texture-atc.html] [generated/test_conformance__extensions__webgl-compressed-texture-pvrtc.html] [generated/test_conformance__extensions__webgl-compressed-texture-s3tc.html] diff --git a/dom/canvas/test/webgl-conf/mochitest-errata.ini b/dom/canvas/test/webgl-conf/mochitest-errata.ini index af68a566d5e3..7b8cfb2198ee 100644 --- a/dom/canvas/test/webgl-conf/mochitest-errata.ini +++ b/dom/canvas/test/webgl-conf/mochitest-errata.ini @@ -129,7 +129,6 @@ skip-if = (os == 'android' && debug) # 10.6 crash: # PROCESS-CRASH | dom/canvas/test/webgl-conf/generated/test_conformance__extensions__oes-vertex-array-object.html | application crashed [@ gleRunVertexSubmitImmediate + 0xf24] skip-if = (os == 'mac' && os_version == '10.6') -fail-if = (os == 'win') || (os == 'mac') || (os == 'android') || (os == 'linux') [generated/test_conformance__textures__misc__texture-size.html] # application crashed [@ mozilla::gl::GLContext::AfterGLCall] skip-if = (os == 'android') || (os == 'win') diff --git a/dom/media/DOMMediaStream.cpp b/dom/media/DOMMediaStream.cpp index ccecb73fec06..6794ee32f2ab 100644 --- a/dom/media/DOMMediaStream.cpp +++ b/dom/media/DOMMediaStream.cpp @@ -200,7 +200,8 @@ public: if (track) { LOG(LogLevel::Debug, ("DOMMediaStream %p MediaStreamTrack %p ended at the source. Marking it ended.", mStream, track.get())); - track->OverrideEnded(); + NS_DispatchToMainThread(NewRunnableMethod( + track, &MediaStreamTrack::OverrideEnded)); } } @@ -270,7 +271,8 @@ public: return; } - mStream->NotifyFinished(); + NS_DispatchToMainThread(NewRunnableMethod( + mStream, &DOMMediaStream::NotifyFinished)); } // The methods below are called on the MediaStreamGraph thread. diff --git a/dom/media/MediaManager.cpp b/dom/media/MediaManager.cpp index ead1258826e3..1f0bdb2b05d3 100644 --- a/dom/media/MediaManager.cpp +++ b/dom/media/MediaManager.cpp @@ -1230,10 +1230,10 @@ public: // We won't need mOnFailure now. mOnFailure = nullptr; - if (!MediaManager::IsPrivateBrowsing(window)) { + if (!OriginAttributes::IsPrivateBrowsing(mOrigin)) { // Call GetOriginKey again, this time w/persist = true, to promote // deviceIds to persistent, in case they're not already. Fire'n'forget. - RefPtr> p = media::GetOriginKey(mOrigin, false, true); + RefPtr> p = media::GetOriginKey(mOrigin, true); } return NS_OK; } @@ -1934,13 +1934,6 @@ MediaManager::NotifyRecordingStatusChange(nsPIDOMWindowInner* aWindow, return NS_OK; } -bool MediaManager::IsPrivateBrowsing(nsPIDOMWindowInner* window) -{ - nsCOMPtr doc = window->GetDoc(); - nsCOMPtr loadContext = doc->GetLoadContext(); - return loadContext && loadContext->UsePrivateBrowsing(); -} - int MediaManager::AddDeviceChangeCallback(DeviceChangeCallback* aCallback) { bool fakeDeviceChangeEventOn = mPrefs.mFakeDeviceChangeEventOn; @@ -2497,7 +2490,6 @@ MediaManager::EnumerateDevicesImpl(uint64_t aWindowId, // 2. Get the raw devices list // 3. Anonymize the raw list with the origin-key. - bool privateBrowsing = IsPrivateBrowsing(window); nsCOMPtr principal = nsGlobalWindow::Cast(window)->GetPrincipal(); MOZ_ASSERT(principal); @@ -2512,8 +2504,7 @@ MediaManager::EnumerateDevicesImpl(uint64_t aWindowId, // thread later once GetOriginKey resolves. Needed variables are "captured" // (passed by value) safely into the lambda. - RefPtr> p = media::GetOriginKey(origin, privateBrowsing, - persist); + RefPtr> p = media::GetOriginKey(origin, persist); p->Then([id, aWindowId, aVideoType, aAudioType, aFake](const nsCString& aOriginKey) mutable { MOZ_ASSERT(NS_IsMainThread()); diff --git a/dom/media/MediaManager.h b/dom/media/MediaManager.h index 1255f6c90b41..cf6b93698e69 100644 --- a/dom/media/MediaManager.h +++ b/dom/media/MediaManager.h @@ -257,7 +257,6 @@ public: MediaEnginePrefs mPrefs; typedef nsTArray> SourceSet; - static bool IsPrivateBrowsing(nsPIDOMWindowInner* window); virtual int AddDeviceChangeCallback(DeviceChangeCallback* aCallback) override; virtual void OnDeviceChange() override; diff --git a/dom/media/eme/CDMProxy.h b/dom/media/eme/CDMProxy.h index f3f1add43f57..c927b28a0655 100644 --- a/dom/media/eme/CDMProxy.h +++ b/dom/media/eme/CDMProxy.h @@ -95,8 +95,7 @@ public: virtual void Init(PromiseId aPromiseId, const nsAString& aOrigin, const nsAString& aTopLevelOrigin, - const nsAString& aName, - bool aInPrivateBrowsing) = 0; + const nsAString& aName) = 0; virtual void OnSetDecryptorId(uint32_t aId) {} diff --git a/dom/media/eme/MediaKeys.cpp b/dom/media/eme/MediaKeys.cpp index 0b3dba68dc62..a703a8fe6698 100644 --- a/dom/media/eme/MediaKeys.cpp +++ b/dom/media/eme/MediaKeys.cpp @@ -409,14 +409,10 @@ MediaKeys::Init(ErrorResult& aRv) return promise.forget(); } - nsIDocument* doc = window->GetExtantDoc(); - const bool inPrivateBrowsing = nsContentUtils::IsInPrivateBrowsing(doc); - - EME_LOG("MediaKeys[%p]::Create() (%s, %s), %s", + EME_LOG("MediaKeys[%p]::Create() (%s, %s)", this, origin.get(), - topLevelOrigin.get(), - (inPrivateBrowsing ? "PrivateBrowsing" : "NonPrivateBrowsing")); + topLevelOrigin.get()); // The CDMProxy's initialization is asynchronous. The MediaKeys is // refcounted, and its instance is returned to JS by promise once @@ -432,8 +428,7 @@ MediaKeys::Init(ErrorResult& aRv) mProxy->Init(mCreatePromiseId, NS_ConvertUTF8toUTF16(origin), NS_ConvertUTF8toUTF16(topLevelOrigin), - KeySystemToGMPName(mKeySystem), - inPrivateBrowsing); + KeySystemToGMPName(mKeySystem)); return promise.forget(); } diff --git a/dom/media/eme/mediadrm/MediaDrmCDMProxy.cpp b/dom/media/eme/mediadrm/MediaDrmCDMProxy.cpp index 8c83defcb2b5..5266990a3496 100644 --- a/dom/media/eme/mediadrm/MediaDrmCDMProxy.cpp +++ b/dom/media/eme/mediadrm/MediaDrmCDMProxy.cpp @@ -46,16 +46,14 @@ void MediaDrmCDMProxy::Init(PromiseId aPromiseId, const nsAString& aOrigin, const nsAString& aTopLevelOrigin, - const nsAString& aName, - bool aInPrivateBrowsing) + const nsAString& aName) { MOZ_ASSERT(NS_IsMainThread()); NS_ENSURE_TRUE_VOID(!mKeys.IsNull()); EME_LOG("MediaDrmCDMProxy::Init (%s, %s) %s", NS_ConvertUTF16toUTF8(aOrigin).get(), - NS_ConvertUTF16toUTF8(aTopLevelOrigin).get(), - (aInPrivateBrowsing ? "PrivateBrowsing" : "NonPrivateBrowsing")); + NS_ConvertUTF16toUTF8(aTopLevelOrigin).get()); // Create a thread to work with cdm. if (!mOwnerThread) { diff --git a/dom/media/eme/mediadrm/MediaDrmCDMProxy.h b/dom/media/eme/mediadrm/MediaDrmCDMProxy.h index f17735c75649..72b297acb397 100644 --- a/dom/media/eme/mediadrm/MediaDrmCDMProxy.h +++ b/dom/media/eme/mediadrm/MediaDrmCDMProxy.h @@ -37,8 +37,7 @@ public: void Init(PromiseId aPromiseId, const nsAString& aOrigin, const nsAString& aTopLevelOrigin, - const nsAString& aGMPName, - bool aInPrivateBrowsing) override; + const nsAString& aGMPName) override; void CreateSession(uint32_t aCreateSessionToken, MediaKeySessionType aSessionType, diff --git a/dom/media/gmp/GMPCDMProxy.cpp b/dom/media/gmp/GMPCDMProxy.cpp index b6d6b40d679d..21a94dab9a55 100644 --- a/dom/media/gmp/GMPCDMProxy.cpp +++ b/dom/media/gmp/GMPCDMProxy.cpp @@ -54,16 +54,14 @@ void GMPCDMProxy::Init(PromiseId aPromiseId, const nsAString& aOrigin, const nsAString& aTopLevelOrigin, - const nsAString& aGMPName, - bool aInPrivateBrowsing) + const nsAString& aGMPName) { MOZ_ASSERT(NS_IsMainThread()); NS_ENSURE_TRUE_VOID(!mKeys.IsNull()); - EME_LOG("GMPCDMProxy::Init (%s, %s) %s", + EME_LOG("GMPCDMProxy::Init (%s, %s)", NS_ConvertUTF16toUTF8(aOrigin).get(), - NS_ConvertUTF16toUTF8(aTopLevelOrigin).get(), - (aInPrivateBrowsing ? "PrivateBrowsing" : "NonPrivateBrowsing")); + NS_ConvertUTF16toUTF8(aTopLevelOrigin).get()); nsCString pluginVersion; if (!mOwnerThread) { @@ -93,7 +91,6 @@ GMPCDMProxy::Init(PromiseId aPromiseId, data->mOrigin = aOrigin; data->mTopLevelOrigin = aTopLevelOrigin; data->mGMPName = aGMPName; - data->mInPrivateBrowsing = aInPrivateBrowsing; data->mCrashHelper = mCrashHelper; nsCOMPtr task( NewRunnableMethod&&>(this, @@ -210,7 +207,6 @@ GMPCDMProxy::gmp_Init(UniquePtr&& aData) nsresult rv = mps->GetNodeId(data.mOrigin, data.mTopLevelOrigin, data.mGMPName, - data.mInPrivateBrowsing, Move(callback)); if (NS_FAILED(rv)) { RejectPromise(data.mPromiseId, NS_ERROR_DOM_INVALID_STATE_ERR, @@ -241,10 +237,9 @@ GMPCDMProxy::gmp_InitGetGMPDecryptor(nsresult aResult, return; } - EME_LOG("GMPCDMProxy::gmp_Init (%s, %s) %s NodeId=%s", + EME_LOG("GMPCDMProxy::gmp_Init (%s, %s) NodeId=%s", NS_ConvertUTF16toUTF8(aData->mOrigin).get(), NS_ConvertUTF16toUTF8(aData->mTopLevelOrigin).get(), - (aData->mInPrivateBrowsing ? "PrivateBrowsing" : "NonPrivateBrowsing"), GetNodeId().get()); nsTArray tags; diff --git a/dom/media/gmp/GMPCDMProxy.h b/dom/media/gmp/GMPCDMProxy.h index 646b6025a53d..d91de4acd895 100644 --- a/dom/media/gmp/GMPCDMProxy.h +++ b/dom/media/gmp/GMPCDMProxy.h @@ -31,8 +31,7 @@ public: void Init(PromiseId aPromiseId, const nsAString& aOrigin, const nsAString& aTopLevelOrigin, - const nsAString& aGMPName, - bool aInPrivateBrowsing) override; + const nsAString& aGMPName) override; void OnSetDecryptorId(uint32_t aId) override; @@ -123,7 +122,6 @@ private: nsString mTopLevelOrigin; nsString mGMPName; RefPtr mCrashHelper; - bool mInPrivateBrowsing; }; // GMP thread only. diff --git a/dom/media/gmp/GMPServiceChild.cpp b/dom/media/gmp/GMPServiceChild.cpp index f79d5a700bee..9e7d9efe63c5 100644 --- a/dom/media/gmp/GMPServiceChild.cpp +++ b/dom/media/gmp/GMPServiceChild.cpp @@ -235,7 +235,6 @@ NS_IMETHODIMP GeckoMediaPluginServiceChild::GetNodeId(const nsAString& aOrigin, const nsAString& aTopLevelOrigin, const nsAString& aGMPName, - bool aInPrivateBrowsing, UniquePtr&& aCallback) { MOZ_ASSERT(NS_GetCurrentThread() == mGMPThread); @@ -245,14 +244,12 @@ GeckoMediaPluginServiceChild::GetNodeId(const nsAString& aOrigin, nsString origin(aOrigin); nsString topLevelOrigin(aTopLevelOrigin); nsString gmpName(aGMPName); - bool pb = aInPrivateBrowsing; GetServiceChild()->Then(thread, __func__, - [rawCallback, origin, topLevelOrigin, gmpName, pb](GMPServiceChild* child) { + [rawCallback, origin, topLevelOrigin, gmpName](GMPServiceChild* child) { UniquePtr callback(rawCallback); nsCString outId; if (!child->SendGetGMPNodeId(origin, topLevelOrigin, - gmpName, - pb, &outId)) { + gmpName, &outId)) { callback->Done(NS_ERROR_FAILURE, EmptyCString()); return; } diff --git a/dom/media/gmp/GMPServiceChild.h b/dom/media/gmp/GMPServiceChild.h index 9b5eab9af734..19da05c0767d 100644 --- a/dom/media/gmp/GMPServiceChild.h +++ b/dom/media/gmp/GMPServiceChild.h @@ -32,7 +32,6 @@ public: NS_IMETHOD GetNodeId(const nsAString& aOrigin, const nsAString& aTopLevelOrigin, const nsAString& aGMPName, - bool aInPrivateBrowsingMode, UniquePtr&& aCallback) override; NS_DECL_NSIOBSERVER diff --git a/dom/media/gmp/GMPServiceParent.cpp b/dom/media/gmp/GMPServiceParent.cpp index 0fad677c4be0..dea4e36aa957 100644 --- a/dom/media/gmp/GMPServiceParent.cpp +++ b/dom/media/gmp/GMPServiceParent.cpp @@ -1388,14 +1388,12 @@ nsresult GeckoMediaPluginServiceParent::GetNodeId(const nsAString& aOrigin, const nsAString& aTopLevelOrigin, const nsAString& aGMPName, - bool aInPrivateBrowsing, nsACString& aOutId) { MOZ_ASSERT(NS_GetCurrentThread() == mGMPThread); - LOGD(("%s::%s: (%s, %s), %s", __CLASS__, __FUNCTION__, + LOGD(("%s::%s: (%s, %s)", __CLASS__, __FUNCTION__, NS_ConvertUTF16toUTF8(aOrigin).get(), - NS_ConvertUTF16toUTF8(aTopLevelOrigin).get(), - (aInPrivateBrowsing ? "PrivateBrowsing" : "NonPrivateBrowsing"))); + NS_ConvertUTF16toUTF8(aTopLevelOrigin).get())); nsresult rv; @@ -1421,7 +1419,7 @@ GeckoMediaPluginServiceParent::GetNodeId(const nsAString& aOrigin, const uint32_t hash = AddToHash(HashString(aOrigin), HashString(aTopLevelOrigin)); - if (aInPrivateBrowsing) { + if (OriginAttributes::IsPrivateBrowsing(NS_ConvertUTF16toUTF8(aOrigin))) { // For PB mode, we store the node id, indexed by the origin pair and GMP name, // so that if the same origin pair is opened for the same GMP in this session, // it gets the same node id. @@ -1551,11 +1549,10 @@ NS_IMETHODIMP GeckoMediaPluginServiceParent::GetNodeId(const nsAString& aOrigin, const nsAString& aTopLevelOrigin, const nsAString& aGMPName, - bool aInPrivateBrowsing, UniquePtr&& aCallback) { nsCString nodeId; - nsresult rv = GetNodeId(aOrigin, aTopLevelOrigin, aGMPName, aInPrivateBrowsing, nodeId); + nsresult rv = GetNodeId(aOrigin, aTopLevelOrigin, aGMPName, nodeId); aCallback->Done(rv, nodeId); return rv; } @@ -2010,11 +2007,9 @@ mozilla::ipc::IPCResult GMPServiceParent::RecvGetGMPNodeId(const nsString& aOrigin, const nsString& aTopLevelOrigin, const nsString& aGMPName, - const bool& aInPrivateBrowsing, nsCString* aID) { - nsresult rv = mService->GetNodeId(aOrigin, aTopLevelOrigin, aGMPName, - aInPrivateBrowsing, *aID); + nsresult rv = mService->GetNodeId(aOrigin, aTopLevelOrigin, aGMPName, *aID); if (!NS_SUCCEEDED(rv)) { return IPC_FAIL_NO_REASON(this); } diff --git a/dom/media/gmp/GMPServiceParent.h b/dom/media/gmp/GMPServiceParent.h index 5cb3cde1a276..a06792e636c1 100644 --- a/dom/media/gmp/GMPServiceParent.h +++ b/dom/media/gmp/GMPServiceParent.h @@ -44,7 +44,6 @@ public: NS_IMETHOD GetNodeId(const nsAString& aOrigin, const nsAString& aTopLevelOrigin, const nsAString& aGMPName, - bool aInPrivateBrowsingMode, UniquePtr&& aCallback) override; NS_DECL_MOZIGECKOMEDIAPLUGINCHROMESERVICE @@ -90,8 +89,7 @@ private: size_t* aOutPluginIndex); nsresult GetNodeId(const nsAString& aOrigin, const nsAString& aTopLevelOrigin, - const nsAString& aGMPName, - bool aInPrivateBrowsing, nsACString& aOutId); + const nsAString& aGMPName, nsACString& aOutId); void UnloadPlugins(); void CrashPlugins(); @@ -250,7 +248,6 @@ public: mozilla::ipc::IPCResult RecvGetGMPNodeId(const nsString& aOrigin, const nsString& aTopLevelOrigin, const nsString& aGMPName, - const bool& aInPrivateBrowsing, nsCString* aID) override; void ActorDestroy(ActorDestroyReason aWhy) override; diff --git a/dom/media/gmp/PGMPService.ipdl b/dom/media/gmp/PGMPService.ipdl index 413bf86d2f68..4bd01603a2b7 100644 --- a/dom/media/gmp/PGMPService.ipdl +++ b/dom/media/gmp/PGMPService.ipdl @@ -22,9 +22,7 @@ parent: ProcessId[] alreadyBridgedTo) returns (uint32_t pluginId, ProcessId id, nsCString displayName, nsresult aResult); - sync GetGMPNodeId(nsString origin, nsString topLevelOrigin, - nsString gmpName, - bool inPrivateBrowsing) + sync GetGMPNodeId(nsString origin, nsString topLevelOrigin, nsString gmpName) returns (nsCString id); }; diff --git a/dom/media/gmp/mozIGeckoMediaPluginService.idl b/dom/media/gmp/mozIGeckoMediaPluginService.idl index b9f1efc6944f..e625b5046934 100644 --- a/dom/media/gmp/mozIGeckoMediaPluginService.idl +++ b/dom/media/gmp/mozIGeckoMediaPluginService.idl @@ -161,12 +161,11 @@ interface mozIGeckoMediaPluginService : nsISupports in GetGMPDecryptorCallback callback); /** - * Gets the NodeId for a (origin, urlbarOrigin, isInprivateBrowsing) tuple. + * Gets the NodeId for a (origin, urlbarOrigin) pair. */ [noscript] void getNodeId(in AString origin, in AString topLevelOrigin, in AString gmpName, - in bool inPrivateBrowsingMode, in GetNodeIdCallback callback); }; diff --git a/dom/media/gtest/TestGMPCrossOrigin.cpp b/dom/media/gtest/TestGMPCrossOrigin.cpp index 0344b3d6fd04..ef3b9c13c630 100644 --- a/dom/media/gtest/TestGMPCrossOrigin.cpp +++ b/dom/media/gtest/TestGMPCrossOrigin.cpp @@ -473,12 +473,26 @@ GetNodeId(const nsAString& aOrigin, nsresult result; UniquePtr callback(new TestGetNodeIdCallback(nodeId, result)); + + PrincipalOriginAttributes attrs; + attrs.mPrivateBrowsingId = aInPBMode ? 1 : 0; + + nsAutoCString suffix; + attrs.CreateSuffix(suffix); + + nsAutoString origin; + origin.Assign(aOrigin); + origin.Append(NS_ConvertUTF8toUTF16(suffix)); + + nsAutoString topLevelOrigin; + topLevelOrigin.Assign(aTopLevelOrigin); + topLevelOrigin.Append(NS_ConvertUTF8toUTF16(suffix)); + // We rely on the fact that the GetNodeId implementation for // GeckoMediaPluginServiceParent is synchronous. - nsresult rv = service->GetNodeId(aOrigin, - aTopLevelOrigin, + nsresult rv = service->GetNodeId(origin, + topLevelOrigin, NS_LITERAL_STRING("gmp-fake"), - aInPBMode, Move(callback)); EXPECT_TRUE(NS_SUCCEEDED(rv) && NS_SUCCEEDED(result)); return nodeId; diff --git a/dom/media/systemservices/MediaChild.cpp b/dom/media/systemservices/MediaChild.cpp index 262dbcf5d1b3..c01e6249d2c3 100644 --- a/dom/media/systemservices/MediaChild.cpp +++ b/dom/media/systemservices/MediaChild.cpp @@ -20,7 +20,7 @@ namespace mozilla { namespace media { already_AddRefed> -GetOriginKey(const nsCString& aOrigin, bool aPrivateBrowsing, bool aPersist) +GetOriginKey(const nsCString& aOrigin, bool aPersist) { RefPtr mgr = MediaManager::GetInstance(); MOZ_ASSERT(mgr); @@ -29,10 +29,9 @@ GetOriginKey(const nsCString& aOrigin, bool aPrivateBrowsing, bool aPersist) uint32_t id = mgr->mGetOriginKeyPledges.Append(*p); if (XRE_GetProcessType() == GeckoProcessType_Default) { - mgr->GetNonE10sParent()->RecvGetOriginKey(id, aOrigin, aPrivateBrowsing, - aPersist); + mgr->GetNonE10sParent()->RecvGetOriginKey(id, aOrigin, aPersist); } else { - Child::Get()->SendGetOriginKey(id, aOrigin, aPrivateBrowsing, aPersist); + Child::Get()->SendGetOriginKey(id, aOrigin, aPersist); } return p.forget(); } diff --git a/dom/media/systemservices/MediaChild.h b/dom/media/systemservices/MediaChild.h index f44e1e42642e..3e7f9158e72c 100644 --- a/dom/media/systemservices/MediaChild.h +++ b/dom/media/systemservices/MediaChild.h @@ -25,7 +25,7 @@ namespace media { // (promise-like objects) with the future value. Use pledge.Then(func) to access. already_AddRefed> -GetOriginKey(const nsCString& aOrigin, bool aPrivateBrowsing, bool aPersist); +GetOriginKey(const nsCString& aOrigin, bool aPersist); void SanitizeOriginKeys(const uint64_t& aSinceWhen, bool aOnlyPrivateBrowsing); diff --git a/dom/media/systemservices/MediaParent.cpp b/dom/media/systemservices/MediaParent.cpp index 3d69ab18f9db..42aa33bd8ed9 100644 --- a/dom/media/systemservices/MediaParent.cpp +++ b/dom/media/systemservices/MediaParent.cpp @@ -369,7 +369,6 @@ bool NonE10s::SendGetOriginKeyResponse(const uint32_t& aRequestId, template mozilla::ipc::IPCResult Parent::RecvGetOriginKey(const uint32_t& aRequestId, const nsCString& aOrigin, - const bool& aPrivateBrowsing, const bool& aPersist) { MOZ_ASSERT(NS_IsMainThread()); @@ -395,11 +394,12 @@ Parent::RecvGetOriginKey(const uint32_t& aRequestId, RefPtr> that(this); rv = sts->Dispatch(NewRunnableFrom([this, that, id, profileDir, aOrigin, - aPrivateBrowsing, aPersist]() -> nsresult { + aPersist]() -> nsresult { MOZ_ASSERT(!NS_IsMainThread()); mOriginKeyStore->mOriginKeys.SetProfileDir(profileDir); - nsCString result; - if (aPrivateBrowsing) { + + nsAutoCString result; + if (OriginAttributes::IsPrivateBrowsing(aOrigin)) { mOriginKeyStore->mPrivateBrowsingOriginKeys.GetOriginKey(aOrigin, result); } else { mOriginKeyStore->mOriginKeys.GetOriginKey(aOrigin, result, aPersist); diff --git a/dom/media/systemservices/MediaParent.h b/dom/media/systemservices/MediaParent.h index cc127c0a10b1..aa242954f12d 100644 --- a/dom/media/systemservices/MediaParent.h +++ b/dom/media/systemservices/MediaParent.h @@ -29,7 +29,6 @@ public: protected: virtual mozilla::ipc::IPCResult RecvGetOriginKey(const uint32_t& aRequestId, const nsCString& aOrigin, - const bool& aPrivateBrowsing, const bool& aPersist) = 0; virtual mozilla::ipc::IPCResult RecvSanitizeOriginKeys(const uint64_t& aSinceWhen, const bool& aOnlyPrivateBrowsing) = 0; @@ -52,7 +51,6 @@ public: virtual mozilla::ipc::IPCResult RecvGetOriginKey(const uint32_t& aRequestId, const nsCString& aOrigin, - const bool& aPrivateBrowsing, const bool& aPersist) override; virtual mozilla::ipc::IPCResult RecvSanitizeOriginKeys(const uint64_t& aSinceWhen, const bool& aOnlyPrivateBrowsing) override; diff --git a/dom/media/systemservices/PMedia.ipdl b/dom/media/systemservices/PMedia.ipdl index c060f030eb40..23682d2a1297 100644 --- a/dom/media/systemservices/PMedia.ipdl +++ b/dom/media/systemservices/PMedia.ipdl @@ -18,18 +18,19 @@ parent: * This is needed by mediaDevices.enumerateDevices() to produce persistent * deviceIds that wont work cross-origin. * - * If aPrivateBrowsing is false, a key for this origin is returned from a - * primary pool of temporal in-memory keys and persistent keys read from disk. - * If no key exists, a temporal one is created. + * The origin string must contain the OriginAttributes suffix. + * If this OriginAttributes dictionary has the privateBrowsing flag set to + * false, a key for this origin is returned from a primary pool of temporal + * in-memory keys and persistent keys read from disk. If no key exists, a + * temporal one is created. * If aPersist is true and key is temporal, the key is promoted to persistent. * Once persistent, a key cannot become temporal again. * - * If aPrivateBrowsing is true, a different key for this origin is returned - * from a secondary pool that is never persisted to disk, and aPersist is - * ignored. + * If the OriginAttributes dictionary has the privateBrowsing flag set to + * true, a different key for this origin is returned from a secondary pool + * that is never persisted to disk, and aPersist is ignored. */ - async GetOriginKey(uint32_t aRequestId, nsCString aOrigin, bool aPrivateBrowsing, - bool aPersist); + async GetOriginKey(uint32_t aRequestId, nsCString aOrigin, bool aPersist); /** * Clear per-orgin list of persistent deviceIds stored for enumerateDevices diff --git a/dom/media/webrtc/MediaEngineTabVideoSource.cpp b/dom/media/webrtc/MediaEngineTabVideoSource.cpp index 7508ac839a62..4dbe0c0d45db 100644 --- a/dom/media/webrtc/MediaEngineTabVideoSource.cpp +++ b/dom/media/webrtc/MediaEngineTabVideoSource.cpp @@ -329,20 +329,22 @@ MediaEngineTabVideoSource::Draw() { RefPtr container = layers::LayerManager::CreateImageContainer(layers::ImageContainer::ASYNCHRONOUS); RefPtr dt = - Factory::CreateDrawTargetForData(BackendType::CAIRO, + Factory::CreateDrawTargetForData(gfxPlatform::GetPlatform()->GetSoftwareBackend(), mData.get(), size, stride, - SurfaceFormat::B8G8R8X8); + SurfaceFormat::B8G8R8X8, + true); if (!dt || !dt->IsValid()) { return; } - RefPtr context = gfxContext::CreateOrNull(dt); - MOZ_ASSERT(context); // already checked the draw target above - context->SetMatrix(context->CurrentMatrix().Scale((((float) size.width)/mViewportWidth), - (((float) size.height)/mViewportHeight))); if (mWindow) { + RefPtr context = gfxContext::CreateOrNull(dt); + MOZ_ASSERT(context); // already checked the draw target above + context->SetMatrix(context->CurrentMatrix().Scale((((float) size.width)/mViewportWidth), + (((float) size.height)/mViewportHeight))); + nscolor bgColor = NS_RGB(255, 255, 255); uint32_t renderDocFlags = mScrollWithPage? 0 : (nsIPresShell::RENDER_IGNORE_VIEWPORT_SCROLLING | @@ -352,6 +354,8 @@ MediaEngineTabVideoSource::Draw() { nsPresContext::CSSPixelsToAppUnits((float)mViewportWidth), nsPresContext::CSSPixelsToAppUnits((float)mViewportHeight)); NS_ENSURE_SUCCESS_VOID(presShell->RenderDocument(r, renderDocFlags, bgColor, context)); + } else { + dt->ClearRect(Rect(0, 0, size.width, size.height)); } RefPtr surface = dt->Snapshot(); diff --git a/dom/url/tests/mochitest.ini b/dom/url/tests/mochitest.ini index 370ef2c2ba9d..3c641ba96a53 100644 --- a/dom/url/tests/mochitest.ini +++ b/dom/url/tests/mochitest.ini @@ -18,3 +18,4 @@ support-files = [test_worker_url_exceptions.html] [test_worker_urlSearchParams.html] [test_unknown_url_origin.html] +[test_bloburl_location.html] diff --git a/dom/url/tests/test_bloburl_location.html b/dom/url/tests/test_bloburl_location.html new file mode 100644 index 000000000000..3d190e125d57 --- /dev/null +++ b/dom/url/tests/test_bloburl_location.html @@ -0,0 +1,31 @@ + + + + + Test for blobURL in location + + + + + + + diff --git a/dom/webidl/KeyframeEffect.webidl b/dom/webidl/KeyframeEffect.webidl index eaf42a3b166b..d9ec9fa7aaac 100644 --- a/dom/webidl/KeyframeEffect.webidl +++ b/dom/webidl/KeyframeEffect.webidl @@ -68,10 +68,11 @@ partial interface KeyframeEffectReadOnly { Constructor (KeyframeEffectReadOnly source)] interface KeyframeEffect : KeyframeEffectReadOnly { inherit attribute (Element or CSSPseudoElement)? target; + [NeedsCallerType] inherit attribute IterationCompositeOperation iterationComposite; // Bug 1216844 - implement additive animation // inherit attribute CompositeOperation composite; - [SetterThrows] + [SetterThrows, NeedsCallerType] inherit attribute DOMString spacing; [Throws] void setKeyframes (object? keyframes); diff --git a/embedding/components/windowwatcher/nsWindowWatcher.cpp b/embedding/components/windowwatcher/nsWindowWatcher.cpp index eac851b1b76a..f81afe0629e2 100644 --- a/embedding/components/windowwatcher/nsWindowWatcher.cpp +++ b/embedding/components/windowwatcher/nsWindowWatcher.cpp @@ -504,8 +504,7 @@ nsWindowWatcher::CreateChromeWindow(const nsACString& aFeatures, nsCOMPtr newWindowChrome; nsresult rv = windowCreator2->CreateChromeWindow2(aParentChrome, aChromeFlags, - 0 /* contextFlag */, aOpeningTabParent, - aOpener, &cancel, + aOpeningTabParent, aOpener, &cancel, getter_AddRefs(newWindowChrome)); if (NS_SUCCEEDED(rv) && cancel) { diff --git a/embedding/nsIWindowCreator2.idl b/embedding/nsIWindowCreator2.idl index ea581e83e93b..e41483b9de8f 100644 --- a/embedding/nsIWindowCreator2.idl +++ b/embedding/nsIWindowCreator2.idl @@ -26,10 +26,6 @@ interface mozIDOMWindowProxy; interface nsIWindowCreator2 : nsIWindowCreator { - /** - * Definitions for contextFlags - */ - /** Create a new window. Gecko will/may call this method, if made available to it, to create new windows. @param parent Parent window, if any. Null if not. The newly created @@ -37,7 +33,6 @@ interface nsIWindowCreator2 : nsIWindowCreator { the parent, if any (and if the concept applies to the underlying OS). @param chromeFlags Chrome features from nsIWebBrowserChrome - @param contextFlags Flags about the context of the window being created. @param aOpeningTab The TabParent that is trying to open this new chrome window. Can be nullptr. @param aOpener The window which is trying to open this new chrome window. @@ -50,7 +45,6 @@ interface nsIWindowCreator2 : nsIWindowCreator { */ nsIWebBrowserChrome createChromeWindow2(in nsIWebBrowserChrome parent, in uint32_t chromeFlags, - in uint32_t contextFlags, in nsITabParent aOpeningTab, in mozIDOMWindowProxy aOpener, out boolean cancel); diff --git a/ipc/ipdl/ipdl/lower.py b/ipc/ipdl/ipdl/lower.py index 876a98529b65..79ab41f21f8b 100644 --- a/ipc/ipdl/ipdl/lower.py +++ b/ipc/ipdl/ipdl/lower.py @@ -4150,12 +4150,15 @@ class _GenerateProtocolActorCode(ipdl.ast.Visitor): msgvar, stmts = self.makeMessage(md, errfnSendDtor, actorvar) sendok, sendstmts = self.sendAsync(md, msgvar, actorvar) + failif = StmtIf(ExprNot(sendok)) + failif.addifstmt(StmtReturn.FALSE) + method.addstmts( stmts + self.genVerifyMessage(md.decl.type.verify, md.params, errfnSendDtor, ExprVar('msg__')) + sendstmts - + [ Whitespace.NL ] + + [ failif, Whitespace.NL ] + self.dtorEpilogue(md, actor.var()) + [ StmtReturn(sendok) ]) diff --git a/js/src/ds/MemoryProtectionExceptionHandler.cpp b/js/src/ds/MemoryProtectionExceptionHandler.cpp index 52f4d66066dc..1f49cbf45a48 100644 --- a/js/src/ds/MemoryProtectionExceptionHandler.cpp +++ b/js/src/ds/MemoryProtectionExceptionHandler.cpp @@ -103,6 +103,9 @@ MemoryProtectionExceptionHandler::isDisabled() // faults it sees are fatal. Just disable this handler in that case, as the // crash annotations provided here are not critical for ASan builds. return true; +#elif defined(RELEASE_OR_BETA) + // Disable the exception handler for Beta and Release builds. + return true; #else return false; #endif diff --git a/js/src/ds/PageProtectingVector.h b/js/src/ds/PageProtectingVector.h index 980418f637e7..bf7665712abb 100644 --- a/js/src/ds/PageProtectingVector.h +++ b/js/src/ds/PageProtectingVector.h @@ -73,8 +73,10 @@ class PageProtectingVector final unprotectedBytes += offsetToPage; offsetToPage = (pageSize - (uintptr_t(vector.begin()) & pageMask)) & pageMask; unprotectedBytes -= offsetToPage; +#ifndef RELEASE_OR_BETA protectionEnabled = vector.capacity() >= protectionLowerBound && vector.capacity() >= pageSize + offsetToPage; +#endif } void protect() { diff --git a/js/src/gc/Nursery.cpp b/js/src/gc/Nursery.cpp index 6e60affb1cb1..e56c4ec4efcc 100644 --- a/js/src/gc/Nursery.cpp +++ b/js/src/gc/Nursery.cpp @@ -488,9 +488,13 @@ js::TenuringTracer::TenuringTracer(JSRuntime* rt, Nursery* nursery) { } -/* static */ void +void js::Nursery::printProfileHeader() { + if (!enableProfiling_) + return; + + fprintf(stderr, "MinorGC: Reason PRate Size "); #define PRINT_HEADER(name, text) \ fprintf(stderr, " %6s", text); FOR_EACH_NURSERY_PROFILE_TIME(PRINT_HEADER) @@ -630,11 +634,7 @@ js::Nursery::collect(JSRuntime* rt, JS::gcreason::Reason reason) TraceMinorGCEnd(); if (enableProfiling_ && totalTime >= profileThreshold_) { - static int printedHeader = 0; - if ((printedHeader++ % 200) == 0) { - fprintf(stderr, "MinorGC: Reason PRate Size "); - printProfileHeader(); - } + rt->gc.stats.maybePrintProfileHeaders(); fprintf(stderr, "MinorGC: %20s %5.1f%% %4u ", JS::gcreason::ExplainReason(reason), diff --git a/js/src/gc/Nursery.h b/js/src/gc/Nursery.h index 69fb66b7a407..bf91ad1556ee 100644 --- a/js/src/gc/Nursery.h +++ b/js/src/gc/Nursery.h @@ -257,6 +257,9 @@ class Nursery void leaveZealMode(); #endif + /* Print header line for profile times. */ + void printProfileHeader(); + /* Print total profile times on shutdown. */ void printTotalProfileTimes(); @@ -458,7 +461,6 @@ class Nursery void endProfile(ProfileKey key); void maybeStartProfile(ProfileKey key); void maybeEndProfile(ProfileKey key); - static void printProfileHeader(); static void printProfileTimes(const ProfileTimes& times); friend class TenuringTracer; diff --git a/js/src/gc/Statistics.cpp b/js/src/gc/Statistics.cpp index 19f9986dd2b3..219f3ab33c46 100644 --- a/js/src/gc/Statistics.cpp +++ b/js/src/gc/Statistics.cpp @@ -1326,9 +1326,23 @@ Statistics::computeMMU(int64_t window) const return double(window - gcMax) / window; } -/* static */ void +void +Statistics::maybePrintProfileHeaders() +{ + static int printedHeader = 0; + if ((printedHeader++ % 200) == 0) { + printProfileHeader(); + runtime->gc.nursery.printProfileHeader(); + } +} + +void Statistics::printProfileHeader() { + if (!enableProfiling_) + return; + + fprintf(stderr, "MajorGC: Reason States "); fprintf(stderr, " %6s", "total"); #define PRINT_PROFILE_HEADER(name, text, phase) \ fprintf(stderr, " %6s", text); @@ -1350,11 +1364,7 @@ Statistics::printSliceProfile() { const SliceData& slice = slices.back(); - static int printedHeader = 0; - if ((printedHeader++ % 200) == 0) { - fprintf(stderr, "MajorGC: Reason States "); - printProfileHeader(); - } + maybePrintProfileHeaders(); fprintf(stderr, "MajorGC: %20s %1d -> %1d ", ExplainReason(slice.reason), int(slice.initialState), int(slice.finalState)); diff --git a/js/src/gc/Statistics.h b/js/src/gc/Statistics.h index c9e5871e3b7d..b4673121c06e 100644 --- a/js/src/gc/Statistics.h +++ b/js/src/gc/Statistics.h @@ -141,17 +141,17 @@ struct ZoneGCStats }; #define FOR_EACH_GC_PROFILE_TIME(_) \ - _(BeginCallback, "beginCB", PHASE_GC_BEGIN) \ - _(WaitBgThread, "waitBG", PHASE_WAIT_BACKGROUND_THREAD) \ - _(DiscardCode, "discard", PHASE_MARK_DISCARD_CODE) \ - _(RelazifyFunc, "relazify", PHASE_RELAZIFY_FUNCTIONS) \ - _(PurgeTables, "purgeTables", PHASE_PURGE_SHAPE_TABLES) \ - _(Purge, "purge", PHASE_PURGE) \ - _(Mark, "mark", PHASE_MARK) \ - _(Sweep, "sweep", PHASE_SWEEP) \ - _(Compact, "compact", PHASE_COMPACT) \ - _(EndCallback, "endCB", PHASE_GC_END) \ - _(Barriers, "barriers", PHASE_BARRIER) + _(BeginCallback, "bgnCB", PHASE_GC_BEGIN) \ + _(WaitBgThread, "waitBG", PHASE_WAIT_BACKGROUND_THREAD) \ + _(DiscardCode, "discrd", PHASE_MARK_DISCARD_CODE) \ + _(RelazifyFunc, "relzfy", PHASE_RELAZIFY_FUNCTIONS) \ + _(PurgeTables, "prgTbl", PHASE_PURGE_SHAPE_TABLES) \ + _(Purge, "purge", PHASE_PURGE) \ + _(Mark, "mark", PHASE_MARK) \ + _(Sweep, "sweep", PHASE_SWEEP) \ + _(Compact, "cmpct", PHASE_COMPACT) \ + _(EndCallback, "endCB", PHASE_GC_END) \ + _(Barriers, "brrier", PHASE_BARRIER) const char* ExplainAbortReason(gc::AbortReason reason); const char* ExplainInvocationKind(JSGCInvocationKind gckind); @@ -313,6 +313,12 @@ struct Statistics SliceRange sliceRange() const { return slices.all(); } size_t slicesLength() const { return slices.length(); } + /* Occasionally print header lines for profiling information. */ + void maybePrintProfileHeaders(); + + /* Print header line for profile times. */ + void printProfileHeader(); + /* Print total profile times on shutdown. */ void printTotalProfileTimes(); @@ -429,7 +435,6 @@ FOR_EACH_GC_PROFILE_TIME(DEFINE_TIME_KEY) double computeMMU(int64_t resolution) const; void printSliceProfile(); - static void printProfileHeader(); static void printProfileTimes(const ProfileTimes& times); }; diff --git a/js/src/irregexp/RegExpParser.cpp b/js/src/irregexp/RegExpParser.cpp index 2568fc783a8f..fe2e61603f6b 100644 --- a/js/src/irregexp/RegExpParser.cpp +++ b/js/src/irregexp/RegExpParser.cpp @@ -1837,7 +1837,9 @@ ParsePattern(frontend::TokenStream& ts, LifoAlloc& alloc, const CharT* chars, si bool multiline, bool match_only, bool unicode, bool ignore_case, bool global, bool sticky, RegExpCompileData* data) { - if (match_only) { + // We shouldn't strip pattern for exec, or test with global/sticky, + // to reflect correct match position and lastIndex. + if (match_only && !global && !sticky) { // Try to strip a leading '.*' from the RegExp, but only if it is not // followed by a '?' (which will affect how the .* is parsed). This // pattern will affect the captures produced by the RegExp, but not @@ -1849,13 +1851,9 @@ ParsePattern(frontend::TokenStream& ts, LifoAlloc& alloc, const CharT* chars, si // Try to strip a trailing '.*' from the RegExp, which as above will // affect the captures but not whether there is a match. Only do this - // when the following conditions are met: - // 1. there are no other meta characters in the RegExp, so that we - // are sure this will not affect how the RegExp is parsed - // 2. global and sticky flags are not set, as lastIndex needs to be - // set properly on global or sticky match + // when there are no other meta characters in the RegExp, so that we + // are sure this will not affect how the RegExp is parsed. if (length >= 3 && !HasRegExpMetaChars(chars, length - 2) && - !global && !sticky && chars[length - 2] == '.' && chars[length - 1] == '*') { length -= 2; diff --git a/js/src/tests/ecma_6/RegExp/test-emptyMatch.js b/js/src/tests/ecma_6/RegExp/test-emptyMatch.js new file mode 100644 index 000000000000..6103c28d5219 --- /dev/null +++ b/js/src/tests/ecma_6/RegExp/test-emptyMatch.js @@ -0,0 +1,23 @@ +var BUGNUMBER = 1322035; +var summary = 'RegExp.prototype.test should update lastIndex to correct position even if pattern starts with .*'; + +print(BUGNUMBER + ": " + summary); + +var regExp = /.*x?/g; +regExp.test('12345'); +assertEq(regExp.lastIndex, 5); + +regExp = /.*x*/g; +regExp.test('12345'); +assertEq(regExp.lastIndex, 5); + +regExp = /.*()/g; +regExp.test('12345'); +assertEq(regExp.lastIndex, 5); + +regExp = /.*(x|)/g; +regExp.test('12345'); +assertEq(regExp.lastIndex, 5); + +if (typeof reportCompare === "function") + reportCompare(true, true); diff --git a/js/xpconnect/src/XPCWrappedJS.cpp b/js/xpconnect/src/XPCWrappedJS.cpp index 54eeff18538f..ebcfe65900c2 100644 --- a/js/xpconnect/src/XPCWrappedJS.cpp +++ b/js/xpconnect/src/XPCWrappedJS.cpp @@ -405,7 +405,9 @@ nsXPCWrappedJS::nsXPCWrappedJS(JSContext* cx, if (IsRootWrapper()) { MOZ_ASSERT(!IsMultiCompartment(), "mNext is always nullptr here"); - xpc::CompartmentPrivate::Get(mJSObj)->GetWrappedJSMap()->Add(cx, this); + if (!xpc::CompartmentPrivate::Get(mJSObj)->GetWrappedJSMap()->Add(cx, this)) { + *rv = NS_ERROR_OUT_OF_MEMORY; + } } else { NS_ADDREF(mRoot); mNext = mRoot->mNext; @@ -416,8 +418,10 @@ nsXPCWrappedJS::nsXPCWrappedJS(JSContext* cx, // to migrate the chain to the global table on the XPCJSContext. if (mRoot->IsMultiCompartment()) { xpc::CompartmentPrivate::Get(mRoot->mJSObj)->GetWrappedJSMap()->Remove(mRoot); - MOZ_RELEASE_ASSERT(nsXPConnect::GetContextInstance()-> - GetMultiCompartmentWrappedJSMap()->Add(cx, mRoot)); + auto destMap = nsXPConnect::GetContextInstance()->GetMultiCompartmentWrappedJSMap(); + if (!destMap->Add(cx, mRoot)) { + *rv = NS_ERROR_OUT_OF_MEMORY; + } } } } diff --git a/js/xpconnect/src/XPCWrappedJSClass.cpp b/js/xpconnect/src/XPCWrappedJSClass.cpp index 0cf82633c6c9..8f666137d817 100644 --- a/js/xpconnect/src/XPCWrappedJSClass.cpp +++ b/js/xpconnect/src/XPCWrappedJSClass.cpp @@ -554,7 +554,9 @@ nsXPCWrappedJSClass::DelegatedQueryInterface(nsXPCWrappedJS* self, nsresult rv = nsXPCWrappedJS::GetNewOrUsed(obj, aIID, getter_AddRefs(wrapper)); // Do the same thing we do for the "check for any existing wrapper" case above. - *aInstancePtr = wrapper.forget().take()->GetXPTCStub(); + if (NS_SUCCEEDED(rv) && wrapper) { + *aInstancePtr = wrapper.forget().take()->GetXPTCStub(); + } return rv; } diff --git a/layout/style/nsLayoutStylesheetCache.cpp b/layout/style/nsLayoutStylesheetCache.cpp index a2f3c823f46f..a65a7ec29bbc 100644 --- a/layout/style/nsLayoutStylesheetCache.cpp +++ b/layout/style/nsLayoutStylesheetCache.cpp @@ -14,6 +14,7 @@ #include "mozilla/StyleSheetInlines.h" #include "mozilla/css/Loader.h" #include "mozilla/dom/SRIMetadata.h" +#include "nsIConsoleService.h" #include "nsIFile.h" #include "nsNetUtil.h" #include "nsIObserverService.h" @@ -22,7 +23,7 @@ #include "nsPrintfCString.h" #include "nsXULAppAPI.h" -// Includes for the crash report annotation in ErrorLoadingBuiltinSheet. +// Includes for the crash report annotation in ErrorLoadingSheet. #ifdef MOZ_CRASHREPORTER #include "mozilla/Omnijar.h" #include "nsDirectoryService.h" @@ -75,7 +76,7 @@ nsLayoutStylesheetCache::ScrollbarsSheet() if (!mScrollbarsSheet) { // Scrollbars don't need access to unsafe rules LoadSheetURL("chrome://global/skin/scrollbars.css", - &mScrollbarsSheet, eAuthorSheetFeatures); + &mScrollbarsSheet, eAuthorSheetFeatures, eCrash); } return mScrollbarsSheet; @@ -87,7 +88,7 @@ nsLayoutStylesheetCache::FormsSheet() if (!mFormsSheet) { // forms.css needs access to unsafe rules LoadSheetURL("resource://gre-resources/forms.css", - &mFormsSheet, eAgentSheetFeatures); + &mFormsSheet, eAgentSheetFeatures, eCrash); } return mFormsSheet; @@ -102,7 +103,7 @@ nsLayoutStylesheetCache::NumberControlSheet() if (!mNumberControlSheet) { LoadSheetURL("resource://gre-resources/number-control.css", - &mNumberControlSheet, eAgentSheetFeatures); + &mNumberControlSheet, eAgentSheetFeatures, eCrash); } return mNumberControlSheet; @@ -125,7 +126,7 @@ nsLayoutStylesheetCache::UASheet() { if (!mUASheet) { LoadSheetURL("resource://gre-resources/ua.css", - &mUASheet, eAgentSheetFeatures); + &mUASheet, eAgentSheetFeatures, eCrash); } return mUASheet; @@ -166,7 +167,7 @@ nsLayoutStylesheetCache::MathMLSheet() { if (!mMathMLSheet) { LoadSheetURL("resource://gre-resources/mathml.css", - &mMathMLSheet, eAgentSheetFeatures); + &mMathMLSheet, eAgentSheetFeatures, eCrash); } return mMathMLSheet; @@ -183,7 +184,7 @@ nsLayoutStylesheetCache::NoScriptSheet() { if (!mNoScriptSheet) { LoadSheetURL("resource://gre-resources/noscript.css", - &mNoScriptSheet, eAgentSheetFeatures); + &mNoScriptSheet, eAgentSheetFeatures, eCrash); } return mNoScriptSheet; @@ -194,7 +195,7 @@ nsLayoutStylesheetCache::NoFramesSheet() { if (!mNoFramesSheet) { LoadSheetURL("resource://gre-resources/noframes.css", - &mNoFramesSheet, eAgentSheetFeatures); + &mNoFramesSheet, eAgentSheetFeatures, eCrash); } return mNoFramesSheet; @@ -225,7 +226,7 @@ nsLayoutStylesheetCache::ContentEditableSheet() { if (!mContentEditableSheet) { LoadSheetURL("resource://gre/res/contenteditable.css", - &mContentEditableSheet, eAgentSheetFeatures); + &mContentEditableSheet, eAgentSheetFeatures, eCrash); } return mContentEditableSheet; @@ -236,7 +237,7 @@ nsLayoutStylesheetCache::DesignModeSheet() { if (!mDesignModeSheet) { LoadSheetURL("resource://gre/res/designmode.css", - &mDesignModeSheet, eAgentSheetFeatures); + &mDesignModeSheet, eAgentSheetFeatures, eCrash); } return mDesignModeSheet; @@ -328,21 +329,21 @@ nsLayoutStylesheetCache::nsLayoutStylesheetCache(StyleBackendType aType) // And make sure that we load our UA sheets. No need to do this // per-profile, since they're profile-invariant. LoadSheetURL("resource://gre-resources/counterstyles.css", - &mCounterStylesSheet, eAgentSheetFeatures); + &mCounterStylesSheet, eAgentSheetFeatures, eCrash); LoadSheetURL("resource://gre-resources/html.css", - &mHTMLSheet, eAgentSheetFeatures); + &mHTMLSheet, eAgentSheetFeatures, eCrash); LoadSheetURL("chrome://global/content/minimal-xul.css", - &mMinimalXULSheet, eAgentSheetFeatures); + &mMinimalXULSheet, eAgentSheetFeatures, eCrash); LoadSheetURL("resource://gre-resources/quirk.css", - &mQuirkSheet, eAgentSheetFeatures); + &mQuirkSheet, eAgentSheetFeatures, eCrash); LoadSheetURL("resource://gre/res/svg.css", - &mSVGSheet, eAgentSheetFeatures); + &mSVGSheet, eAgentSheetFeatures, eCrash); LoadSheetURL("chrome://global/content/xul.css", - &mXULSheet, eAgentSheetFeatures); + &mXULSheet, eAgentSheetFeatures, eCrash); if (gUserContentSheetURL) { MOZ_ASSERT(XRE_IsContentProcess(), "Only used in content processes."); - LoadSheet(gUserContentSheetURL, &mUserContentSheet, eUserSheetFeatures); + LoadSheet(gUserContentSheetURL, &mUserContentSheet, eUserSheetFeatures, eLogToConsole); gUserContentSheetURL = nullptr; } @@ -422,18 +423,19 @@ nsLayoutStylesheetCache::InitFromProfile() contentFile->Append(NS_LITERAL_STRING("userContent.css")); chromeFile->Append(NS_LITERAL_STRING("userChrome.css")); - LoadSheetFile(contentFile, &mUserContentSheet, eUserSheetFeatures); - LoadSheetFile(chromeFile, &mUserChromeSheet, eUserSheetFeatures); + LoadSheetFile(contentFile, &mUserContentSheet, eUserSheetFeatures, eLogToConsole); + LoadSheetFile(chromeFile, &mUserChromeSheet, eUserSheetFeatures, eLogToConsole); } void nsLayoutStylesheetCache::LoadSheetURL(const char* aURL, RefPtr* aSheet, - SheetParsingMode aParsingMode) + SheetParsingMode aParsingMode, + FailureAction aFailureAction) { nsCOMPtr uri; NS_NewURI(getter_AddRefs(uri), aURL); - LoadSheet(uri, aSheet, aParsingMode); + LoadSheet(uri, aSheet, aParsingMode, aFailureAction); if (!aSheet) { NS_ERROR(nsPrintfCString("Could not load %s", aURL).get()); } @@ -442,7 +444,8 @@ nsLayoutStylesheetCache::LoadSheetURL(const char* aURL, void nsLayoutStylesheetCache::LoadSheetFile(nsIFile* aFile, RefPtr* aSheet, - SheetParsingMode aParsingMode) + SheetParsingMode aParsingMode, + FailureAction aFailureAction) { bool exists = false; aFile->Exists(&exists); @@ -452,7 +455,7 @@ nsLayoutStylesheetCache::LoadSheetFile(nsIFile* aFile, nsCOMPtr uri; NS_NewFileURI(getter_AddRefs(uri), aFile); - LoadSheet(uri, aSheet, aParsingMode); + LoadSheet(uri, aSheet, aParsingMode, aFailureAction); } #ifdef MOZ_CRASHREPORTER @@ -730,24 +733,33 @@ AnnotateCrashReport(nsIURI* aURI) #endif static void -ErrorLoadingBuiltinSheet(nsIURI* aURI, const char* aMsg) +ErrorLoadingSheet(nsIURI* aURI, const char* aMsg, FailureAction aFailureAction) { + nsPrintfCString errorMessage("%s loading built-in stylesheet '%s'", + aMsg, + aURI ? aURI->GetSpecOrDefault().get() : ""); + if (aFailureAction == eLogToConsole) { + nsCOMPtr cs = do_GetService(NS_CONSOLESERVICE_CONTRACTID); + if (cs) { + cs->LogStringMessage(NS_ConvertUTF8toUTF16(errorMessage).get()); + return; + } + } + #ifdef MOZ_CRASHREPORTER AnnotateCrashReport(aURI); #endif - - NS_RUNTIMEABORT( - nsPrintfCString("%s loading built-in stylesheet '%s'", - aMsg, aURI ? aURI->GetSpecOrDefault().get() : "").get()); + NS_RUNTIMEABORT(errorMessage.get()); } void nsLayoutStylesheetCache::LoadSheet(nsIURI* aURI, RefPtr* aSheet, - SheetParsingMode aParsingMode) + SheetParsingMode aParsingMode, + FailureAction aFailureAction) { if (!aURI) { - ErrorLoadingBuiltinSheet(aURI, "null URI"); + ErrorLoadingSheet(aURI, "null URI", eCrash); return; } @@ -758,7 +770,7 @@ nsLayoutStylesheetCache::LoadSheet(nsIURI* aURI, if (!loader) { loader = new mozilla::css::Loader(mBackendType); if (!loader) { - ErrorLoadingBuiltinSheet(aURI, "no Loader"); + ErrorLoadingSheet(aURI, "no Loader", eCrash); return; } } @@ -768,8 +780,9 @@ nsLayoutStylesheetCache::LoadSheet(nsIURI* aURI, #endif nsresult rv = loader->LoadSheetSync(aURI, aParsingMode, true, aSheet); if (NS_FAILED(rv)) { - ErrorLoadingBuiltinSheet(aURI, - nsPrintfCString("LoadSheetSync failed with error %x", rv).get()); + ErrorLoadingSheet(aURI, + nsPrintfCString("LoadSheetSync failed with error %x", rv).get(), + aFailureAction); } } diff --git a/layout/style/nsLayoutStylesheetCache.h b/layout/style/nsLayoutStylesheetCache.h index d462b664b85b..48391cc7a164 100644 --- a/layout/style/nsLayoutStylesheetCache.h +++ b/layout/style/nsLayoutStylesheetCache.h @@ -22,6 +22,18 @@ namespace mozilla { class CSSStyleSheet; } // namespace mozilla +namespace mozilla { +namespace css { + +// Enum defining how error should be handled. +enum FailureAction { + eCrash = 0, + eLogToConsole +}; + +} +} + class nsLayoutStylesheetCache final : public nsIObserver , public nsIMemoryReporter @@ -78,12 +90,15 @@ private: void InitMemoryReporter(); void LoadSheetURL(const char* aURL, RefPtr* aSheet, - mozilla::css::SheetParsingMode aParsingMode); + mozilla::css::SheetParsingMode aParsingMode, + mozilla::css::FailureAction aFailureAction); void LoadSheetFile(nsIFile* aFile, RefPtr* aSheet, - mozilla::css::SheetParsingMode aParsingMode); + mozilla::css::SheetParsingMode aParsingMode, + mozilla::css::FailureAction aFailureAction); void LoadSheet(nsIURI* aURI, RefPtr* aSheet, - mozilla::css::SheetParsingMode aParsingMode); + mozilla::css::SheetParsingMode aParsingMode, + mozilla::css::FailureAction aFailureAction); static void InvalidateSheet(RefPtr* aGeckoSheet, RefPtr* aServoSheet); static void DependentPrefChanged(const char* aPref, void* aData); diff --git a/taskcluster/ci/build/windows.yml b/taskcluster/ci/build/windows.yml index ab41ccacf0c0..f8396674c319 100644 --- a/taskcluster/ci/build/windows.yml +++ b/taskcluster/ci/build/windows.yml @@ -114,3 +114,78 @@ win64/pgo: config: - builds/taskcluster_firefox_windows_64_opt.py +win32-clang/debug: + description: "Win32 Clang-cl Debug" + index: + product: firefox + job-name: win32-clang-debug + treeherder: + platform: windows2012-32/debug + symbol: tc(Bcl) + tier: 2 + worker-type: aws-provisioner-v1/gecko-{level}-b-win2012 + worker: + implementation: generic-worker + max-run-time: 7200 + run: + using: mozharness + script: mozharness/scripts/fx_desktop_build.py + config: + - builds/taskcluster_firefox_win32_clang_debug.py + +win32-clang/opt: + description: "Win32 Clang-cl Opt" + index: + product: firefox + job-name: win32-clang-opt + treeherder: + platform: windows2012-32/opt + symbol: tc(Bcl) + tier: 2 + worker-type: aws-provisioner-v1/gecko-{level}-b-win2012 + worker: + implementation: generic-worker + max-run-time: 7200 + run: + using: mozharness + script: mozharness/scripts/fx_desktop_build.py + config: + - builds/taskcluster_firefox_win32_clang.py + +win64-clang/debug: + description: "Win64 Clang-cl Debug" + index: + product: firefox + job-name: win64-clang-debug + treeherder: + platform: windows2012-64/debug + symbol: tc(Bcl) + tier: 2 + worker-type: aws-provisioner-v1/gecko-{level}-b-win2012 + worker: + implementation: generic-worker + max-run-time: 7200 + run: + using: mozharness + script: mozharness/scripts/fx_desktop_build.py + config: + - builds/taskcluster_firefox_win64_clang_debug.py + +win64-clang/opt: + description: "Win64 Clang-cl Opt" + index: + product: firefox + job-name: win64-clang-opt + treeherder: + platform: windows2012-64/opt + symbol: tc(Bcl) + tier: 2 + worker-type: aws-provisioner-v1/gecko-{level}-b-win2012 + worker: + implementation: generic-worker + max-run-time: 7200 + run: + using: mozharness + script: mozharness/scripts/fx_desktop_build.py + config: + - builds/taskcluster_firefox_win64_clang.py diff --git a/taskcluster/taskgraph/transforms/gecko_v2_whitelist.py b/taskcluster/taskgraph/transforms/gecko_v2_whitelist.py index 60c2f7d141dc..3d4ba364d08c 100644 --- a/taskcluster/taskgraph/transforms/gecko_v2_whitelist.py +++ b/taskcluster/taskgraph/transforms/gecko_v2_whitelist.py @@ -63,9 +63,13 @@ JOB_NAME_WHITELIST = set([ 'sm-plain-opt', 'sm-rootanalysis-debug', 'sm-tsan-opt', + 'win32-clang-debug', + 'win32-clang-opt', 'win32-debug', 'win32-opt', 'win32-pgo', + 'win64-clang-debug', + 'win64-clang-opt', 'win64-debug', 'win64-opt', 'win64-pgo', diff --git a/testing/mozharness/configs/builds/taskcluster_firefox_win32_clang.py b/testing/mozharness/configs/builds/taskcluster_firefox_win32_clang.py new file mode 100644 index 000000000000..0256b84f63a5 --- /dev/null +++ b/testing/mozharness/configs/builds/taskcluster_firefox_win32_clang.py @@ -0,0 +1,93 @@ +import os +import sys + +config = { + ######################################################################### + ######## WINDOWS GENERIC CONFIG KEYS/VAlUES + # if you are updating this with custom 32 bit keys/values please add them + # below under the '32 bit specific' code block otherwise, update in this + # code block and also make sure this is synced between: + # - taskcluster_firefox_win32_debug + # - taskcluster_firefox_win32_opt + # - taskcluster_firefox_win64_debug + # - taskcluster_firefox_win64_opt + # - taskcluster_firefox_win32_clang + # - taskcluster_firefox_win32_clang_debug + # - taskcluster_firefox_win64_clang + # - taskcluster_firefox_win64_clang_debug + + 'default_actions': [ + 'clone-tools', + 'build', + 'check-test', + ], + 'exes': { + 'python2.7': sys.executable, + 'make': [ + sys.executable, + os.path.join( + os.getcwd(), 'build', 'src', 'build', 'pymake', 'make.py' + ) + ], + 'virtualenv': [ + sys.executable, + os.path.join( + os.getcwd(), 'build', 'src', 'python', 'virtualenv', 'virtualenv.py' + ) + ], + 'mach-build': [ + os.path.join(os.environ['MOZILLABUILD'], 'msys', 'bin', 'bash.exe'), + os.path.join(os.getcwd(), 'build', 'src', 'mach'), + '--log-no-times', 'build', '-v' + ], + }, + 'app_ini_path': '%(obj_dir)s/dist/bin/application.ini', + # decides whether we want to use moz_sign_cmd in env + 'enable_signing': True, + 'enable_ccache': False, + 'vcs_share_base': os.path.join('y:', os.sep, 'hg-shared'), + 'objdir': 'obj-firefox', + 'tooltool_script': [ + sys.executable, + os.path.join(os.environ['MOZILLABUILD'], 'tooltool.py') + ], + 'tooltool_bootstrap': 'setup.sh', + 'enable_count_ctors': False, + 'max_build_output_timeout': 60 * 80, + ######################################################################### + + + ######################################################################### + ###### 32 bit specific ###### + 'base_name': 'WINNT_5.2_%(branch)s', + 'platform': 'win32', + 'stage_platform': 'win32', + 'publish_nightly_en_US_routes': True, + 'env': { + 'BINSCOPE': os.path.join( + os.environ['ProgramFiles(x86)'], 'Microsoft', 'SDL BinScope', 'BinScope.exe' + ), + 'HG_SHARE_BASE_DIR': os.path.join('y:', os.sep, 'hg-shared'), + 'MOZBUILD_STATE_PATH': os.path.join(os.getcwd(), '.mozbuild'), + 'MOZ_AUTOMATION': '1', + 'MOZ_CRASHREPORTER_NO_REPORT': '1', + 'MOZ_OBJDIR': 'obj-firefox', + 'PDBSTR_PATH': '/c/Program Files (x86)/Windows Kits/10/Debuggers/x86/srcsrv/pdbstr.exe', + 'TINDERBOX_OUTPUT': '1', + 'TOOLTOOL_CACHE': '/c/builds/tooltool_cache', + 'TOOLTOOL_HOME': '/c/builds', + 'MSYSTEM': 'MINGW32', + }, + 'upload_env': { + 'UPLOAD_HOST': 'localhost', + 'UPLOAD_PATH': os.path.join(os.getcwd(), 'public', 'build'), + }, + "check_test_env": { + 'MINIDUMP_STACKWALK': '%(abs_tools_dir)s\\breakpad\\win32\\minidump_stackwalk.exe', + 'MINIDUMP_SAVE_PATH': '%(base_work_dir)s\\minidumps', + }, + 'enable_pymake': True, + 'src_mozconfig': 'browser\\config\\mozconfigs\\win32\\clang', + 'tooltool_manifest_src': 'browser\\config\\tooltool-manifests\\win32\\clang.manifest', + ######################################################################### +} diff --git a/testing/mozharness/configs/builds/taskcluster_firefox_win32_clang_debug.py b/testing/mozharness/configs/builds/taskcluster_firefox_win32_clang_debug.py new file mode 100644 index 000000000000..ad9168bf658f --- /dev/null +++ b/testing/mozharness/configs/builds/taskcluster_firefox_win32_clang_debug.py @@ -0,0 +1,95 @@ +import os +import sys + +config = { + ######################################################################### + ######## WINDOWS GENERIC CONFIG KEYS/VAlUES + # if you are updating this with custom 32 bit keys/values please add them + # below under the '32 bit specific' code block otherwise, update in this + # code block and also make sure this is synced between: + # - taskcluster_firefox_win32_debug + # - taskcluster_firefox_win32_opt + # - taskcluster_firefox_win64_debug + # - taskcluster_firefox_win64_opt + # - taskcluster_firefox_win32_clang + # - taskcluster_firefox_win32_clang_debug + # - taskcluster_firefox_win64_clang + # - taskcluster_firefox_win64_clang_debug + + 'default_actions': [ + 'clone-tools', + 'build', + 'check-test', + ], + 'exes': { + 'python2.7': sys.executable, + 'make': [ + sys.executable, + os.path.join( + os.getcwd(), 'build', 'src', 'build', 'pymake', 'make.py' + ) + ], + 'virtualenv': [ + sys.executable, + os.path.join( + os.getcwd(), 'build', 'src', 'python', 'virtualenv', 'virtualenv.py' + ) + ], + 'mach-build': [ + os.path.join(os.environ['MOZILLABUILD'], 'msys', 'bin', 'bash.exe'), + os.path.join(os.getcwd(), 'build', 'src', 'mach'), + '--log-no-times', 'build', '-v' + ], + }, + 'app_ini_path': '%(obj_dir)s/dist/bin/application.ini', + # decides whether we want to use moz_sign_cmd in env + 'enable_signing': True, + 'enable_ccache': False, + 'vcs_share_base': os.path.join('y:', os.sep, 'hg-shared'), + 'objdir': 'obj-firefox', + 'tooltool_script': [ + sys.executable, + os.path.join(os.environ['MOZILLABUILD'], 'tooltool.py') + ], + 'tooltool_bootstrap': 'setup.sh', + 'enable_count_ctors': False, + 'max_build_output_timeout': 60 * 80, + ######################################################################### + + + ######################################################################### + ###### 32 bit specific ###### + 'base_name': 'WINNT_5.2_%(branch)s', + 'platform': 'win32', + 'stage_platform': 'win32-debug', + 'debug_build': True, + 'publish_nightly_en_US_routes': True, + 'env': { + 'BINSCOPE': os.path.join( + os.environ['ProgramFiles(x86)'], 'Microsoft', 'SDL BinScope', 'BinScope.exe' + ), + 'HG_SHARE_BASE_DIR': os.path.join('y:', os.sep, 'hg-shared'), + 'MOZBUILD_STATE_PATH': os.path.join(os.getcwd(), '.mozbuild'), + 'MOZ_AUTOMATION': '1', + 'MOZ_CRASHREPORTER_NO_REPORT': '1', + 'MOZ_OBJDIR': 'obj-firefox', + 'PDBSTR_PATH': '/c/Program Files (x86)/Windows Kits/10/Debuggers/x86/srcsrv/pdbstr.exe', + 'TINDERBOX_OUTPUT': '1', + 'TOOLTOOL_CACHE': '/c/builds/tooltool_cache', + 'TOOLTOOL_HOME': '/c/builds', + 'XPCOM_DEBUG_BREAK': 'stack-and-abort', + 'MSYSTEM': 'MINGW32', + }, + 'upload_env': { + 'UPLOAD_HOST': 'localhost', + 'UPLOAD_PATH': os.path.join(os.getcwd(), 'public', 'build'), + }, + "check_test_env": { + 'MINIDUMP_STACKWALK': '%(abs_tools_dir)s\\breakpad\\win32\\minidump_stackwalk.exe', + 'MINIDUMP_SAVE_PATH': '%(base_work_dir)s\\minidumps', + }, + 'enable_pymake': True, + 'src_mozconfig': 'browser\\config\\mozconfigs\\win32\\clang-debug', + 'tooltool_manifest_src': 'browser\\config\\tooltool-manifests\\win32\\clang.manifest', + ######################################################################### +} diff --git a/testing/mozharness/configs/builds/taskcluster_firefox_win64_clang.py b/testing/mozharness/configs/builds/taskcluster_firefox_win64_clang.py new file mode 100644 index 000000000000..691d5a721af9 --- /dev/null +++ b/testing/mozharness/configs/builds/taskcluster_firefox_win64_clang.py @@ -0,0 +1,89 @@ +import os +import sys + +config = { + ######################################################################### + ######## WINDOWS GENERIC CONFIG KEYS/VAlUES + # if you are updating this with custom 64 bit keys/values please add them + # below under the '64 bit specific' code block otherwise, update in this + # code block and also make sure this is synced between: + # - taskcluster_firefox_win32_debug + # - taskcluster_firefox_win32_opt + # - taskcluster_firefox_win64_debug + # - taskcluster_firefox_win64_opt + # - taskcluster_firefox_win32_clang + # - taskcluster_firefox_win32_clang_debug + # - taskcluster_firefox_win64_clang + # - taskcluster_firefox_win64_clang_debug + + 'default_actions': [ + 'clone-tools', + 'build', + 'check-test', + ], + 'exes': { + 'python2.7': sys.executable, + 'make': [ + sys.executable, + os.path.join( + os.getcwd(), 'build', 'src', 'build', 'pymake', 'make.py' + ) + ], + 'virtualenv': [ + sys.executable, + os.path.join( + os.getcwd(), 'build', 'src', 'python', 'virtualenv', 'virtualenv.py' + ) + ], + 'mach-build': [ + os.path.join(os.environ['MOZILLABUILD'], 'msys', 'bin', 'bash.exe'), + os.path.join(os.getcwd(), 'build', 'src', 'mach'), + '--log-no-times', 'build', '-v' + ], + }, + 'app_ini_path': '%(obj_dir)s/dist/bin/application.ini', + # decides whether we want to use moz_sign_cmd in env + 'enable_signing': True, + 'enable_ccache': False, + 'vcs_share_base': os.path.join('y:', os.sep, 'hg-shared'), + 'objdir': 'obj-firefox', + 'tooltool_script': [ + sys.executable, + os.path.join(os.environ['MOZILLABUILD'], 'tooltool.py') + ], + 'tooltool_bootstrap': 'setup.sh', + 'enable_count_ctors': False, + 'max_build_output_timeout': 60 * 80, + ######################################################################### + + + ######################################################################### + ###### 64 bit specific ###### + 'base_name': 'WINNT_6.1_x86-64_%(branch)s', + 'platform': 'win64', + 'stage_platform': 'win64', + 'publish_nightly_en_US_routes': True, + 'env': { + 'HG_SHARE_BASE_DIR': os.path.join('y:', os.sep, 'hg-shared'), + 'MOZ_AUTOMATION': '1', + 'MOZ_CRASHREPORTER_NO_REPORT': '1', + 'MOZ_OBJDIR': 'obj-firefox', + 'PDBSTR_PATH': '/c/Program Files (x86)/Windows Kits/10/Debuggers/x64/srcsrv/pdbstr.exe', + 'TINDERBOX_OUTPUT': '1', + 'TOOLTOOL_CACHE': '/c/builds/tooltool_cache', + 'TOOLTOOL_HOME': '/c/builds', + 'MSYSTEM': 'MINGW32', + }, + 'upload_env': { + 'UPLOAD_HOST': 'localhost', + 'UPLOAD_PATH': os.path.join(os.getcwd(), 'public', 'build'), + }, + "check_test_env": { + 'MINIDUMP_STACKWALK': '%(abs_tools_dir)s\\breakpad\\win64\\minidump_stackwalk.exe', + 'MINIDUMP_SAVE_PATH': '%(base_work_dir)s\\minidumps', + }, + 'enable_pymake': True, + 'src_mozconfig': 'browser\\config\\mozconfigs\\win64\\clang', + 'tooltool_manifest_src': 'browser\\config\\tooltool-manifests\\win64\\clang.manifest', + ######################################################################### +} diff --git a/testing/mozharness/configs/builds/taskcluster_firefox_win64_clang_debug.py b/testing/mozharness/configs/builds/taskcluster_firefox_win64_clang_debug.py new file mode 100644 index 000000000000..23d5471abd27 --- /dev/null +++ b/testing/mozharness/configs/builds/taskcluster_firefox_win64_clang_debug.py @@ -0,0 +1,91 @@ +import os +import sys + +config = { + ######################################################################### + ######## WINDOWS GENERIC CONFIG KEYS/VAlUES + # if you are updating this with custom 64 bit keys/values please add them + # below under the '64 bit specific' code block otherwise, update in this + # code block and also make sure this is synced between: + # - taskcluster_firefox_win32_debug + # - taskcluster_firefox_win32_opt + # - taskcluster_firefox_win64_debug + # - taskcluster_firefox_win64_opt + # - taskcluster_firefox_win32_clang + # - taskcluster_firefox_win32_clang_debug + # - taskcluster_firefox_win64_clang + # - taskcluster_firefox_win64_clang_debug + + 'default_actions': [ + 'clone-tools', + 'build', + 'check-test', + ], + 'exes': { + 'python2.7': sys.executable, + 'make': [ + sys.executable, + os.path.join( + os.getcwd(), 'build', 'src', 'build', 'pymake', 'make.py' + ) + ], + 'virtualenv': [ + sys.executable, + os.path.join( + os.getcwd(), 'build', 'src', 'python', 'virtualenv', 'virtualenv.py' + ) + ], + 'mach-build': [ + os.path.join(os.environ['MOZILLABUILD'], 'msys', 'bin', 'bash.exe'), + os.path.join(os.getcwd(), 'build', 'src', 'mach'), + '--log-no-times', 'build', '-v' + ], + }, + 'app_ini_path': '%(obj_dir)s/dist/bin/application.ini', + # decides whether we want to use moz_sign_cmd in env + 'enable_signing': True, + 'enable_ccache': False, + 'vcs_share_base': os.path.join('y:', os.sep, 'hg-shared'), + 'objdir': 'obj-firefox', + 'tooltool_script': [ + sys.executable, + os.path.join(os.environ['MOZILLABUILD'], 'tooltool.py') + ], + 'tooltool_bootstrap': 'setup.sh', + 'enable_count_ctors': False, + 'max_build_output_timeout': 60 * 80, + ######################################################################### + + + ######################################################################### + ###### 64 bit specific ###### + 'base_name': 'WINNT_6.1_x86-64_%(branch)s', + 'platform': 'win64', + 'stage_platform': 'win64-debug', + 'debug_build': True, + 'publish_nightly_en_US_routes': True, + 'env': { + 'HG_SHARE_BASE_DIR': os.path.join('y:', os.sep, 'hg-shared'), + 'MOZ_AUTOMATION': '1', + 'MOZ_CRASHREPORTER_NO_REPORT': '1', + 'MOZ_OBJDIR': 'obj-firefox', + 'PDBSTR_PATH': '/c/Program Files (x86)/Windows Kits/10/Debuggers/x64/srcsrv/pdbstr.exe', + 'TINDERBOX_OUTPUT': '1', + 'TOOLTOOL_CACHE': '/c/builds/tooltool_cache', + 'TOOLTOOL_HOME': '/c/builds', + 'XPCOM_DEBUG_BREAK': 'stack-and-abort', + 'MSYSTEM': 'MINGW32', + }, + 'upload_env': { + 'UPLOAD_HOST': 'localhost', + 'UPLOAD_PATH': os.path.join(os.getcwd(), 'public', 'build'), + }, + "check_test_env": { + 'MINIDUMP_STACKWALK': '%(abs_tools_dir)s\\breakpad\\win64\\minidump_stackwalk.exe', + 'MINIDUMP_SAVE_PATH': '%(base_work_dir)s\\minidumps', + }, + 'enable_pymake': True, + 'src_mozconfig': 'browser\\config\\mozconfigs\\win64\\clang-debug', + 'tooltool_manifest_src': 'browser\\config\\tooltool-manifests\\win64\\clang.manifest', + ######################################################################### +} diff --git a/testing/mozharness/configs/builds/taskcluster_firefox_windows_32_debug.py b/testing/mozharness/configs/builds/taskcluster_firefox_windows_32_debug.py index ac4cd26ec6f3..29b0affb3656 100644 --- a/testing/mozharness/configs/builds/taskcluster_firefox_windows_32_debug.py +++ b/testing/mozharness/configs/builds/taskcluster_firefox_windows_32_debug.py @@ -11,6 +11,10 @@ config = { # - taskcluster_firefox_win32_opt # - taskcluster_firefox_win64_debug # - taskcluster_firefox_win64_opt + # - taskcluster_firefox_win32_clang + # - taskcluster_firefox_win32_clang_debug + # - taskcluster_firefox_win64_clang + # - taskcluster_firefox_win64_clang_debug 'default_actions': [ 'clone-tools', diff --git a/testing/mozharness/configs/builds/taskcluster_firefox_windows_32_opt.py b/testing/mozharness/configs/builds/taskcluster_firefox_windows_32_opt.py index e5fc23386683..c7b4f0cf2a64 100644 --- a/testing/mozharness/configs/builds/taskcluster_firefox_windows_32_opt.py +++ b/testing/mozharness/configs/builds/taskcluster_firefox_windows_32_opt.py @@ -11,6 +11,10 @@ config = { # - taskcluster_firefox_win32_opt # - taskcluster_firefox_win64_debug # - taskcluster_firefox_win64_opt + # - taskcluster_firefox_win32_clang + # - taskcluster_firefox_win32_clang_debug + # - taskcluster_firefox_win64_clang + # - taskcluster_firefox_win64_clang_debug 'default_actions': [ 'clone-tools', diff --git a/testing/mozharness/configs/builds/taskcluster_firefox_windows_64_debug.py b/testing/mozharness/configs/builds/taskcluster_firefox_windows_64_debug.py index 548423b1b73a..c3e2f4e61a51 100644 --- a/testing/mozharness/configs/builds/taskcluster_firefox_windows_64_debug.py +++ b/testing/mozharness/configs/builds/taskcluster_firefox_windows_64_debug.py @@ -11,6 +11,10 @@ config = { # - taskcluster_firefox_win32_opt # - taskcluster_firefox_win64_debug # - taskcluster_firefox_win64_opt + # - taskcluster_firefox_win32_clang + # - taskcluster_firefox_win32_clang_debug + # - taskcluster_firefox_win64_clang + # - taskcluster_firefox_win64_clang_debug 'default_actions': [ 'clone-tools', diff --git a/testing/mozharness/configs/builds/taskcluster_firefox_windows_64_opt.py b/testing/mozharness/configs/builds/taskcluster_firefox_windows_64_opt.py index bd27eef794b6..af7575e3c666 100644 --- a/testing/mozharness/configs/builds/taskcluster_firefox_windows_64_opt.py +++ b/testing/mozharness/configs/builds/taskcluster_firefox_windows_64_opt.py @@ -11,6 +11,10 @@ config = { # - taskcluster_firefox_win32_opt # - taskcluster_firefox_win64_debug # - taskcluster_firefox_win64_opt + # - taskcluster_firefox_win32_clang + # - taskcluster_firefox_win32_clang_debug + # - taskcluster_firefox_win64_clang + # - taskcluster_firefox_win64_clang_debug 'default_actions': [ 'clone-tools', diff --git a/toolkit/components/contextualidentity/ContextualIdentityService.jsm b/toolkit/components/contextualidentity/ContextualIdentityService.jsm index e336eb2d7a8d..e53944acb243 100644 --- a/toolkit/components/contextualidentity/ContextualIdentityService.jsm +++ b/toolkit/components/contextualidentity/ContextualIdentityService.jsm @@ -193,6 +193,8 @@ _ContextualIdentityService.prototype = { identity.icon = icon; delete identity.l10nID; delete identity.accessKey; + + Services.obs.notifyObservers(null, "contextual-identity-updated", userContextId); this.saveSoon(); } diff --git a/toolkit/components/startup/nsAppStartup.cpp b/toolkit/components/startup/nsAppStartup.cpp index 85d5afdf97c8..fcaf578a0856 100644 --- a/toolkit/components/startup/nsAppStartup.cpp +++ b/toolkit/components/startup/nsAppStartup.cpp @@ -611,7 +611,7 @@ nsAppStartup::CreateChromeWindow(nsIWebBrowserChrome *aParent, nsIWebBrowserChrome **_retval) { bool cancel; - return CreateChromeWindow2(aParent, aChromeFlags, 0, nullptr, nullptr, &cancel, _retval); + return CreateChromeWindow2(aParent, aChromeFlags, nullptr, nullptr, &cancel, _retval); } @@ -633,7 +633,6 @@ nsAppStartup::SetScreenId(uint32_t aScreenId) NS_IMETHODIMP nsAppStartup::CreateChromeWindow2(nsIWebBrowserChrome *aParent, uint32_t aChromeFlags, - uint32_t aContextFlags, nsITabParent *aOpeningTab, mozIDOMWindowProxy* aOpener, bool *aCancel, @@ -678,7 +677,6 @@ nsAppStartup::CreateChromeWindow2(nsIWebBrowserChrome *aParent, // if anybody gave us anything to work with, use it if (newWindow) { - newWindow->SetContextFlags(aContextFlags); nsCOMPtr thing(do_QueryInterface(newWindow)); if (thing) CallGetInterface(thing.get(), _retval); diff --git a/toolkit/components/telemetry/Histograms.json b/toolkit/components/telemetry/Histograms.json index 362ef207eed0..85fb16486549 100644 --- a/toolkit/components/telemetry/Histograms.json +++ b/toolkit/components/telemetry/Histograms.json @@ -1719,7 +1719,7 @@ "description": "Whether the URL gets redirected? (0=200, 1=301, 2=302, 3=304, 4=307, 5=308, 6=400, 7=401, 8=403, 9=404, 10=500, 11=other)" }, "HTTP_NET_VS_CACHE_ONSTART_ISIMG": { - "expires_in_version": "never", + "expires_in_version": "58", "alert_emails": ["necko@mozilla.com"], "bug_numbers": [1313095], "kind": "linear", @@ -1728,7 +1728,7 @@ "description": "Network vs cache time load (OnStartRequest) difference (ms) for images. Offset by 500 ms." }, "HTTP_NET_VS_CACHE_ONSTART_NOTIMG": { - "expires_in_version": "never", + "expires_in_version": "58", "alert_emails": ["necko@mozilla.com"], "bug_numbers": [1313095], "kind": "linear", @@ -1737,7 +1737,7 @@ "description": "Network vs cache time load (OnStartRequest) difference (ms) for non-images. Offset by 500 ms." }, "HTTP_NET_VS_CACHE_ONSTOP_ISIMG": { - "expires_in_version": "never", + "expires_in_version": "58", "alert_emails": ["necko@mozilla.com"], "bug_numbers": [1313095], "kind": "linear", @@ -1746,7 +1746,7 @@ "description": "Network vs cache time load (OnStopRequest) difference (ms) for images. Offset by 500 ms." }, "HTTP_NET_VS_CACHE_ONSTOP_NOTIMG": { - "expires_in_version": "never", + "expires_in_version": "58", "alert_emails": ["necko@mozilla.com"], "bug_numbers": [1313095], "kind": "linear", @@ -1755,7 +1755,7 @@ "description": "Network vs cache time load (OnStopRequest) difference (ms) for non-images. Offset by 500 ms." }, "HTTP_NET_VS_CACHE_ONSTART_QSMALL_NORMALPRI": { - "expires_in_version": "never", + "expires_in_version": "58", "alert_emails": ["necko@mozilla.com"], "bug_numbers": [1313095], "kind": "linear", @@ -1764,7 +1764,7 @@ "description": "Network vs cache time load (OnStartRequest) difference (ms) for requests with a normal priority and small queue. Offset by 500 ms." }, "HTTP_NET_VS_CACHE_ONSTART_QMED_NORMALPRI": { - "expires_in_version": "never", + "expires_in_version": "58", "alert_emails": ["necko@mozilla.com"], "bug_numbers": [1313095], "kind": "linear", @@ -1773,7 +1773,7 @@ "description": "Network vs cache time load (OnStartRequest) difference (ms) for requests with a normal priority and medium queue. Offset by 500 ms." }, "HTTP_NET_VS_CACHE_ONSTART_QBIG_NORMALPRI": { - "expires_in_version": "never", + "expires_in_version": "58", "alert_emails": ["necko@mozilla.com"], "bug_numbers": [1313095], "kind": "linear", @@ -1782,7 +1782,7 @@ "description": "Network vs cache time load (OnStartRequest) difference (ms) for requests with a normal priority and large queue. Offset by 500 ms." }, "HTTP_NET_VS_CACHE_ONSTART_QSMALL_HIGHPRI": { - "expires_in_version": "never", + "expires_in_version": "58", "alert_emails": ["necko@mozilla.com"], "bug_numbers": [1313095], "kind": "linear", @@ -1791,7 +1791,7 @@ "description": "Network vs cache time load (OnStartRequest) difference (ms) for requests with a high priority and small queue. Offset by 500 ms." }, "HTTP_NET_VS_CACHE_ONSTART_QMED_HIGHPRI": { - "expires_in_version": "never", + "expires_in_version": "58", "alert_emails": ["necko@mozilla.com"], "bug_numbers": [1313095], "kind": "linear", @@ -1800,7 +1800,7 @@ "description": "Network vs cache time load (OnStartRequest) difference (ms) for requests with a high priority and medium queue. Offset by 500 ms." }, "HTTP_NET_VS_CACHE_ONSTART_QBIG_HIGHPRI": { - "expires_in_version": "never", + "expires_in_version": "58", "alert_emails": ["necko@mozilla.com"], "bug_numbers": [1313095], "kind": "linear", @@ -1809,7 +1809,7 @@ "description": "Network vs cache time load (OnStartRequest) difference (ms) for requests with a high priority and large queue. Offset by 500 ms." }, "HTTP_NET_VS_CACHE_ONSTOP_QSMALL_NORMALPRI": { - "expires_in_version": "never", + "expires_in_version": "58", "alert_emails": ["necko@mozilla.com"], "bug_numbers": [1313095], "kind": "linear", @@ -1818,7 +1818,7 @@ "description": "Network vs cache time load (OnStopRequest) difference (ms) for requests with a normal priority and small queue. Offset by 500 ms." }, "HTTP_NET_VS_CACHE_ONSTOP_QMED_NORMALPRI": { - "expires_in_version": "never", + "expires_in_version": "58", "alert_emails": ["necko@mozilla.com"], "bug_numbers": [1313095], "kind": "linear", @@ -1827,7 +1827,7 @@ "description": "Network vs cache time load (OnStopRequest) difference (ms) for requests with a normal priority and medium queue. Offset by 500 ms." }, "HTTP_NET_VS_CACHE_ONSTOP_QBIG_NORMALPRI": { - "expires_in_version": "never", + "expires_in_version": "58", "alert_emails": ["necko@mozilla.com"], "bug_numbers": [1313095], "kind": "linear", @@ -1836,7 +1836,7 @@ "description": "Network vs cache time load (OnStopRequest) difference (ms) for requests with a normal priority and large queue. Offset by 500 ms." }, "HTTP_NET_VS_CACHE_ONSTOP_QSMALL_HIGHPRI": { - "expires_in_version": "never", + "expires_in_version": "58", "alert_emails": ["necko@mozilla.com"], "bug_numbers": [1313095], "kind": "linear", @@ -1845,7 +1845,7 @@ "description": "Network vs cache time load (OnStopRequest) difference (ms) for requests with a high priority and small queue. Offset by 500 ms." }, "HTTP_NET_VS_CACHE_ONSTOP_QMED_HIGHPRI": { - "expires_in_version": "never", + "expires_in_version": "58", "alert_emails": ["necko@mozilla.com"], "bug_numbers": [1313095], "kind": "linear", @@ -1854,7 +1854,7 @@ "description": "Network vs cache time load (OnStopRequest) difference (ms) for requests with a high priority and medium queue. Offset by 500 ms." }, "HTTP_NET_VS_CACHE_ONSTOP_QBIG_HIGHPRI": { - "expires_in_version": "never", + "expires_in_version": "58", "alert_emails": ["necko@mozilla.com"], "bug_numbers": [1313095], "kind": "linear", @@ -1863,7 +1863,7 @@ "description": "Network vs cache time load (OnStopRequest) difference (ms) for requests with a high priority and large queue. Offset by 500 ms." }, "HTTP_NET_VS_CACHE_ONSTART_SMALL_NORMALPRI": { - "expires_in_version": "never", + "expires_in_version": "58", "alert_emails": ["necko@mozilla.com"], "bug_numbers": [1313095], "kind": "linear", @@ -1872,7 +1872,7 @@ "description": "Network vs cache time load (OnStartRequest) difference (ms) for cache files with a small size (<32K) and normal priority. Offset by 500 ms." }, "HTTP_NET_VS_CACHE_ONSTART_MED_NORMALPRI": { - "expires_in_version": "never", + "expires_in_version": "58", "alert_emails": ["necko@mozilla.com"], "bug_numbers": [1313095], "kind": "linear", @@ -1881,7 +1881,7 @@ "description": "Network vs cache time load (OnStartRequest) difference (ms) for cache files with a medium size (<256K) and normal priority. Offset by 500 ms." }, "HTTP_NET_VS_CACHE_ONSTART_LARGE_NORMALPRI": { - "expires_in_version": "never", + "expires_in_version": "58", "alert_emails": ["necko@mozilla.com"], "bug_numbers": [1313095], "kind": "linear", @@ -1890,7 +1890,7 @@ "description": "Network vs cache time load (OnStartRequest) difference (ms) for cache files with a large size (>256K) and normal priority. Offset by 500 ms." }, "HTTP_NET_VS_CACHE_ONSTART_SMALL_HIGHPRI": { - "expires_in_version": "never", + "expires_in_version": "58", "alert_emails": ["necko@mozilla.com"], "bug_numbers": [1313095], "kind": "linear", @@ -1899,7 +1899,7 @@ "description": "Network vs cache time load (OnStartRequest) difference (ms) for cache files with a small size (<32K) and high priority. Offset by 500 ms." }, "HTTP_NET_VS_CACHE_ONSTART_MED_HIGHPRI": { - "expires_in_version": "never", + "expires_in_version": "58", "alert_emails": ["necko@mozilla.com"], "bug_numbers": [1313095], "kind": "linear", @@ -1908,7 +1908,7 @@ "description": "Network vs cache time load (OnStartRequest) difference (ms) for cache files with a medium size (<256K) and high priority. Offset by 500 ms." }, "HTTP_NET_VS_CACHE_ONSTART_LARGE_HIGHPRI": { - "expires_in_version": "never", + "expires_in_version": "58", "alert_emails": ["necko@mozilla.com"], "bug_numbers": [1313095], "kind": "linear", @@ -1917,7 +1917,7 @@ "description": "Network vs cache time load (OnStartRequest) difference (ms) for cache files with a large size (>256K) and high priority. Offset by 500 ms." }, "HTTP_NET_VS_CACHE_ONSTOP_SMALL_NORMALPRI": { - "expires_in_version": "never", + "expires_in_version": "58", "alert_emails": ["necko@mozilla.com"], "bug_numbers": [1313095], "kind": "linear", @@ -1926,7 +1926,7 @@ "description": "Network vs cache time load (OnStopRequest) difference (ms) for cache files with a small size (<32K) and normal priority. Offset by 500 ms." }, "HTTP_NET_VS_CACHE_ONSTOP_MED_NORMALPRI": { - "expires_in_version": "never", + "expires_in_version": "58", "alert_emails": ["necko@mozilla.com"], "bug_numbers": [1313095], "kind": "linear", @@ -1935,7 +1935,7 @@ "description": "Network vs cache time load (OnStopRequest) difference (ms) for cache files with a medium size (<256K) and normal priority. Offset by 500 ms." }, "HTTP_NET_VS_CACHE_ONSTOP_LARGE_NORMALPRI": { - "expires_in_version": "never", + "expires_in_version": "58", "alert_emails": ["necko@mozilla.com"], "bug_numbers": [1313095], "kind": "linear", @@ -1944,7 +1944,7 @@ "description": "Network vs cache time load (OnStopRequest) difference (ms) for cache files with a large size (>256K) and normal priority. Offset by 500 ms." }, "HTTP_NET_VS_CACHE_ONSTOP_SMALL_HIGHPRI": { - "expires_in_version": "never", + "expires_in_version": "58", "alert_emails": ["necko@mozilla.com"], "bug_numbers": [1313095], "kind": "linear", @@ -1953,7 +1953,7 @@ "description": "Network vs cache time load (OnStopRequest) difference (ms) for cache files with a small size (<32K) and high priority. Offset by 500 ms." }, "HTTP_NET_VS_CACHE_ONSTOP_MED_HIGHPRI": { - "expires_in_version": "never", + "expires_in_version": "58", "alert_emails": ["necko@mozilla.com"], "bug_numbers": [1313095], "kind": "linear", @@ -1962,7 +1962,7 @@ "description": "Network vs cache time load (OnStopRequest) difference (ms) for cache files with a medium size (<256K) and high priority. Offset by 500 ms." }, "HTTP_NET_VS_CACHE_ONSTOP_LARGE_HIGHPRI": { - "expires_in_version": "never", + "expires_in_version": "58", "alert_emails": ["necko@mozilla.com"], "bug_numbers": [1313095], "kind": "linear", @@ -1971,7 +1971,7 @@ "description": "Network vs cache time load (OnStopRequest) difference (ms) for cache files with a large size (>256K) and high priority. Offset by 500 ms." }, "HTTP_NET_VS_CACHE_ONSTART_REVALIDATED": { - "expires_in_version": "never", + "expires_in_version": "58", "alert_emails": ["necko@mozilla.com"], "bug_numbers": [1313095], "kind": "linear", @@ -1980,7 +1980,7 @@ "description": "Network vs cache time load (OnStartRequest) difference (ms) revalidated cache entries. Offset by 500 ms." }, "HTTP_NET_VS_CACHE_ONSTART_NOTREVALIDATED": { - "expires_in_version": "never", + "expires_in_version": "58", "alert_emails": ["necko@mozilla.com"], "bug_numbers": [1313095], "kind": "linear", @@ -1989,7 +1989,7 @@ "description": "Network vs cache time load (OnStartRequest) difference (ms) not revalidated cache entries. Offset by 500 ms." }, "HTTP_NET_VS_CACHE_ONSTOP_REVALIDATED": { - "expires_in_version": "never", + "expires_in_version": "58", "alert_emails": ["necko@mozilla.com"], "bug_numbers": [1313095], "kind": "linear", @@ -1998,7 +1998,7 @@ "description": "Network vs cache time load (OnStopRequest) difference (ms) revalidated cache entries. Offset by 500 ms." }, "HTTP_NET_VS_CACHE_ONSTOP_NOTREVALIDATED": { - "expires_in_version": "never", + "expires_in_version": "58", "alert_emails": ["necko@mozilla.com"], "bug_numbers": [1313095], "kind": "linear", diff --git a/toolkit/mozapps/installer/windows/nsis/common.nsh b/toolkit/mozapps/installer/windows/nsis/common.nsh index c7d6b9098554..b08379624d5b 100755 --- a/toolkit/mozapps/installer/windows/nsis/common.nsh +++ b/toolkit/mozapps/installer/windows/nsis/common.nsh @@ -1291,169 +1291,6 @@ !endif !macroend -/** - * Writes common registry values for a handler that uses DDE using SHCTX. - * - * @param _KEY - * The key name in relation to the HKCR root. SOFTWARE\Classes is - * prefixed to this value when using SHCTX. - * @param _VALOPEN - * The path and args to launch the application. - * @param _VALICON - * The path to the binary that contains the icon group for the default icon - * followed by a comma and either the icon group's resource index or the icon - * group's resource id prefixed with a minus sign - * @param _DISPNAME - * The display name for the handler. If emtpy no value will be set. - * @param _ISPROTOCOL - * Sets protocol handler specific registry values when "true". - * Deletes protocol handler specific registry values when "delete". - * Otherwise doesn't touch handler specific registry values. - * @param _DDE_APPNAME - * Sets DDE specific registry values when not an empty string. - * - * $R0 = storage for SOFTWARE\Classes - * $R1 = string value of the current registry key path. - * $R2 = _KEY - * $R3 = _VALOPEN - * $R4 = _VALICON - * $R5 = _DISPNAME - * $R6 = _ISPROTOCOL - * $R7 = _DDE_APPNAME - * $R8 = _DDE_DEFAULT - * $R9 = _DDE_TOPIC - */ -!macro AddDDEHandlerValues - - !ifndef ${_MOZFUNC_UN}AddDDEHandlerValues - !verbose push - !verbose ${_MOZFUNC_VERBOSE} - !define ${_MOZFUNC_UN}AddDDEHandlerValues "!insertmacro ${_MOZFUNC_UN}AddDDEHandlerValuesCall" - - Function ${_MOZFUNC_UN}AddDDEHandlerValues - Exch $R9 - Exch 1 - Exch $R8 - Exch 2 - Exch $R7 - Exch 3 - Exch $R6 - Exch 4 - Exch $R5 - Exch 5 - Exch $R4 - Exch 6 - Exch $R3 - Exch 7 - Exch $R2 - Push $R1 - Push $R0 - - StrCpy $R0 "SOFTWARE\Classes" - StrCmp "$R5" "" +6 +1 - ReadRegStr $R1 SHCTX "$R2" "FriendlyTypeName" - - StrCmp "$R1" "" +1 +3 - WriteRegStr SHCTX "$R0\$R2" "" "$R5" - WriteRegStr SHCTX "$R0\$R2" "FriendlyTypeName" "$R5" - - StrCmp "$R6" "true" +1 +2 - WriteRegStr SHCTX "$R0\$R2" "URL Protocol" "" - StrCmp "$R6" "delete" +1 +2 - DeleteRegValue SHCTX "$R0\$R2" "URL Protocol" - StrCpy $R1 "" - ReadRegDWord $R1 SHCTX "$R0\$R2" "EditFlags" - StrCmp $R1 "" +1 +3 ; Only add EditFlags if a value doesn't exist - DeleteRegValue SHCTX "$R0\$R2" "EditFlags" - WriteRegDWord SHCTX "$R0\$R2" "EditFlags" 0x00000002 - - StrCmp "$R4" "" +2 +1 - WriteRegStr SHCTX "$R0\$R2\DefaultIcon" "" "$R4" - - WriteRegStr SHCTX "$R0\$R2\shell" "" "open" - WriteRegStr SHCTX "$R0\$R2\shell\open\command" "" "$R3" - - WriteRegStr SHCTX "$R0\$R2\shell\open\ddeexec" "" "$R8" - WriteRegStr SHCTX "$R0\$R2\shell\open\ddeexec" "NoActivateHandler" "" - WriteRegStr SHCTX "$R0\$R2\shell\open\ddeexec\Application" "" "$R7" - WriteRegStr SHCTX "$R0\$R2\shell\open\ddeexec\Topic" "" "$R9" - - ; The ifexec key may have been added by another application so try to - ; delete it to prevent it from breaking this app's shell integration. - ; Also, IE 6 and below doesn't remove this key when it sets itself as the - ; default handler and if this key exists IE's shell integration breaks. - DeleteRegKey HKLM "$R0\$R2\shell\open\ddeexec\ifexec" - DeleteRegKey HKCU "$R0\$R2\shell\open\ddeexec\ifexec" - ClearErrors - - Pop $R0 - Pop $R1 - Exch $R2 - Exch 7 - Exch $R3 - Exch 6 - Exch $R4 - Exch 5 - Exch $R5 - Exch 4 - Exch $R6 - Exch 3 - Exch $R7 - Exch 2 - Exch $R8 - Exch 1 - Exch $R9 - FunctionEnd - - !verbose pop - !endif -!macroend - -!macro AddDDEHandlerValuesCall _KEY _VALOPEN _VALICON _DISPNAME _ISPROTOCOL _DDE_APPNAME _DDE_DEFAULT _DDE_TOPIC - !verbose push - !verbose ${_MOZFUNC_VERBOSE} - Push "${_KEY}" - Push "${_VALOPEN}" - Push "${_VALICON}" - Push "${_DISPNAME}" - Push "${_ISPROTOCOL}" - Push "${_DDE_APPNAME}" - Push "${_DDE_DEFAULT}" - Push "${_DDE_TOPIC}" - Call AddDDEHandlerValues - !verbose pop -!macroend - -!macro un.AddDDEHandlerValuesCall _KEY _VALOPEN _VALICON _DISPNAME _ISPROTOCOL _DDE_APPNAME _DDE_DEFAULT _DDE_TOPIC - !verbose push - !verbose ${_MOZFUNC_VERBOSE} - Push "${_KEY}" - Push "${_VALOPEN}" - Push "${_VALICON}" - Push "${_DISPNAME}" - Push "${_ISPROTOCOL}" - Push "${_DDE_APPNAME}" - Push "${_DDE_DEFAULT}" - Push "${_DDE_TOPIC}" - Call un.AddDDEHandlerValues - !verbose pop -!macroend - -!macro un.AddDDEHandlerValues - !ifndef un.AddDDEHandlerValues - !verbose push - !verbose ${_MOZFUNC_VERBOSE} - !undef _MOZFUNC_UN - !define _MOZFUNC_UN "un." - - !insertmacro AddDDEHandlerValues - - !undef _MOZFUNC_UN - !define _MOZFUNC_UN - !verbose pop - !endif -!macroend - /** * Writes common registry values for a handler that DOES NOT use DDE using SHCTX. * @@ -6128,8 +5965,10 @@ ${LogMsg} "OS Name : Windows 8" ${ElseIf} ${IsWin8.1} ${LogMsg} "OS Name : Windows 8.1" - ${ElseIf} ${AtLeastWin8.1} - ${LogMsg} "OS Name : Above Windows 8.1" + ${ElseIf} ${IsWin10} + ${LogMsg} "OS Name : Windows 10" + ${ElseIf} ${AtLeastWin10} + ${LogMsg} "OS Name : Above Windows 10" ${Else} ${LogMsg} "OS Name : Unable to detect" ${EndIf} diff --git a/toolkit/mozapps/installer/windows/nsis/overrides.nsh b/toolkit/mozapps/installer/windows/nsis/overrides.nsh index 95a399a15e45..5d1f26965730 100755 --- a/toolkit/mozapps/installer/windows/nsis/overrides.nsh +++ b/toolkit/mozapps/installer/windows/nsis/overrides.nsh @@ -48,6 +48,11 @@ !insertmacro __MOZ__WinVer_DefineOSTests 2012R2 !endif +!ifndef WINVER_10 + !define WINVER_10 0x0A000000 ;10.0.10240 + !insertmacro __MOZ__WinVer_DefineOSTests 10 +!endif + !verbose push !verbose 3 !ifndef _OVERRIDE_VERBOSE diff --git a/xpfe/appshell/nsIXULWindow.idl b/xpfe/appshell/nsIXULWindow.idl index 8db12adb6b72..bc57554808a0 100644 --- a/xpfe/appshell/nsIXULWindow.idl +++ b/xpfe/appshell/nsIXULWindow.idl @@ -103,11 +103,6 @@ interface nsIXULWindow : nsISupports attribute unsigned long zLevel; - /** - * contextFlags are from nsIWindowCreator2 - */ - attribute uint32_t contextFlags; - attribute uint32_t chromeFlags; /** diff --git a/xpfe/appshell/nsXULWindow.cpp b/xpfe/appshell/nsXULWindow.cpp index ae0cbdedb0ae..26d9e3cb4f66 100644 --- a/xpfe/appshell/nsXULWindow.cpp +++ b/xpfe/appshell/nsXULWindow.cpp @@ -105,7 +105,6 @@ nsXULWindow::nsXULWindow(uint32_t aChromeFlags) mIgnoreXULSizeMode(false), mDestroying(false), mRegistered(false), - mContextFlags(0), mPersistentAttributesDirty(0), mPersistentAttributesMask(0), mChromeFlags(aChromeFlags) @@ -254,19 +253,6 @@ NS_IMETHODIMP nsXULWindow::SetZLevel(uint32_t aLevel) return NS_OK; } -NS_IMETHODIMP nsXULWindow::GetContextFlags(uint32_t *aContextFlags) -{ - NS_ENSURE_ARG_POINTER(aContextFlags); - *aContextFlags = mContextFlags; - return NS_OK; -} - -NS_IMETHODIMP nsXULWindow::SetContextFlags(uint32_t aContextFlags) -{ - mContextFlags = aContextFlags; - return NS_OK; -} - NS_IMETHODIMP nsXULWindow::GetChromeFlags(uint32_t *aChromeFlags) { NS_ENSURE_ARG_POINTER(aChromeFlags); diff --git a/xpfe/appshell/nsXULWindow.h b/xpfe/appshell/nsXULWindow.h index eb059c939ee3..2e680c7d2bb1 100644 --- a/xpfe/appshell/nsXULWindow.h +++ b/xpfe/appshell/nsXULWindow.h @@ -163,7 +163,6 @@ protected: // otherwise happen due to script running as we tear down various things. bool mDestroying; bool mRegistered; - uint32_t mContextFlags; uint32_t mPersistentAttributesDirty; // persistentAttributes uint32_t mPersistentAttributesMask; uint32_t mChromeFlags;