зеркало из https://github.com/mozilla/gecko-dev.git
Bug 820666 - Tag XBL script for <field> elements and child scripts. r=jorendorff
This commit is contained in:
Родитель
0d0d698c0e
Коммит
be465ba470
|
@ -113,6 +113,7 @@ nsXBLProtoImplField::InstallField(nsIScriptContext* aContext,
|
|||
aBoundNode,
|
||||
aPrincipal, uriSpec.get(),
|
||||
mLineNumber, JSVERSION_LATEST,
|
||||
/* aIsXBL = */ true,
|
||||
&result, &undefined);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
|
|
|
@ -98,6 +98,7 @@ public:
|
|||
const char *aURL,
|
||||
uint32_t aLineNo,
|
||||
uint32_t aVersion,
|
||||
bool aIsXBL,
|
||||
JS::Value* aRetValue,
|
||||
bool* aIsUndefined) = 0;
|
||||
|
||||
|
|
|
@ -1250,6 +1250,7 @@ nsJSContext::EvaluateStringWithValue(const nsAString& aScript,
|
|||
const char *aURL,
|
||||
uint32_t aLineNo,
|
||||
uint32_t aVersion,
|
||||
bool aIsXBL,
|
||||
JS::Value* aRetValue,
|
||||
bool* aIsUndefined)
|
||||
{
|
||||
|
@ -1324,7 +1325,8 @@ nsJSContext::EvaluateStringWithValue(const nsAString& aScript,
|
|||
JS::CompileOptions options(mContext);
|
||||
options.setFileAndLine(aURL, aLineNo)
|
||||
.setVersion(JSVersion(aVersion))
|
||||
.setPrincipals(nsJSPrincipals::get(principal));
|
||||
.setPrincipals(nsJSPrincipals::get(principal))
|
||||
.setUserBit(aIsXBL);
|
||||
js::RootedObject rootedScope(mContext, aScopeObject);
|
||||
ok = JS::Evaluate(mContext, rootedScope, options, PromiseFlatString(aScript).get(),
|
||||
aScript.Length(), &val);
|
||||
|
@ -1782,7 +1784,8 @@ nsJSContext::CompileEventHandler(nsIAtom *aName,
|
|||
|
||||
JS::CompileOptions options(mContext);
|
||||
options.setVersion(JSVersion(aVersion))
|
||||
.setFileAndLine(aURL, aLineNo);
|
||||
.setFileAndLine(aURL, aLineNo)
|
||||
.setUserBit(aIsXBL);
|
||||
js::RootedObject empty(mContext, NULL);
|
||||
JSFunction* fun = JS::CompileFunction(mContext, empty, options, nsAtomCString(aName).get(),
|
||||
aArgCount, aArgNames,
|
||||
|
@ -1793,11 +1796,6 @@ nsJSContext::CompileEventHandler(nsIAtom *aName,
|
|||
return NS_ERROR_ILLEGAL_VALUE;
|
||||
}
|
||||
|
||||
// If this is an XBL function, make a note to that effect on its script.
|
||||
if (aIsXBL) {
|
||||
JS_SetScriptUserBit(JS_GetFunctionScript(mContext, fun), true);
|
||||
}
|
||||
|
||||
JSObject *handler = ::JS_GetFunctionObject(fun);
|
||||
return aHandler.set(handler);
|
||||
}
|
||||
|
@ -1849,7 +1847,8 @@ nsJSContext::CompileFunction(JSObject* aTarget,
|
|||
JS::CompileOptions options(mContext);
|
||||
options.setPrincipals(nsJSPrincipals::get(principal))
|
||||
.setVersion(JSVersion(aVersion))
|
||||
.setFileAndLine(aURL, aLineNo);
|
||||
.setFileAndLine(aURL, aLineNo)
|
||||
.setUserBit(aIsXBL);
|
||||
JSFunction* fun = JS::CompileFunction(mContext, target,
|
||||
options, PromiseFlatCString(aName).get(),
|
||||
aArgCount, aArgArray,
|
||||
|
@ -1858,11 +1857,6 @@ nsJSContext::CompileFunction(JSObject* aTarget,
|
|||
if (!fun)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
// If this is an XBL function, make a note to that effect on its script.
|
||||
if (aIsXBL) {
|
||||
JS_SetScriptUserBit(JS_GetFunctionScript(mContext, fun), true);
|
||||
}
|
||||
|
||||
*aFunctionObject = JS_GetFunctionObject(fun);
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -59,6 +59,7 @@ public:
|
|||
const char* aURL,
|
||||
uint32_t aLineNo,
|
||||
uint32_t aVersion,
|
||||
bool aIsXBL,
|
||||
JS::Value* aRetValue,
|
||||
bool* aIsUndefined);
|
||||
|
||||
|
|
|
@ -1593,7 +1593,7 @@ _evaluate(NPP npp, NPObject* npobj, NPString *script, NPVariant *result)
|
|||
npp, npobj, script->UTF8Characters));
|
||||
|
||||
nsresult rv = scx->EvaluateStringWithValue(utf16script, obj, principal,
|
||||
spec, 0, 0, rval, nullptr);
|
||||
spec, 0, 0, false, rval, nullptr);
|
||||
|
||||
return NS_SUCCEEDED(rv) &&
|
||||
(!result || JSValToNPVariant(npp, cx, *rval, result));
|
||||
|
|
|
@ -4862,7 +4862,8 @@ EmitFunc(JSContext *cx, BytecodeEmitter *bce, ParseNode *pn)
|
|||
.setOriginPrincipals(parent->originPrincipals)
|
||||
.setCompileAndGo(parent->compileAndGo)
|
||||
.setNoScriptRval(false)
|
||||
.setVersion(parent->getVersion());
|
||||
.setVersion(parent->getVersion())
|
||||
.setUserBit(parent->userBit);
|
||||
Rooted<JSScript*> script(cx, JSScript::Create(cx, enclosingScope, false, options,
|
||||
parent->staticLevel + 1,
|
||||
bce->script->scriptSource(),
|
||||
|
|
|
@ -5225,6 +5225,7 @@ JS::CompileOptions::CompileOptions(JSContext *cx)
|
|||
compileAndGo(cx->hasRunOption(JSOPTION_COMPILE_N_GO)),
|
||||
noScriptRval(cx->hasRunOption(JSOPTION_NO_SCRIPT_RVAL)),
|
||||
selfHostingMode(false),
|
||||
userBit(false),
|
||||
sourcePolicy(SAVE_SOURCE)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -4915,6 +4915,7 @@ struct JS_PUBLIC_API(CompileOptions) {
|
|||
bool compileAndGo;
|
||||
bool noScriptRval;
|
||||
bool selfHostingMode;
|
||||
bool userBit;
|
||||
enum SourcePolicy {
|
||||
NO_SOURCE,
|
||||
LAZY_SOURCE,
|
||||
|
@ -4932,6 +4933,7 @@ struct JS_PUBLIC_API(CompileOptions) {
|
|||
CompileOptions &setCompileAndGo(bool cng) { compileAndGo = cng; return *this; }
|
||||
CompileOptions &setNoScriptRval(bool nsr) { noScriptRval = nsr; return *this; }
|
||||
CompileOptions &setSelfHostingMode(bool shm) { selfHostingMode = shm; return *this; }
|
||||
CompileOptions &setUserBit(bool bit) { userBit = bit; return *this; }
|
||||
CompileOptions &setSourcePolicy(SourcePolicy sp) { sourcePolicy = sp; return *this; }
|
||||
};
|
||||
|
||||
|
|
|
@ -1615,6 +1615,7 @@ JSScript::Create(JSContext *cx, HandleObject enclosingScope, bool savedCallerFun
|
|||
script->setScriptSource(ss);
|
||||
script->sourceStart = bufStart;
|
||||
script->sourceEnd = bufEnd;
|
||||
script->userBit = options.userBit;
|
||||
|
||||
return script;
|
||||
}
|
||||
|
@ -2255,7 +2256,8 @@ js::CloneScript(JSContext *cx, HandleObject enclosingScope, HandleFunction fun,
|
|||
.setOriginPrincipals(src->originPrincipals)
|
||||
.setCompileAndGo(src->compileAndGo)
|
||||
.setNoScriptRval(src->noScriptRval)
|
||||
.setVersion(src->getVersion());
|
||||
.setVersion(src->getVersion())
|
||||
.setUserBit(src->userBit);
|
||||
RootedScript dst(cx, JSScript::Create(cx, enclosingScope, src->savedCallerFun,
|
||||
options, src->staticLevel,
|
||||
src->scriptSource(), src->sourceStart, src->sourceEnd));
|
||||
|
@ -2301,7 +2303,6 @@ js::CloneScript(JSContext *cx, HandleObject enclosingScope, HandleFunction fun,
|
|||
dst->hasSingletons = src->hasSingletons;
|
||||
dst->isGenerator = src->isGenerator;
|
||||
dst->isGeneratorExp = src->isGeneratorExp;
|
||||
dst->userBit = src->userBit;
|
||||
|
||||
/*
|
||||
* initScriptCounts updates scriptCountsMap if necessary. The other script
|
||||
|
|
Загрузка…
Ссылка в новой задаче