Bug 803358 - Remove JSOPTION_RELIMIT. r=luke
authorBenjamin Peterson <benjamin@python.org>
Thu, 18 Oct 2012 21:06:42 -0400
changeset 110863 1c8e7d36bb7eeb2c86377a3c51613c76bf32458f
parent 110862 77955056943220c805fd52372289eb0a1af7d27c
child 110864 6b6b9bf38ed2a573b6f3ccdc08d36f6c6920498a
push id93
push usernmatsakis@mozilla.com
push dateWed, 31 Oct 2012 21:26:57 +0000
reviewersluke
bugs803358
milestone19.0a1
Bug 803358 - Remove JSOPTION_RELIMIT. r=luke
dom/base/nsJSEnvironment.cpp
dom/workers/RuntimeService.cpp
js/src/jsapi.h
js/src/shell/js.cpp
js/src/tests/browser.js
js/src/tests/js1_5/extensions/regress-330569.js
js/src/tests/js1_5/extensions/regress-351448.js
js/xpconnect/idl/xpccomponents.idl
js/xpconnect/shell/xpcshell.cpp
js/xpconnect/src/XPCComponents.cpp
modules/libpref/src/init/all.js
--- a/dom/base/nsJSEnvironment.cpp
+++ b/dom/base/nsJSEnvironment.cpp
@@ -928,17 +928,16 @@ nsJSContext::LeaveModalState()
 #define JS_OPTIONS_DOT_STR "javascript.options."
 
 static const char js_options_dot_str[]   = JS_OPTIONS_DOT_STR;
 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";
-static const char js_relimit_option_str[]= JS_OPTIONS_DOT_STR "relimit";
 #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";
 #endif
 static const char js_methodjit_content_str[]  = JS_OPTIONS_DOT_STR "methodjit.content";
 static const char js_methodjit_chrome_str[]   = JS_OPTIONS_DOT_STR "methodjit.chrome";
 static const char js_methodjit_always_str[]   = JS_OPTIONS_DOT_STR "methodjit_always";
 static const char js_typeinfer_str[]          = JS_OPTIONS_DOT_STR "typeinference";
