Bug 834701 - Stop setting the XBL script in the browser. r=bz

This commit is contained in:
Bobby Holley 2013-05-20 22:34:17 -06:00
Родитель 77db425a2a
Коммит 764d0eecd5
5 изменённых файлов: 7 добавлений и 24 удалений

Просмотреть файл

@ -425,8 +425,7 @@ nsXBLProtoImplField::InstallField(nsIScriptContext* aContext,
JS::Rooted<JS::Value> result(cx);
JS::CompileOptions options(cx);
options.setFileAndLine(uriSpec.get(), mLineNumber)
.setVersion(JSVERSION_LATEST)
.setUserBit(true); // Flag us as XBL
.setVersion(JSVERSION_LATEST);
rv = context->EvaluateString(nsDependentString(mFieldText,
mFieldTextLength),
wrappedNode, options,

Просмотреть файл

@ -203,8 +203,7 @@ nsXBLProtoImplMethod::CompileMember(nsIScriptContext* aContext, const nsCString&
JS::CompileOptions options(cx);
options.setFileAndLine(functionUri.get(),
uncompiledMethod->mBodyText.GetLineNumber())
.setVersion(JSVERSION_LATEST)
.setUserBit(true); // Flag us as XBL
.setVersion(JSVERSION_LATEST);
JS::RootedObject rootedNull(cx, nullptr); // See bug 781070.
JS::RootedObject methodObject(cx);
nsresult rv = nsJSUtils::CompileFunction(cx, rootedNull, options, cname,

Просмотреть файл

@ -216,8 +216,7 @@ nsXBLProtoImplProperty::CompileMember(nsIScriptContext* aContext, const nsCStrin
JSAutoCompartment ac(cx, aClassObject);
JS::CompileOptions options(cx);
options.setFileAndLine(functionUri.get(), mGetterText->GetLineNumber())
.setVersion(JSVERSION_LATEST)
.setUserBit(true); // Flag us as XBL
.setVersion(JSVERSION_LATEST);
nsCString name = NS_LITERAL_CSTRING("get_") + NS_ConvertUTF16toUTF8(mName);
JS::RootedObject rootedNull(cx, nullptr); // See bug 781070.
JS::RootedObject getterObject(cx);
@ -265,8 +264,7 @@ nsXBLProtoImplProperty::CompileMember(nsIScriptContext* aContext, const nsCStrin
JSAutoCompartment ac(cx, aClassObject);
JS::CompileOptions options(cx);
options.setFileAndLine(functionUri.get(), mSetterText->GetLineNumber())
.setVersion(JSVERSION_LATEST)
.setUserBit(true); // Flag us as XBL
.setVersion(JSVERSION_LATEST);
nsCString name = NS_LITERAL_CSTRING("set_") + NS_ConvertUTF16toUTF8(mName);
JS::RootedObject rootedNull(cx, nullptr); // See bug 781070.
JS::RootedObject setterObject(cx);

Просмотреть файл

@ -384,8 +384,7 @@ nsXBLPrototypeHandler::EnsureEventHandler(nsIScriptGlobalObject* aGlobal,
JSAutoCompartment ac(cx, scopeObject);
JS::CompileOptions options(cx);
options.setFileAndLine(bindingURI.get(), mLineNumber)
.setVersion(JSVERSION_LATEST)
.setUserBit(true); // Flag us as XBL
.setVersion(JSVERSION_LATEST);
JS::Rooted<JSObject*> rootedNull(cx); // See bug 781070.
JS::Rooted<JSObject*> handlerFun(cx);

Просмотреть файл

@ -25,18 +25,6 @@ XBL_DeserializeFunction(nsIScriptContext* aContext,
JS::MutableHandle<JSObject*> aFunctionObjectp)
{
AutoPushJSContext cx(aContext->GetNativeContext());
nsresult rv = nsContentUtils::XPConnect()->ReadFunction(aStream, cx,
aFunctionObjectp.address());
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;
return nsContentUtils::XPConnect()->ReadFunction(aStream, cx,
aFunctionObjectp.address());
}