mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 22:01:30 +00:00
Bug 684825 Fix for ASSERTION: QueryInterface needed r=jmuizelaar
This commit is contained in:
parent
312bca329e
commit
e0fc97dd2d
@ -487,19 +487,17 @@ nsHTMLCanvasElement::GetContext(const nsAString& aContextId,
|
|||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsCOMPtr<nsIPropertyBag> contextProps;
|
nsCOMPtr<nsIWritablePropertyBag2> contextProps;
|
||||||
if (!JSVAL_IS_NULL(aContextOptions) &&
|
if (!JSVAL_IS_NULL(aContextOptions) &&
|
||||||
!JSVAL_IS_VOID(aContextOptions))
|
!JSVAL_IS_VOID(aContextOptions))
|
||||||
{
|
{
|
||||||
JSContext *cx = nsContentUtils::GetCurrentJSContext();
|
JSContext *cx = nsContentUtils::GetCurrentJSContext();
|
||||||
|
|
||||||
nsCOMPtr<nsIWritablePropertyBag2> newProps;
|
|
||||||
|
|
||||||
// note: if any contexts end up supporting something other
|
// note: if any contexts end up supporting something other
|
||||||
// than objects, e.g. plain strings, then we'll need to expand
|
// than objects, e.g. plain strings, then we'll need to expand
|
||||||
// this to know how to create nsISupportsStrings etc.
|
// this to know how to create nsISupportsStrings etc.
|
||||||
if (JSVAL_IS_OBJECT(aContextOptions)) {
|
if (JSVAL_IS_OBJECT(aContextOptions)) {
|
||||||
newProps = do_CreateInstance("@mozilla.org/hash-property-bag;1");
|
contextProps = do_CreateInstance("@mozilla.org/hash-property-bag;1");
|
||||||
|
|
||||||
JSObject *opts = JSVAL_TO_OBJECT(aContextOptions);
|
JSObject *opts = JSVAL_TO_OBJECT(aContextOptions);
|
||||||
JSIdArray *props = JS_Enumerate(cx, opts);
|
JSIdArray *props = JS_Enumerate(cx, opts);
|
||||||
@ -520,11 +518,11 @@ nsHTMLCanvasElement::GetContext(const nsAString& aContextId,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (JSVAL_IS_BOOLEAN(propval)) {
|
if (JSVAL_IS_BOOLEAN(propval)) {
|
||||||
newProps->SetPropertyAsBool(pstr, propval == JSVAL_TRUE ? PR_TRUE : PR_FALSE);
|
contextProps->SetPropertyAsBool(pstr, propval == JSVAL_TRUE ? PR_TRUE : PR_FALSE);
|
||||||
} else if (JSVAL_IS_INT(propval)) {
|
} else if (JSVAL_IS_INT(propval)) {
|
||||||
newProps->SetPropertyAsInt32(pstr, JSVAL_TO_INT(propval));
|
contextProps->SetPropertyAsInt32(pstr, JSVAL_TO_INT(propval));
|
||||||
} else if (JSVAL_IS_DOUBLE(propval)) {
|
} else if (JSVAL_IS_DOUBLE(propval)) {
|
||||||
newProps->SetPropertyAsDouble(pstr, JSVAL_TO_DOUBLE(propval));
|
contextProps->SetPropertyAsDouble(pstr, JSVAL_TO_DOUBLE(propval));
|
||||||
} else if (JSVAL_IS_STRING(propval)) {
|
} else if (JSVAL_IS_STRING(propval)) {
|
||||||
JSString *propvalString = JS_ValueToString(cx, propval);
|
JSString *propvalString = JS_ValueToString(cx, propval);
|
||||||
nsDependentJSString vstr;
|
nsDependentJSString vstr;
|
||||||
@ -533,12 +531,10 @@ nsHTMLCanvasElement::GetContext(const nsAString& aContextId,
|
|||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
newProps->SetPropertyAsAString(pstr, vstr);
|
contextProps->SetPropertyAsAString(pstr, vstr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
contextProps = newProps;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
rv = UpdateContext(contextProps);
|
rv = UpdateContext(contextProps);
|
||||||
|
Loading…
Reference in New Issue
Block a user