Bug 824312 - Drop support for JSVersion <= 1.5. r=waldo

This commit is contained in:
Masatoshi Kimura 2013-01-03 13:56:13 +09:00
Родитель 397707e92b
Коммит 6bdee6d353
4 изменённых файлов: 28 добавлений и 47 удалений

Просмотреть файл

@ -780,20 +780,14 @@ nsContentUtils::IsJavaScriptLanguage(const nsString& aName, uint32_t *aFlags)
if (aName.LowerCaseEqualsLiteral("javascript") ||
aName.LowerCaseEqualsLiteral("livescript") ||
aName.LowerCaseEqualsLiteral("mocha")) {
aName.LowerCaseEqualsLiteral("mocha") ||
aName.LowerCaseEqualsLiteral("javascript1.0") ||
aName.LowerCaseEqualsLiteral("javascript1.1") ||
aName.LowerCaseEqualsLiteral("javascript1.2") ||
aName.LowerCaseEqualsLiteral("javascript1.3") ||
aName.LowerCaseEqualsLiteral("javascript1.4") ||
aName.LowerCaseEqualsLiteral("javascript1.5")) {
version = JSVERSION_DEFAULT;
} else if (aName.LowerCaseEqualsLiteral("javascript1.0")) {
version = JSVERSION_1_0;
} else if (aName.LowerCaseEqualsLiteral("javascript1.1")) {
version = JSVERSION_1_1;
} else if (aName.LowerCaseEqualsLiteral("javascript1.2")) {
version = JSVERSION_1_2;
} else if (aName.LowerCaseEqualsLiteral("javascript1.3")) {
version = JSVERSION_1_3;
} else if (aName.LowerCaseEqualsLiteral("javascript1.4")) {
version = JSVERSION_1_4;
} else if (aName.LowerCaseEqualsLiteral("javascript1.5")) {
version = JSVERSION_1_5;
} else if (aName.LowerCaseEqualsLiteral("javascript1.6")) {
version = JSVERSION_1_6;
} else if (aName.LowerCaseEqualsLiteral("javascript1.7")) {
@ -818,12 +812,12 @@ nsContentUtils::ParseJavascriptVersion(const nsAString& aVersionStr)
}
switch (aVersionStr[2]) {
case '0': return JSVERSION_1_0;
case '1': return JSVERSION_1_1;
case '2': return JSVERSION_1_2;
case '3': return JSVERSION_1_3;
case '4': return JSVERSION_1_4;
case '5': return JSVERSION_1_5;
case '0': /* fall through */
case '1': /* fall through */
case '2': /* fall through */
case '3': /* fall through */
case '4': /* fall through */
case '5': return JSVERSION_DEFAULT;
case '6': return JSVERSION_1_6;
case '7': return JSVERSION_1_7;
case '8': return JSVERSION_1_8;

Просмотреть файл

@ -24,7 +24,7 @@ JSBool CheckVersionHasMoarXML(JSContext *cx, unsigned argc, jsval *vp);
JSBool DisableMoarXMLOption(JSContext *cx, unsigned argc, jsval *vp);
JSBool CallSetVersion17(JSContext *cx, unsigned argc, jsval *vp);
JSBool CheckNewScriptNoXML(JSContext *cx, unsigned argc, jsval *vp);
JSBool OverrideVersion15(JSContext *cx, unsigned argc, jsval *vp);
JSBool OverrideVersion18(JSContext *cx, unsigned argc, jsval *vp);
JSBool CaptureVersion(JSContext *cx, unsigned argc, jsval *vp);
JSBool CheckOverride(JSContext *cx, unsigned argc, jsval *vp);
JSBool EvalScriptVersion16(JSContext *cx, unsigned argc, jsval *vp);
@ -44,7 +44,7 @@ struct VersionFixture : public JSAPITest
JS_DefineFunction(cx, global, "disableMoarXMLOption", DisableMoarXMLOption, 0, 0) &&
JS_DefineFunction(cx, global, "callSetVersion17", CallSetVersion17, 0, 0) &&
JS_DefineFunction(cx, global, "checkNewScriptNoXML", CheckNewScriptNoXML, 0, 0) &&
JS_DefineFunction(cx, global, "overrideVersion15", OverrideVersion15, 0, 0) &&
JS_DefineFunction(cx, global, "overrideVersion18", OverrideVersion18, 0, 0) &&
JS_DefineFunction(cx, global, "captureVersion", CaptureVersion, 0, 0) &&
JS_DefineFunction(cx, global, "checkOverride", CheckOverride, 1, 0) &&
JS_DefineFunction(cx, global, "evalScriptVersion16",
@ -149,9 +149,9 @@ CheckNewScriptNoXML(JSContext *cx, unsigned argc, jsval *vp)
}
JSBool
OverrideVersion15(JSContext *cx, unsigned argc, jsval *vp)
OverrideVersion18(JSContext *cx, unsigned argc, jsval *vp)
{
if (!callbackData->setVersion(JSVERSION_1_5))
if (!callbackData->setVersion(JSVERSION_1_8))
return false;
return callbackData->checkVersionIsOverridden();
}
@ -221,14 +221,14 @@ END_FIXTURE_TEST(VersionFixture, testVersion_OptionsAreUsedForVersionFlags)
*/
BEGIN_FIXTURE_TEST(VersionFixture, testVersion_EntryLosesOverride)
{
EXEC("overrideVersion15(); evalScriptVersion16('checkOverride(false); captureVersion()');");
EXEC("overrideVersion18(); evalScriptVersion16('checkOverride(false); captureVersion()');");
CHECK_EQUAL(captured, JSVERSION_1_6);
/*
* Override gets propagated to default version as non-override when you leave the VM's execute
* call.
*/
CHECK_EQUAL(JS_GetVersion(cx), JSVERSION_1_5);
CHECK_EQUAL(JS_GetVersion(cx), JSVERSION_1_8);
CHECK(!cx->isVersionOverridden());
return true;
}
@ -245,7 +245,7 @@ BEGIN_FIXTURE_TEST(VersionFixture, testVersion_ReturnLosesOverride)
CHECK_EQUAL(JS_GetVersion(cx), JSVERSION_ECMA_5);
EXEC(
"checkOverride(false);"
"evalScriptVersion16('overrideVersion15();');"
"evalScriptVersion16('overrideVersion18();');"
"checkOverride(false);"
"captureVersion();"
);
@ -259,11 +259,11 @@ BEGIN_FIXTURE_TEST(VersionFixture, testVersion_EvalPropagatesOverride)
CHECK_EQUAL(JS_GetVersion(cx), JSVERSION_ECMA_5);
EXEC(
"checkOverride(false);"
"eval('overrideVersion15();');"
"eval('overrideVersion18();');"
"checkOverride(true);"
"captureVersion();"
);
CHECK_EQUAL(captured, JSVERSION_1_5);
CHECK_EQUAL(captured, JSVERSION_1_8);
return true;
}
END_FIXTURE_TEST(VersionFixture, testVersion_EvalPropagatesOverride)

