mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-28 13:21:28 +00:00
Bug 823279 - Mark deserialized XBL script as XBL. r=bz
This commit is contained in:
parent
105a2ec013
commit
95ed36320f
@ -6,6 +6,7 @@
|
||||
#include "nsXBLSerialize.h"
|
||||
#include "nsDOMScriptObjectHolder.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "jsdbgapi.h"
|
||||
|
||||
nsresult
|
||||
XBL_SerializeFunction(nsIScriptContext* aContext,
|
||||
@ -22,5 +23,17 @@ XBL_DeserializeFunction(nsIScriptContext* aContext,
|
||||
JSObject** aFunctionObjectp)
|
||||
{
|
||||
JSContext* cx = aContext->GetNativeContext();
|
||||
return nsContentUtils::XPConnect()->ReadFunction(aStream, cx, aFunctionObjectp);
|
||||
nsresult rv = nsContentUtils::XPConnect()->ReadFunction(aStream, cx, aFunctionObjectp);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// Mark the script as XBL.
|
||||
//
|
||||
// This might be more elegantly handled as a flag via the XPConnect serialization
|
||||
// code, but that would involve profile compat issues between different builds.
|
||||
// Given that we know this code is XBL, just flag it as such.
|
||||
JSAutoRequest ar(cx);
|
||||
JSFunction* fun = JS_ValueToFunction(cx, JS::ObjectValue(**aFunctionObjectp));
|
||||
NS_ENSURE_TRUE(fun, NS_ERROR_UNEXPECTED);
|
||||
JS_SetScriptUserBit(JS_GetFunctionScript(cx, fun), true);
|
||||
return NS_OK;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user