mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 940316 - Move werror to RuntimeOptions. r=jandem
This commit is contained in:
parent
c46d13fd4d
commit
29eccabc87
@ -715,7 +715,6 @@ static const char js_strict_option_str[] = JS_OPTIONS_DOT_STR "strict";
|
||||
#ifdef DEBUG
|
||||
static const char js_strict_debug_option_str[] = JS_OPTIONS_DOT_STR "strict.debug";
|
||||
#endif
|
||||
static const char js_werror_option_str[] = JS_OPTIONS_DOT_STR "werror";
|
||||
#ifdef JS_GC_ZEAL
|
||||
static const char js_zeal_option_str[] = JS_OPTIONS_DOT_STR "gczeal";
|
||||
static const char js_zeal_frequency_str[] = JS_OPTIONS_DOT_STR "gczeal.frequency";
|
||||
@ -753,8 +752,6 @@ nsJSContext::JSOptionChangedCallback(const char *pref, void *data)
|
||||
}
|
||||
#endif
|
||||
|
||||
JS::ContextOptionsRef(cx).setWerror(Preferences::GetBool(js_werror_option_str));
|
||||
|
||||
#ifdef JS_GC_ZEAL
|
||||
int32_t zeal = Preferences::GetInt(js_zeal_option_str, -1);
|
||||
int32_t frequency = Preferences::GetInt(js_zeal_frequency_str, JS_DEFAULT_ZEAL_FREQ);
|
||||
|
@ -357,15 +357,15 @@ LoadRuntimeAndContextOptions(const char* aPrefName, void* /* aClosure */)
|
||||
if (GetWorkerPref<bool>(NS_LITERAL_CSTRING("native_regexp"))) {
|
||||
runtimeOptions.setNativeRegExp(true);
|
||||
}
|
||||
if (GetWorkerPref<bool>(NS_LITERAL_CSTRING("werror"))) {
|
||||
runtimeOptions.setWerror(true);
|
||||
}
|
||||
|
||||
// Common options.
|
||||
JS::ContextOptions commonContextOptions = kRequiredContextOptions;
|
||||
if (GetWorkerPref<bool>(NS_LITERAL_CSTRING("strict"))) {
|
||||
commonContextOptions.setExtraWarnings(true);
|
||||
}
|
||||
if (GetWorkerPref<bool>(NS_LITERAL_CSTRING("werror"))) {
|
||||
commonContextOptions.setWerror(true);
|
||||
}
|
||||
|
||||
// Content options.
|
||||
JS::ContextOptions contentContextOptions = commonContextOptions;
|
||||
|
@ -4481,7 +4481,7 @@ JS::CompileOptions::CompileOptions(JSContext *cx, JSVersion version)
|
||||
noScriptRval = cx->options().noScriptRval();
|
||||
strictOption = cx->options().strictMode();
|
||||
extraWarningsOption = cx->options().extraWarnings();
|
||||
werrorOption = cx->options().werror();
|
||||
werrorOption = cx->runtime()->options().werror();
|
||||
asmJSOption = cx->runtime()->options().asmJS();
|
||||
}
|
||||
|
||||
|
@ -1422,7 +1422,8 @@ class JS_PUBLIC_API(RuntimeOptions) {
|
||||
: baseline_(false),
|
||||
ion_(false),
|
||||
asmJS_(false),
|
||||
nativeRegExp_(false)
|
||||
nativeRegExp_(false),
|
||||
werror_(false)
|
||||
{
|
||||
}
|
||||
|
||||
@ -1462,11 +1463,22 @@ class JS_PUBLIC_API(RuntimeOptions) {
|
||||
return *this;
|
||||
}
|
||||
|
||||
bool werror() const { return werror_; }
|
||||
RuntimeOptions &setWerror(bool flag) {
|
||||
werror_ = flag;
|
||||
return *this;
|
||||
}
|
||||
RuntimeOptions &toggleWerror() {
|
||||
werror_ = !werror_;
|
||||
return *this;
|
||||
}
|
||||
|
||||
private:
|
||||
bool baseline_ : 1;
|
||||
bool ion_ : 1;
|
||||
bool asmJS_ : 1;
|
||||
bool nativeRegExp_ : 1;
|
||||
bool werror_ : 1;
|
||||
};
|
||||
|
||||
JS_PUBLIC_API(RuntimeOptions &)
|
||||
@ -1479,7 +1491,6 @@ class JS_PUBLIC_API(ContextOptions) {
|
||||
public:
|
||||
ContextOptions()
|
||||
: extraWarnings_(false),
|
||||
werror_(false),
|
||||
varObjFix_(false),
|
||||
privateIsNSISupports_(false),
|
||||
dontReportUncaught_(false),
|
||||
@ -1500,16 +1511,6 @@ class JS_PUBLIC_API(ContextOptions) {
|
||||
return *this;
|
||||
}
|
||||
|
||||
bool werror() const { return werror_; }
|
||||
ContextOptions &setWerror(bool flag) {
|
||||
werror_ = flag;
|
||||
return *this;
|
||||
}
|
||||
ContextOptions &toggleWerror() {
|
||||
werror_ = !werror_;
|
||||
return *this;
|
||||
}
|
||||
|
||||
bool varObjFix() const { return varObjFix_; }
|
||||
ContextOptions &setVarObjFix(bool flag) {
|
||||
varObjFix_ = flag;
|
||||
@ -1582,7 +1583,6 @@ class JS_PUBLIC_API(ContextOptions) {
|
||||
|
||||
private:
|
||||
bool extraWarnings_ : 1;
|
||||
bool werror_ : 1;
|
||||
bool varObjFix_ : 1;
|
||||
bool privateIsNSISupports_ : 1;
|
||||
bool dontReportUncaught_ : 1;
|
||||
|
@ -496,7 +496,7 @@ checkReportFlags(JSContext *cx, unsigned *flags)
|
||||
}
|
||||
|
||||
/* Warnings become errors when JSOPTION_WERROR is set. */
|
||||
if (JSREPORT_IS_WARNING(*flags) && cx->options().werror())
|
||||
if (JSREPORT_IS_WARNING(*flags) && cx->runtime()->options().werror())
|
||||
*flags &= ~JSREPORT_WARNING;
|
||||
|
||||
return false;
|
||||
|
@ -4625,7 +4625,7 @@ GetPropertyHelperInline(JSContext *cx,
|
||||
|
||||
/*
|
||||
* Don't warn in self-hosted code (where the further presence of
|
||||
* JS::ContextOptions::werror() would result in impossible-to-avoid
|
||||
* JS::RuntimeOptions::werror() would result in impossible-to-avoid
|
||||
* errors to entirely-innocent client code).
|
||||
*/
|
||||
if (script->selfHosted())
|
||||
|
@ -774,6 +774,7 @@ Options(JSContext *cx, unsigned argc, jsval *vp)
|
||||
CallArgs args = CallArgsFromVp(argc, vp);
|
||||
|
||||
JS::ContextOptions oldContextOptions = JS::ContextOptionsRef(cx);
|
||||
JS::RuntimeOptions oldRuntimeOptions = JS::RuntimeOptionsRef(cx);
|
||||
for (unsigned i = 0; i < args.length(); i++) {
|
||||
JSString *str = JS::ToString(cx, args[i]);
|
||||
if (!str)
|
||||
@ -787,7 +788,7 @@ Options(JSContext *cx, unsigned argc, jsval *vp)
|
||||
if (strcmp(opt.ptr(), "strict") == 0)
|
||||
JS::ContextOptionsRef(cx).toggleExtraWarnings();
|
||||
else if (strcmp(opt.ptr(), "werror") == 0)
|
||||
JS::ContextOptionsRef(cx).toggleWerror();
|
||||
JS::RuntimeOptionsRef(cx).toggleWerror();
|
||||
else if (strcmp(opt.ptr(), "strict_mode") == 0)
|
||||
JS::ContextOptionsRef(cx).toggleStrictMode();
|
||||
else {
|
||||
@ -806,7 +807,7 @@ Options(JSContext *cx, unsigned argc, jsval *vp)
|
||||
names = JS_sprintf_append(names, "%s%s", found ? "," : "", "strict");
|
||||
found = true;
|
||||
}
|
||||
if (names && oldContextOptions.werror()) {
|
||||
if (names && oldRuntimeOptions.werror()) {
|
||||
names = JS_sprintf_append(names, "%s%s", found ? "," : "", "werror");
|
||||
found = true;
|
||||
}
|
||||
|
@ -3243,7 +3243,7 @@ nsXPCComponents_Utils::Dispatch(HandleValue runnableArg, HandleValue scope,
|
||||
}
|
||||
|
||||
GENERATE_JSCONTEXTOPTION_GETTER_SETTER(Strict, extraWarnings, setExtraWarnings)
|
||||
GENERATE_JSCONTEXTOPTION_GETTER_SETTER(Werror, werror, setWerror)
|
||||
GENERATE_JSRUNTIMEOPTION_GETTER_SETTER(Werror, werror, setWerror)
|
||||
GENERATE_JSCONTEXTOPTION_GETTER_SETTER(Strict_mode, strictMode, setStrictMode)
|
||||
GENERATE_JSRUNTIMEOPTION_GETTER_SETTER(Ion, ion, setIon)
|
||||
|
||||
|
@ -1566,10 +1566,13 @@ ReloadPrefsCallback(const char *pref, void *data)
|
||||
|
||||
sDiscardSystemSource = Preferences::GetBool(JS_OPTIONS_DOT_STR "discardSystemSource");
|
||||
|
||||
bool werror = Preferences::GetBool(JS_OPTIONS_DOT_STR "werror");
|
||||
|
||||
JS::RuntimeOptionsRef(rt).setBaseline(useBaseline)
|
||||
.setIon(useIon)
|
||||
.setAsmJS(useAsmJS)
|
||||
.setNativeRegExp(useNativeRegExp);
|
||||
.setNativeRegExp(useNativeRegExp)
|
||||
.setWerror(werror);
|
||||
|
||||
JS_SetParallelParsingEnabled(rt, parallelParsing);
|
||||
JS_SetOffthreadIonCompilationEnabled(rt, offthreadIonCompilation);
|
||||
|
@ -478,7 +478,8 @@ static bool
|
||||
Options(JSContext *cx, unsigned argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = CallArgsFromVp(argc, vp);
|
||||
ContextOptions oldOptions = ContextOptionsRef(cx);
|
||||
ContextOptions oldContextOptions = ContextOptionsRef(cx);
|
||||
RuntimeOptions oldRuntimeOptions = RuntimeOptionsRef(cx);
|
||||
|
||||
for (unsigned i = 0; i < args.length(); ++i) {
|
||||
JSString *str = ToString(cx, args[i]);
|
||||
@ -492,7 +493,7 @@ Options(JSContext *cx, unsigned argc, jsval *vp)
|
||||
if (strcmp(opt.ptr(), "strict") == 0)
|
||||
ContextOptionsRef(cx).toggleExtraWarnings();
|
||||
else if (strcmp(opt.ptr(), "werror") == 0)
|
||||
ContextOptionsRef(cx).toggleWerror();
|
||||
RuntimeOptionsRef(cx).toggleWerror();
|
||||
else if (strcmp(opt.ptr(), "strict_mode") == 0)
|
||||
ContextOptionsRef(cx).toggleStrictMode();
|
||||
else {
|
||||
@ -503,21 +504,21 @@ Options(JSContext *cx, unsigned argc, jsval *vp)
|
||||
}
|
||||
|
||||
char *names = nullptr;
|
||||
if (oldOptions.extraWarnings()) {
|
||||
if (oldContextOptions.extraWarnings()) {
|
||||
names = JS_sprintf_append(names, "%s", "strict");
|
||||
if (!names) {
|
||||
JS_ReportOutOfMemory(cx);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (oldOptions.werror()) {
|
||||
if (oldRuntimeOptions.werror()) {
|
||||
names = JS_sprintf_append(names, "%s%s", names ? "," : "", "werror");
|
||||
if (!names) {
|
||||
JS_ReportOutOfMemory(cx);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (names && oldOptions.strictMode()) {
|
||||
if (names && oldContextOptions.strictMode()) {
|
||||
names = JS_sprintf_append(names, "%s%s", names ? "," : "", "strict_mode");
|
||||
if (!names) {
|
||||
JS_ReportOutOfMemory(cx);
|
||||
@ -1031,7 +1032,7 @@ ProcessArgsForCompartment(JSContext *cx, char **argv, int argc)
|
||||
return;
|
||||
break;
|
||||
case 'S':
|
||||
ContextOptionsRef(cx).toggleWerror();
|
||||
RuntimeOptionsRef(cx).toggleWerror();
|
||||
case 's':
|
||||
ContextOptionsRef(cx).toggleExtraWarnings();
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user