Просмотреть файл

@ -1317,10 +1317,6 @@ JS_SetVersion(JSContext *cx, JSVersion newVersion)
if (oldVersionNumber == newVersionNumber)
return oldVersionNumber; /* No override actually occurs! */
/* We no longer support 1.4 or below. */
if (newVersionNumber != JSVERSION_DEFAULT && newVersionNumber <= JSVERSION_1_4)
return oldVersionNumber;
VersionCopyFlags(&newVersion, oldVersion);
cx->maybeOverrideVersion(newVersion);
JS_ASSERT(cx->getCompileOptions() == coptsBefore);
@ -1331,18 +1327,18 @@ static struct v2smap {
JSVersion version;
const char *string;
} v2smap[] = {
{JSVERSION_1_0, "1.0"},
{JSVERSION_1_1, "1.1"},
{JSVERSION_1_2, "1.2"},
{JSVERSION_1_3, "1.3"},
{JSVERSION_1_4, "1.4"},
{JSVERSION_ECMA_3, "ECMAv3"},
{JSVERSION_1_5, "1.5"},
{JSVERSION_1_6, "1.6"},
{JSVERSION_1_7, "1.7"},
{JSVERSION_1_8, "1.8"},
{JSVERSION_ECMA_5, "ECMAv5"},
{JSVERSION_DEFAULT, js_default_str},
{JSVERSION_DEFAULT, "1.0"},
{JSVERSION_DEFAULT, "1.1"},
{JSVERSION_DEFAULT, "1.2"},
{JSVERSION_DEFAULT, "1.3"},
{JSVERSION_DEFAULT, "1.4"},
{JSVERSION_DEFAULT, "1.5"},
{JSVERSION_UNKNOWN, NULL}, /* must be last, NULL is sentinel */
};

Просмотреть файл

@ -72,13 +72,7 @@ typedef uint16_t jschar;
* #if expressions.
*/
typedef enum JSVersion {
JSVERSION_1_0 = 100,
JSVERSION_1_1 = 110,
JSVERSION_1_2 = 120,
JSVERSION_1_3 = 130,
JSVERSION_1_4 = 140,
JSVERSION_ECMA_3 = 148,
JSVERSION_1_5 = 150,
JSVERSION_1_6 = 160,
JSVERSION_1_7 = 170,
JSVERSION_1_8 = 180,
@ -88,9 +82,6 @@ typedef enum JSVersion {
JSVERSION_LATEST = JSVERSION_ECMA_5
} JSVersion;
#define JSVERSION_IS_ECMA(version) \
((version) == JSVERSION_DEFAULT || (version) >= JSVERSION_1_3)
/* Result of typeof operator enumeration. */
typedef enum JSType {
JSTYPE_VOID, /* undefined */