mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 05:41:12 +00:00
Bug 650161 - Allow JS_GetScriptFilename() to work while we are compacting r=terrence
This commit is contained in:
parent
43b5e6a717
commit
40ba5d1f27
@ -1176,6 +1176,11 @@ JSScript::scriptSource() const {
|
||||
return scriptSourceUnwrap().source();
|
||||
}
|
||||
|
||||
js::ScriptSource *
|
||||
JSScript::maybeForwardedScriptSource() const {
|
||||
return UncheckedUnwrap(MaybeForwarded(sourceObject()))->as<ScriptSourceObject>().source();
|
||||
}
|
||||
|
||||
bool
|
||||
JSScript::initScriptCounts(JSContext *cx)
|
||||
{
|
||||
|
@ -1410,8 +1410,10 @@ class JSScript : public js::gc::TenuredCell
|
||||
}
|
||||
js::ScriptSourceObject &scriptSourceUnwrap() const;
|
||||
js::ScriptSource *scriptSource() const;
|
||||
js::ScriptSource *maybeForwardedScriptSource() const;
|
||||
bool mutedErrors() const { return scriptSource()->mutedErrors(); }
|
||||
const char *filename() const { return scriptSource()->filename(); }
|
||||
const char *maybeForwardedFilename() const { return maybeForwardedScriptSource()->filename(); }
|
||||
|
||||
public:
|
||||
|
||||
|
@ -129,7 +129,10 @@ JS_GetFunctionScript(JSContext *cx, HandleFunction fun)
|
||||
JS_PUBLIC_API(const char *)
|
||||
JS_GetScriptFilename(JSScript *script)
|
||||
{
|
||||
return script->filename();
|
||||
// This is called from ThreadStackHelper which can be called from another
|
||||
// thread or inside a signal hander, so we need to be careful in case a
|
||||
// copmacting GC is currently moving things around.
|
||||
return script->maybeForwardedFilename();
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(const char16_t *)
|
||||
|
Loading…
Reference in New Issue
Block a user