Skip to content

Commit

Permalink
Bug 1619177 - Remove remaining extra warnings code. r=tcampbell,mccr8
Browse files Browse the repository at this point in the history
Differential Revision: https://phabricator.services.mozilla.com/D65830

--HG--
extra : moz-landing-system : lando
  • Loading branch information
evilpie committed Mar 10, 2020
1 parent 4697311 commit 3946b3e
Show file tree
Hide file tree
Showing 16 changed files with 5 additions and 70 deletions.
1 change: 0 additions & 1 deletion build/win32/orderfile.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2096,7 +2096,6 @@ nsUnescapeCount
?InitClassesWithNewWrappedGlobal@xpc@@YA?AW4nsresult@@PAUJSContext@@PAVnsISupports@@PAVnsIPrincipal@@IAAVRealmOptions@JS@@V?$MutableHandle@PAVJSObject@@@7@@Z
?InitGlobalObjectOptions@xpc@@YAXAAVRealmOptions@JS@@PAVnsIPrincipal@@@Z
?ShouldDiscardSystemSource@xpc@@YA_NXZ
?ExtraWarningsForSystemJS@xpc@@YA_NXZ
?IsSystemPrincipal@nsContentUtils@@SA_NPAVnsIPrincipal@@@Z
?QueryInterface@BackstagePass@@UAG?AW4nsresult@@ABUnsID@@PAPAX@Z
?WrapNewGlobal@XPCWrappedNative@@SA?AW4nsresult@@PAUJSContext@@AAVxpcObjectHelper@@PAVnsIPrincipal@@_NAAVRealmOptions@JS@@PAPAV1@@Z
Expand Down
1 change: 0 additions & 1 deletion build/win64/orderfile.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2074,7 +2074,6 @@ nsUnescapeCount
?InitClassesWithNewWrappedGlobal@xpc@@YA?AW4nsresult@@PEAUJSContext@@PEAVnsISupports@@PEAVnsIPrincipal@@IAEAVRealmOptions@JS@@V?$MutableHandle@PEAVJSObject@@@7@@Z
?InitGlobalObjectOptions@xpc@@YAXAEAVRealmOptions@JS@@PEAVnsIPrincipal@@@Z
?ShouldDiscardSystemSource@xpc@@YA_NXZ
?ExtraWarningsForSystemJS@xpc@@YA_NXZ
?IsSystemPrincipal@nsContentUtils@@SA_NPEAVnsIPrincipal@@@Z
?QueryInterface@BackstagePass@@UEAA?AW4nsresult@@AEBUnsID@@PEAPEAX@Z
?WrapNewGlobal@XPCWrappedNative@@SA?AW4nsresult@@PEAUJSContext@@AEAVxpcObjectHelper@@PEAVnsIPrincipal@@_NAEAVRealmOptions@JS@@PEAPEAV1@@Z
Expand Down
3 changes: 1 addition & 2 deletions dom/workers/RuntimeService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -291,11 +291,10 @@ void LoadContextOptions(const char* aPrefName, void* /* aClosure */) {
.setThrowOnAsmJSValidationFailure(GetWorkerPref<bool>(
NS_LITERAL_CSTRING("throw_on_asmjs_validation_failure")))
.setAsyncStack(GetWorkerPref<bool>(NS_LITERAL_CSTRING("asyncstack")))
.setWerror(GetWorkerPref<bool>(NS_LITERAL_CSTRING("werror")))
#ifdef FUZZING
.setFuzzing(GetWorkerPref<bool>(NS_LITERAL_CSTRING("fuzzing.enabled")))
#endif
.setExtraWarnings(GetWorkerPref<bool>(NS_LITERAL_CSTRING("strict")));
.setWerror(GetWorkerPref<bool>(NS_LITERAL_CSTRING("werror")));

nsCOMPtr<nsIXULRuntime> xr = do_GetService("@mozilla.org/xre/runtime;1");
if (xr) {
Expand Down
11 changes: 3 additions & 8 deletions dom/workers/WorkerScope.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -612,18 +612,13 @@ bool DedicatedWorkerGlobalScope::WrapGlobalObject(

const bool usesSystemPrincipal = mWorkerPrivate->UsesSystemPrincipal();

// Note that xpc::ShouldDiscardSystemSource() and
// xpc::ExtraWarningsForSystemJS() read prefs that are cached on the main
// thread. This is benignly racey.
// Note that xpc::ShouldDiscardSystemSource() reads a prefs that is cached
// on the main thread. This is benignly racey.
const bool discardSource =
usesSystemPrincipal && xpc::ShouldDiscardSystemSource();
const bool extraWarnings =
usesSystemPrincipal && xpc::ExtraWarningsForSystemJS();

JS::RealmBehaviors& behaviors = options.behaviors();
behaviors.setDiscardSource(discardSource)
.extraWarningsOverride()
.set(extraWarnings);
behaviors.setDiscardSource(discardSource);

xpc::SetPrefableRealmOptions(options);

Expand Down
1 change: 0 additions & 1 deletion js/public/CompileOptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@ class JS_PUBLIC_API TransitiveCompileOptions {
public:
// POD options.
bool selfHostingMode = false;
bool extraWarningsOption = false;
bool werrorOption = false;
AsmJSOption asmJSOption = AsmJSOption::Disabled;
bool throwOnAsmJSValidationFailureOption = false;
Expand Down
12 changes: 0 additions & 12 deletions js/public/ContextOptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ class JS_PUBLIC_API ContextOptions {
dumpStackOnDebuggeeWouldRun_(false),
werror_(false),
strictMode_(false),
extraWarnings_(false),
#ifdef JS_ENABLE_SMOOSH
trySmoosh_(false),
#endif
Expand Down Expand Up @@ -180,16 +179,6 @@ class JS_PUBLIC_API ContextOptions {
return *this;
}

bool extraWarnings() const { return extraWarnings_; }
ContextOptions& setExtraWarnings(bool flag) {
extraWarnings_ = flag;
return *this;
}
ContextOptions& toggleExtraWarnings() {
extraWarnings_ = !extraWarnings_;
return *this;
}

#ifdef JS_ENABLE_SMOOSH
// Try compiling SmooshMonkey frontend first, and fallback to C++
// implementation when it fails.
Expand Down Expand Up @@ -233,7 +222,6 @@ class JS_PUBLIC_API ContextOptions {
bool dumpStackOnDebuggeeWouldRun_ : 1;
bool werror_ : 1;
bool strictMode_ : 1;
bool extraWarnings_ : 1;
#ifdef JS_ENABLE_SMOOSH
bool trySmoosh_ : 1;
#endif
Expand Down
4 changes: 0 additions & 4 deletions js/public/RealmOptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -279,9 +279,6 @@ class JS_PUBLIC_API RealmBehaviors {
Mode mode_;
};

bool extraWarnings(JSContext* cx) const;
Override& extraWarningsOverride() { return extraWarningsOverride_; }

bool getSingletonsAsTemplates() const { return singletonsAsTemplates_; }
RealmBehaviors& setSingletonsAsValues() {
singletonsAsTemplates_ = false;
Expand All @@ -301,7 +298,6 @@ class JS_PUBLIC_API RealmBehaviors {
bool discardSource_ = false;
bool disableLazyParsing_ = false;
bool clampAndJitterTime_ = true;
Override extraWarningsOverride_ = {};

// To XDR singletons, we need to ensure that all singletons are all used as
// templates, by making JSOP_OBJECT return a clone of the JSScript
Expand Down
6 changes: 0 additions & 6 deletions js/src/jsapi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1700,10 +1700,6 @@ JS_PUBLIC_API JSObject* JS_GetConstructor(JSContext* cx, HandleObject proto) {
return &cval.toObject();
}

bool JS::RealmBehaviors::extraWarnings(JSContext* cx) const {
return extraWarningsOverride_.get(cx->options().extraWarnings());
}

JS::RealmCreationOptions&
JS::RealmCreationOptions::setNewCompartmentInSystemZone() {
compSpec_ = CompartmentSpecifier::NewCompartmentInSystemZone;
Expand Down Expand Up @@ -3439,7 +3435,6 @@ void JS::TransitiveCompileOptions::copyPODTransitiveOptions(
forceFullParse_ = rhs.forceFullParse_;
forceStrictMode_ = rhs.forceStrictMode_;
selfHostingMode = rhs.selfHostingMode;
extraWarningsOption = rhs.extraWarningsOption;
werrorOption = rhs.werrorOption;
asmJSOption = rhs.asmJSOption;
throwOnAsmJSValidationFailureOption = rhs.throwOnAsmJSValidationFailureOption;
Expand Down Expand Up @@ -3534,7 +3529,6 @@ JS::CompileOptions::CompileOptions(JSContext* cx)
elementAttributeNameRoot(cx),
introductionScriptRoot(cx),
scriptOrModuleRoot(cx) {
extraWarningsOption = cx->realm()->behaviors().extraWarnings(cx);
discardSource = cx->realm()->behaviors().discardSource();
werrorOption = cx->options().werror();
if (!cx->options().asmJS()) {
Expand Down
1 change: 0 additions & 1 deletion js/src/tests/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ user_pref("browser.cache.check_doc_frequency", 1);
user_pref("extensions.checkCompatibility", false);
user_pref("extensions.checkUpdateSecurity", false);
user_pref("browser.EULA.override", true);
user_pref("javascript.options.strict", false);
user_pref("javascript.options.werror", false);
user_pref("toolkit.startup.max_resumed_crashes", -1);
user_pref("security.turn_off_all_security_so_that_viruses_can_take_over_this_computer", true);
Expand Down
1 change: 0 additions & 1 deletion js/src/vm/SelfHosting.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2557,7 +2557,6 @@ void js::FillSelfHostingCompileOptions(CompileOptions& options) {
options.setSelfHostingMode(true);
options.setForceFullParse();
options.werrorOption = true;
options.extraWarningsOption = true;
options.setForceStrictMode();
}

Expand Down
3 changes: 0 additions & 3 deletions js/xpconnect/idl/xpccomponents.idl
Original file line number Diff line number Diff line change
Expand Up @@ -511,9 +511,6 @@ interface nsIXPCComponents_Utils : nsISupports
* NB: Assume that getting any of these attributes is relatively
* cheap, but setting any of them is relatively expensive.
*/
[implicit_jscontext]
attribute boolean strict;

[implicit_jscontext]
attribute boolean werror;

Expand Down
1 change: 0 additions & 1 deletion js/xpconnect/src/XPCComponents.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2096,7 +2096,6 @@ nsXPCComponents_Utils::Dispatch(HandleValue runnableArg, HandleValue scope,
return NS_OK; \
}

GENERATE_JSCONTEXTOPTION_GETTER_SETTER(Strict, extraWarnings, setExtraWarnings)
GENERATE_JSCONTEXTOPTION_GETTER_SETTER(Werror, werror, setWerror)
GENERATE_JSCONTEXTOPTION_GETTER_SETTER(Strict_mode, strictMode, setStrictMode)

Expand Down
17 changes: 1 addition & 16 deletions js/xpconnect/src/XPCJSContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -736,13 +736,6 @@ static mozilla::Atomic<bool> sDiscardSystemSource(false);

bool xpc::ShouldDiscardSystemSource() { return sDiscardSystemSource; }

#ifdef DEBUG
static mozilla::Atomic<bool> sExtraWarningsForSystemJS(false);
bool xpc::ExtraWarningsForSystemJS() { return sExtraWarningsForSystemJS; }
#else
bool xpc::ExtraWarningsForSystemJS() { return false; }
#endif

static mozilla::Atomic<bool> sSharedMemoryEnabled(false);
static mozilla::Atomic<bool> sStreamsEnabled(false);

Expand Down Expand Up @@ -920,8 +913,6 @@ static void ReloadPrefsCallback(const char* pref, void* aXpccx) {

bool werror = Preferences::GetBool(JS_OPTIONS_DOT_STR "werror");

bool extraWarnings = Preferences::GetBool(JS_OPTIONS_DOT_STR "strict");

sSharedMemoryEnabled =
Preferences::GetBool(JS_OPTIONS_DOT_STR "shared_memory");
sStreamsEnabled = Preferences::GetBool(JS_OPTIONS_DOT_STR "streams");
Expand All @@ -932,11 +923,6 @@ static void ReloadPrefsCallback(const char* pref, void* aXpccx) {
Preferences::GetBool(JS_OPTIONS_DOT_STR "experimental.weakrefs");
#endif

#ifdef DEBUG
sExtraWarningsForSystemJS =
Preferences::GetBool(JS_OPTIONS_DOT_STR "strict.debug");
#endif

#ifdef JS_GC_ZEAL
int32_t zeal = Preferences::GetInt(JS_OPTIONS_DOT_STR "gczeal", -1);
int32_t zeal_frequency = Preferences::GetInt(
Expand Down Expand Up @@ -967,11 +953,10 @@ static void ReloadPrefsCallback(const char* pref, void* aXpccx) {
.setAsyncStack(useAsyncStack)
.setThrowOnDebuggeeWouldRun(throwOnDebuggeeWouldRun)
.setDumpStackOnDebuggeeWouldRun(dumpStackOnDebuggeeWouldRun)
.setWerror(werror)
#ifdef FUZZING
.setFuzzing(fuzzingEnabled)
#endif
.setExtraWarnings(extraWarnings);
.setWerror(werror);

nsCOMPtr<nsIXULRuntime> xr = do_GetService("@mozilla.org/xre/runtime;1");
if (xr) {
Expand Down
7 changes: 0 additions & 7 deletions js/xpconnect/src/nsXPConnect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,6 @@ JSObject* CreateGlobalObject(JSContext* cx, const JSClass* clasp,
void InitGlobalObjectOptions(JS::RealmOptions& aOptions,
nsIPrincipal* aPrincipal) {
bool shouldDiscardSystemSource = ShouldDiscardSystemSource();
bool extraWarningsForSystemJS = ExtraWarningsForSystemJS();

bool isSystem = aPrincipal->IsSystemPrincipal();

Expand All @@ -501,12 +500,6 @@ void InitGlobalObjectOptions(JS::RealmOptions& aOptions,

aOptions.behaviors().setDiscardSource(discardSource);
}

if (extraWarningsForSystemJS) {
if (isSystem) {
aOptions.behaviors().extraWarningsOverride().set(true);
}
}
}

bool InitGlobalObject(JSContext* aJSContext, JS::Handle<JSObject*> aGlobal,
Expand Down
2 changes: 0 additions & 2 deletions js/xpconnect/src/xpcpublic.h
Original file line number Diff line number Diff line change
Expand Up @@ -543,8 +543,6 @@ bool ShouldDiscardSystemSource();

void SetPrefableRealmOptions(JS::RealmOptions& options);

bool ExtraWarningsForSystemJS();

class ErrorBase {
public:
nsString mErrorMsg;
Expand Down
4 changes: 0 additions & 4 deletions modules/libpref/init/all.js
Original file line number Diff line number Diff line change
Expand Up @@ -1091,10 +1091,6 @@ pref("dom.event.contextmenu.enabled", true);
pref("dom.event.coalesce_mouse_move", true);

pref("javascript.enabled", true);
pref("javascript.options.strict", false);
#ifdef DEBUG
pref("javascript.options.strict.debug", false);
#endif
pref("javascript.options.blinterp", true);
// Duplicated in JitOptions - ensure both match.
pref("javascript.options.blinterp.threshold", 10);
Expand Down

0 comments on commit 3946b3e

Please sign in to comment.