@@ -1048,22 +1047,16 @@ nsJSContext::JSOptionChangedCallback(con
 #endif
 
   bool werror = Preferences::GetBool(js_werror_option_str);
   if (werror)
     newDefaultJSOptions |= JSOPTION_WERROR;
   else
     newDefaultJSOptions &= ~JSOPTION_WERROR;
 
-  bool relimit = Preferences::GetBool(js_relimit_option_str);
-  if (relimit)
-    newDefaultJSOptions |= JSOPTION_RELIMIT;
-  else
-    newDefaultJSOptions &= ~JSOPTION_RELIMIT;
-
   ::JS_SetOptions(context->mContext,
                   newDefaultJSOptions & (JSRUNOPTION_MASK | JSOPTION_ALLOW_XML));
 
   // Save the new defaults for the next page load (InitContext).
   context->mDefaultJSOptions = newDefaultJSOptions;
 
   JSRuntime *rt = JS_GetRuntime(context->mContext);
   JS_SetJitHardening(rt, useHardening);
--- a/dom/workers/RuntimeService.cpp
+++ b/dom/workers/RuntimeService.cpp
@@ -137,17 +137,16 @@ const char* gStringChars[] = {
 };
 
 MOZ_STATIC_ASSERT(NS_ARRAY_LENGTH(gStringChars) == ID_COUNT,
                   "gStringChars should have the right length.");
 
 enum {
   PREF_strict = 0,
   PREF_werror,
-  PREF_relimit,
   PREF_methodjit,
   PREF_methodjit_always,
   PREF_typeinference,
   PREF_allow_xml,
   PREF_jit_hardening,
   PREF_mem_max,
   PREF_ion,
 
@@ -158,17 +157,16 @@ enum {
   PREF_COUNT
 };
 
 #define JS_OPTIONS_DOT_STR "javascript.options."
 
 const char* gPrefsToWatch[] = {
   JS_OPTIONS_DOT_STR "strict",
   JS_OPTIONS_DOT_STR "werror",
-  JS_OPTIONS_DOT_STR "relimit",
   JS_OPTIONS_DOT_STR "methodjit.content",
   JS_OPTIONS_DOT_STR "methodjit_always",
   JS_OPTIONS_DOT_STR "typeinference",
   JS_OPTIONS_DOT_STR "allow_xml",
   JS_OPTIONS_DOT_STR "jit_hardening",
   JS_OPTIONS_DOT_STR "mem.max",
   JS_OPTIONS_DOT_STR "ion.content"
 
@@ -201,19 +199,16 @@ PrefCallback(const char* aPrefName, void
   else if (StringBeginsWith(nsDependentCString(aPrefName), jsOptionStr)) {
     uint32_t newOptions = kRequiredJSContextOptions;
     if (Preferences::GetBool(gPrefsToWatch[PREF_strict])) {
       newOptions |= JSOPTION_STRICT;
     }
     if (Preferences::GetBool(gPrefsToWatch[PREF_werror])) {
       newOptions |= JSOPTION_WERROR;
     }
-    if (Preferences::GetBool(gPrefsToWatch[PREF_relimit])) {
-      newOptions |= JSOPTION_RELIMIT;
-    }
     if (Preferences::GetBool(gPrefsToWatch[PREF_methodjit])) {
       newOptions |= JSOPTION_METHODJIT;
     }
     if (Preferences::GetBool(gPrefsToWatch[PREF_methodjit_always])) {
       newOptions |= JSOPTION_METHODJIT_ALWAYS;
     }
     if (Preferences::GetBool(gPrefsToWatch[PREF_typeinference])) {
       newOptions |= JSOPTION_TYPE_INFERENCE;
--- a/js/src/jsapi.h
+++ b/js/src/jsapi.h
@@ -3123,21 +3123,18 @@ JS_StringToVersion(const char *string);
                                                    in HTML script tags. */
 #define JSOPTION_DONT_REPORT_UNCAUGHT                                   \
                                 JS_BIT(8)       /* When returning from the
                                                    outermost API call, prevent
                                                    uncaught exceptions from
                                                    being converted to error
                                                    reports */
 
-#define JSOPTION_RELIMIT        JS_BIT(9)       /* Throw exception on any
-                                                   regular expression which
-                                                   backtracks more than n^3
-                                                   times, where n is length
-                                                   of the input string */
+/* JS_BIT(9) is currently unused. */
+
 /* JS_BIT(10) is currently unused. */
 
 /* JS_BIT(11) is currently unused. */
 
 #define JSOPTION_NO_SCRIPT_RVAL JS_BIT(12)      /* A promise to the compiler
                                                    that a null rval out-param
                                                    will be passed to each call
                                                    to JS_ExecuteScript. */
--- a/js/src/shell/js.cpp
+++ b/js/src/shell/js.cpp
@@ -568,17 +568,16 @@ cleanup:
  */
 static const struct JSOption {
     const char  *name;
     uint32_t    flag;
 } js_options[] = {
     {"atline",          JSOPTION_ATLINE},
     {"methodjit",       JSOPTION_METHODJIT},
     {"methodjit_always",JSOPTION_METHODJIT_ALWAYS},
-    {"relimit",         JSOPTION_RELIMIT},
     {"strict",          JSOPTION_STRICT},
     {"typeinfer",       JSOPTION_TYPE_INFERENCE},
     {"werror",          JSOPTION_WERROR},
     {"allow_xml",       JSOPTION_ALLOW_XML},
     {"moar_xml",        JSOPTION_MOAR_XML},
     {"strict_mode",     JSOPTION_STRICT_MODE},
 };
 
--- a/js/src/tests/browser.js
+++ b/js/src/tests/browser.js
@@ -189,17 +189,16 @@ function options(aOptionName)
 function optionsInit() {
 
   // hash containing the set options.
   options.currvalues = {
     strict:     true,
     werror:     true,
     atline:     true,
     moar_xml:   true,
-    relimit:    true,
     methodjit:  true,
     methodjit_always: true,
     strict_mode: true
   };
 
   // record initial values to support resetting
   // options to their initial values
   options.initvalues = {};
--- a/js/src/tests/js1_5/extensions/regress-330569.js
+++ b/js/src/tests/js1_5/extensions/regress-330569.js
@@ -36,20 +36,16 @@ function test()
     '<script language="JavaScript">\n' +
     'var s = document. body. innerHTML;\n' +
     'var d = s. replace (/<!--(.*|\n)*-->/, "");\n' +
     'alert (d);\n' +
     '</script>\n' +
     '</body>\n' +
     '</html>\n';
 
-  if (!options().match(/relimit/)) {
-    options('relimit');
-  }
-
   try
   {
     /<!--(.*|\n)*-->/.exec(s);
   }
   catch(ex)
   {
     actual = ex + '';
   }
--- a/js/src/tests/js1_5/extensions/regress-351448.js
+++ b/js/src/tests/js1_5/extensions/regress-351448.js
@@ -40,20 +40,16 @@ function test()
     "/.[X](.+)+[X][X]/.exec('bbbbXXXaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')",
     "/.[X](.+)+[X][X]/.exec('bbbbXcXXaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')",
     "/.[X][X](.+)+[X]/.exec('bbbbXXXaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')",
     "/.[X][X](.+)+[X]/.exec('bbbbXXcXaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')"
     ];
 
   expect = 'InternalError: regular expression too complex';
 
-  if (!options().match(/relimit/)) {
-    options('relimit');
-  }
-
   for (var i = 0; i < strings.length; i++)
   {
     try
     {
       eval(strings[i]);
     }
     catch(ex)
     {
--- a/js/xpconnect/idl/xpccomponents.idl
+++ b/js/xpconnect/idl/xpccomponents.idl
@@ -113,17 +113,17 @@ interface nsIXPCComponents_utils_Sandbox
 interface ScheduledGCCallback : nsISupports
 {
     void callback();
 };
 
 /**
 * interface of Components.utils
 */
-[scriptable, uuid(36c19d92-d4a9-4ad1-bee3-945f60c6c991)]
+[scriptable, uuid(a93e230d-e883-4ff8-9aeb-dbe5cc771059)]
 interface nsIXPCComponents_Utils : nsISupports
 {
 
     /* reportError is designed to be called from JavaScript only.
      *
      * It will report a JS Error object to the JS console, and return. It
      * is meant for use in exception handler blocks which want to "eat"
      * an exception, but still want to report it to the console.
@@ -365,19 +365,16 @@ interface nsIXPCComponents_Utils : nsISu
 
     [implicit_jscontext]
     attribute boolean atline;
 
     [implicit_jscontext]
     attribute boolean xml;
 
     [implicit_jscontext]
-    attribute boolean relimit;
-
-    [implicit_jscontext]
     attribute boolean methodjit;
 
     [implicit_jscontext]
     attribute boolean methodjit_always;
 
     [implicit_jscontext]
     attribute boolean strict_mode;
     
--- a/js/xpconnect/shell/xpcshell.cpp
+++ b/js/xpconnect/shell/xpcshell.cpp
@@ -681,17 +681,16 @@ GetChildGlobalObject(JSContext* cx,
  * JSContext option name to flag map. The option names are in alphabetical
  * order for better reporting.
  */
 static const struct JSOption {
     const char  *name;
     uint32_t    flag;
 } js_options[] = {
     {"atline",          JSOPTION_ATLINE},
-    {"relimit",         JSOPTION_RELIMIT},
     {"strict",          JSOPTION_STRICT},
     {"werror",          JSOPTION_WERROR},
     {"allow_xml",       JSOPTION_ALLOW_XML},
     {"moar_xml",        JSOPTION_MOAR_XML},
     {"strict_mode",     JSOPTION_STRICT_MODE},
 };
 
 static uint32_t
--- a/js/xpconnect/src/XPCComponents.cpp
+++ b/js/xpconnect/src/XPCComponents.cpp
@@ -4418,17 +4418,16 @@ SetBoolOption(JSContext* cx, uint32_t aO
     {                                                                   \
         return SetBoolOption(cx, _flag, aValue);                        \
     }
 
 GENERATE_JSOPTION_GETTER_SETTER(Strict, JSOPTION_STRICT)
 GENERATE_JSOPTION_GETTER_SETTER(Werror, JSOPTION_WERROR)
 GENERATE_JSOPTION_GETTER_SETTER(Atline, JSOPTION_ATLINE)
 GENERATE_JSOPTION_GETTER_SETTER(Xml, JSOPTION_MOAR_XML)
-GENERATE_JSOPTION_GETTER_SETTER(Relimit, JSOPTION_RELIMIT)
 GENERATE_JSOPTION_GETTER_SETTER(Methodjit, JSOPTION_METHODJIT)
 GENERATE_JSOPTION_GETTER_SETTER(Methodjit_always, JSOPTION_METHODJIT_ALWAYS)
 GENERATE_JSOPTION_GETTER_SETTER(Strict_mode, JSOPTION_STRICT_MODE)
 GENERATE_JSOPTION_GETTER_SETTER(Ion, JSOPTION_ION)
 
 #undef GENERATE_JSOPTION_GETTER_SETTER
 
 NS_IMETHODIMP
--- a/modules/libpref/src/init/all.js
+++ b/modules/libpref/src/init/all.js
@@ -704,17 +704,16 @@ pref("privacy.donottrackheader.enabled",
 pref("dom.event.contextmenu.enabled",       true);
 pref("dom.event.clipboardevents.enabled",   true);
 
 pref("javascript.enabled",                  true);
 pref("javascript.options.strict",           false);
 #ifdef DEBUG
 pref("javascript.options.strict.debug",     true);
 #endif
-pref("javascript.options.relimit",          true);
 pref("javascript.options.methodjit.content", true);
 pref("javascript.options.methodjit.chrome",  true);
 pref("javascript.options.ion.content",      true);
 pref("javascript.options.pccounts.content", false);
 pref("javascript.options.pccounts.chrome",  false);
 pref("javascript.options.methodjit_always", false);
 pref("javascript.options.xml.content", false);
 pref("javascript.options.xml.chrome", true);