зеркало из https://github.com/mozilla/gecko-dev.git
Back out changeset 09e059daabae (bug 1215072
) for adding a permaorange-on-b2g test
CLOSED TREE
This commit is contained in:
Родитель
a9549930a2
Коммит
dc7a4cc45e
|
@ -1606,9 +1606,7 @@ CanvasRenderingContext2D::SetIsIPC(bool isIPC)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
CanvasRenderingContext2D::SetContextOptions(JSContext* aCx,
|
||||
JS::Handle<JS::Value> aOptions,
|
||||
ErrorResult& aRvForDictionaryInit)
|
||||
CanvasRenderingContext2D::SetContextOptions(JSContext* aCx, JS::Handle<JS::Value> aOptions)
|
||||
{
|
||||
if (aOptions.isNullOrUndefined()) {
|
||||
return NS_OK;
|
||||
|
@ -1618,10 +1616,7 @@ CanvasRenderingContext2D::SetContextOptions(JSContext* aCx,
|
|||
MOZ_ASSERT(!mTarget);
|
||||
|
||||
ContextAttributes2D attributes;
|
||||
if (!attributes.Init(aCx, aOptions)) {
|
||||
aRvForDictionaryInit.Throw(NS_ERROR_UNEXPECTED);
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
NS_ENSURE_TRUE(attributes.Init(aCx, aOptions), NS_ERROR_UNEXPECTED);
|
||||
|
||||
if (Preferences::GetBool("gfx.canvas.willReadFrequently.enable", false)) {
|
||||
// Use software when there is going to be a lot of readback
|
||||
|
|
|
@ -465,9 +465,7 @@ public:
|
|||
// this rect is in canvas device space
|
||||
void Redraw(const mozilla::gfx::Rect &r);
|
||||
NS_IMETHOD Redraw(const gfxRect &r) override { Redraw(ToRect(r)); return NS_OK; }
|
||||
NS_IMETHOD SetContextOptions(JSContext* aCx,
|
||||
JS::Handle<JS::Value> aOptions,
|
||||
ErrorResult& aRvForDictionaryInit) override;
|
||||
NS_IMETHOD SetContextOptions(JSContext* aCx, JS::Handle<JS::Value> aOptions) override;
|
||||
|
||||
/**
|
||||
* An abstract base class to be implemented by callers wanting to be notified
|
||||
|
|
|
@ -173,11 +173,9 @@ CanvasRenderingContextHelper::GetContext(JSContext* aCx,
|
|||
mCurrentContext = context.forget();
|
||||
mCurrentContextType = contextType;
|
||||
|
||||
nsresult rv = UpdateContext(aCx, aContextOptions, aRv);
|
||||
if (NS_FAILED(rv)) {
|
||||
// See bug 645792 and bug 1215072.
|
||||
// We want to throw only if dictionary initialization fails,
|
||||
// so only in case aRv has been set to some error value.
|
||||
aRv = UpdateContext(aCx, aContextOptions);
|
||||
if (aRv.Failed()) {
|
||||
aRv = NS_OK; // See bug 645792
|
||||
return nullptr;
|
||||
}
|
||||
} else {
|
||||
|
@ -192,8 +190,7 @@ CanvasRenderingContextHelper::GetContext(JSContext* aCx,
|
|||
|
||||
nsresult
|
||||
CanvasRenderingContextHelper::UpdateContext(JSContext* aCx,
|
||||
JS::Handle<JS::Value> aNewContextOptions,
|
||||
ErrorResult& aRvForDictionaryInit)
|
||||
JS::Handle<JS::Value> aNewContextOptions)
|
||||
{
|
||||
if (!mCurrentContext)
|
||||
return NS_OK;
|
||||
|
@ -208,8 +205,7 @@ CanvasRenderingContextHelper::UpdateContext(JSContext* aCx,
|
|||
return rv;
|
||||
}
|
||||
|
||||
rv = currentContext->SetContextOptions(aCx, aNewContextOptions,
|
||||
aRvForDictionaryInit);
|
||||
rv = currentContext->SetContextOptions(aCx, aNewContextOptions);
|
||||
if (NS_FAILED(rv)) {
|
||||
mCurrentContext = nullptr;
|
||||
return rv;
|
||||
|
|
|
@ -44,8 +44,7 @@ public:
|
|||
|
||||
protected:
|
||||
virtual nsresult UpdateContext(JSContext* aCx,
|
||||
JS::Handle<JS::Value> aNewContextOptions,
|
||||
ErrorResult& aRvForDictionaryInit);
|
||||
JS::Handle<JS::Value> aNewContextOptions);
|
||||
|
||||
virtual nsresult ParseParams(JSContext* aCx,
|
||||
const nsAString& aType,
|
||||
|
|
|
@ -158,8 +158,7 @@ private:
|
|||
void CanvasAttrChanged()
|
||||
{
|
||||
mAttrDirty = true;
|
||||
ErrorResult dummy;
|
||||
UpdateContext(nullptr, JS::NullHandleValue, dummy);
|
||||
UpdateContext(nullptr, JS::NullHandleValue);
|
||||
}
|
||||
|
||||
bool mAttrDirty;
|
||||
|
|
|
@ -347,17 +347,13 @@ WebGLContext::OnMemoryPressure()
|
|||
//
|
||||
|
||||
NS_IMETHODIMP
|
||||
WebGLContext::SetContextOptions(JSContext* cx, JS::Handle<JS::Value> options,
|
||||
ErrorResult& aRvForDictionaryInit)
|
||||
WebGLContext::SetContextOptions(JSContext* cx, JS::Handle<JS::Value> options)
|
||||
{
|
||||
if (options.isNullOrUndefined() && mOptionsFrozen)
|
||||
return NS_OK;
|
||||
|
||||
WebGLContextAttributes attributes;
|
||||
if (!attributes.Init(cx, options)) {
|
||||
aRvForDictionaryInit.Throw(NS_ERROR_UNEXPECTED);
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
NS_ENSURE_TRUE(attributes.Init(cx, options), NS_ERROR_UNEXPECTED);
|
||||
|
||||
WebGLContextOptions newOpts;
|
||||
|
||||
|
|
|
@ -249,8 +249,7 @@ public:
|
|||
NS_IMETHOD SetIsOpaque(bool) override { return NS_OK; };
|
||||
bool GetIsOpaque() override { return false; }
|
||||
NS_IMETHOD SetContextOptions(JSContext* cx,
|
||||
JS::Handle<JS::Value> options,
|
||||
ErrorResult& aRvForDictionaryInit) override;
|
||||
JS::Handle<JS::Value> options) override;
|
||||
|
||||
NS_IMETHOD SetIsIPC(bool) override {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
|
|
|
@ -149,11 +149,7 @@ public:
|
|||
// Redraw the dirty rectangle of this canvas.
|
||||
NS_IMETHOD Redraw(const gfxRect &dirty) = 0;
|
||||
|
||||
NS_IMETHOD SetContextOptions(JSContext* cx, JS::Handle<JS::Value> options,
|
||||
mozilla::ErrorResult& aRvForDictionaryInit)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHOD SetContextOptions(JSContext* cx, JS::Handle<JS::Value> options) { return NS_OK; }
|
||||
|
||||
// return true and fills in the bounding rect if elementis a child and has a hit region.
|
||||
virtual bool GetHitRegionRect(mozilla::dom::Element* element, nsRect& rect) { return false; }
|
||||
|
|
|
@ -225,7 +225,6 @@ disabled = bug 407107
|
|||
[test_bug866575.html]
|
||||
skip-if = (toolkit == 'gonk' && debug) #bug 1045153
|
||||
[test_bug902651.html]
|
||||
[test_bug1215072.html]
|
||||
[test_canvas.html]
|
||||
skip-if = (toolkit == 'gonk' && debug) || (toolkit == 'android' && processor == 'x86') || (android_version == '18' && debug) #debug-only crash; bug 933541 #x86 only bug 913662 #android 4.3 debug bug 1143317
|
||||
[test_canvas_focusring.html]
|
||||
|
|
|
@ -1,41 +0,0 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=1215072
|
||||
-->
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Test for Bug 1215072</title>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
<script type="application/javascript">
|
||||
|
||||
/** Test for Bug 1215072 **/
|
||||
try {
|
||||
document.createElement("canvas")
|
||||
.getContext("webgl", { get stencil() { throw "bah (webgl)"; } });
|
||||
ok(false);
|
||||
} catch(ex) {
|
||||
is(ex, "bah (webgl)", "Should have thrown an exception.");
|
||||
}
|
||||
|
||||
try {
|
||||
document.createElement("canvas")
|
||||
.getContext("2d", { get alpha() {throw "bah (2d)"; } });
|
||||
ok(false);
|
||||
} catch(ex) {
|
||||
is(ex, "bah (2d)", "Should have thrown an exception.");
|
||||
}
|
||||
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1215072">Mozilla Bug 1215072</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
|
||||
</div>
|
||||
<pre id="test">
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
|
@ -449,8 +449,7 @@ HTMLCanvasElement::SetAttr(int32_t aNameSpaceID, nsIAtom* aName,
|
|||
aNameSpaceID == kNameSpaceID_None &&
|
||||
(aName == nsGkAtoms::width || aName == nsGkAtoms::height || aName == nsGkAtoms::moz_opaque))
|
||||
{
|
||||
ErrorResult dummy;
|
||||
rv = UpdateContext(nullptr, JS::NullHandleValue, dummy);
|
||||
rv = UpdateContext(nullptr, JS::NullHandleValue);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
||||
|
@ -466,8 +465,7 @@ HTMLCanvasElement::UnsetAttr(int32_t aNameSpaceID, nsIAtom* aName,
|
|||
aNameSpaceID == kNameSpaceID_None &&
|
||||
(aName == nsGkAtoms::width || aName == nsGkAtoms::height || aName == nsGkAtoms::moz_opaque))
|
||||
{
|
||||
ErrorResult dummy;
|
||||
rv = UpdateContext(nullptr, JS::NullHandleValue, dummy);
|
||||
rv = UpdateContext(nullptr, JS::NullHandleValue);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
return rv;
|
||||
|
@ -913,8 +911,7 @@ HTMLCanvasElement::MozGetIPCContext(const nsAString& aContextId,
|
|||
mCurrentContext->SetIsIPC(true);
|
||||
mCurrentContextType = contextType;
|
||||
|
||||
ErrorResult dummy;
|
||||
nsresult rv = UpdateContext(nullptr, JS::NullHandleValue, dummy);
|
||||
nsresult rv = UpdateContext(nullptr, JS::NullHandleValue);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
} else {
|
||||
// We already have a context of some type.
|
||||
|
|
Загрузка…
Ссылка в новой задаче