Backed out 6 changesets (bug 1428745) for wpt failures on script-type-and-language-with-params.html. r=backout on a CLOSED TREE

Backed out changeset 9e84285278fe (bug 1428745)
Backed out changeset e199f1ccf64c (bug 1428745)
Backed out changeset dfb9af93ac53 (bug 1428745)
Backed out changeset 1d975770bd9a (bug 1428745)
Backed out changeset 1d5dc7dfd429 (bug 1428745)
Backed out changeset 4e53f251c5b8 (bug 1428745)
This commit is contained in:
Narcis Beleuzu 2018-01-10 00:37:59 +02:00
Родитель a881c4a167
Коммит 0cc8c52dcb
32 изменённых файлов: 396 добавлений и 79 удалений

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

@ -6,7 +6,7 @@
</head>
<body>
<p>Hello there!</p>
<script type="application/javascript">
<script type="application/javascript; version=1.8">
function test_fetch() {
let url = "http://trackertest.org/browser/browser/base/content/test/general/file_trackingUI_6.js";
return fetch(url);

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

@ -10,7 +10,7 @@ Basic tests for the HSplitBox component.
<meta charset="utf-8">
<title>Tree component test</title>
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>
<script type="application/javascript "src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
<link rel="stylesheet" href="resource://devtools/client/themes/splitters.css" type="text/css"/>
<link rel="stylesheet" href="chrome://devtools/skin/components-h-split-box.css" type="text/css"/>

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

@ -5,7 +5,7 @@
<title>Storage inspector cookie samesite test</title>
</head>
<body>
<script type="application/javascript">
<script type="application/javascript;version=1.7">
"use strict";
let expiresIn24Hours = new Date(Date.now() + 60 * 60 * 24 * 1000).toUTCString();

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

@ -12,7 +12,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=795317
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=795317">Mozilla Bug 795317</a>
<script type="application/javascript" src="browserElement_ExposableURI.js"></script>
<script type="application/javascript;version1.7" src="browserElement_ExposableURI.js"></script>
</body>
</html>

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

@ -12,7 +12,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=710231
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=710231">Mozilla Bug 710231</a>
<script type="application/javascript" src="browserElement_LoadEvents.js"></script>
<script type="application/javascript;version1.7" src="browserElement_LoadEvents.js"></script>
</body>
</html>

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

@ -12,7 +12,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=795317
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=795317">Mozilla Bug 795317</a>
<script type="application/javascript" src="browserElement_ExposableURI.js"></script>
<script type="application/javascript;version1.7" src="browserElement_ExposableURI.js"></script>
</body>
</html>

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

@ -12,7 +12,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=710231
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=710231">Mozilla Bug 710231</a>
<script type="application/javascript" src="browserElement_LoadEvents.js"></script>
<script type="application/javascript;version1.7" src="browserElement_LoadEvents.js"></script>
</body>
</html>

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

@ -171,20 +171,9 @@ HTMLScriptElement::SetText(const nsAString& aValue, ErrorResult& aRv)
// need to be transfered when modifying
bool
HTMLScriptElement::GetScriptType(nsAString& aType)
HTMLScriptElement::GetScriptType(nsAString& type)
{
nsAutoString type;
if (!GetAttr(kNameSpaceID_None, nsGkAtoms::type, type)) {
return false;
}
// ASCII whitespace https://infra.spec.whatwg.org/#ascii-whitespace:
// U+0009 TAB, U+000A LF, U+000C FF, U+000D CR, or U+0020 SPACE.
static const char kASCIIWhitespace[] = "\t\n\f\r ";
type.Trim(kASCIIWhitespace);
aType.Assign(type);
return true;
return GetAttr(kNameSpaceID_None, nsGkAtoms::type, type);
}
void

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

@ -26,7 +26,7 @@ and
</menu>
</div>
<pre id="test">
<script class="testbody" type="text/javascript">
<script class="testbody" type="text/javascript; version=1.7">
/** Test for Bug 418756 and 617528 **/
var group1;

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

@ -29,6 +29,7 @@ NS_IMPL_RELEASE_INHERITED(ModuleLoadRequest, ScriptLoadRequest)
ModuleLoadRequest::ModuleLoadRequest(nsIURI* aURI,
nsIScriptElement* aElement,
ValidJSVersion aValidJSVersion,
CORSMode aCORSMode,
const SRIMetadata& aIntegrity,
nsIURI* aReferrer,
@ -37,6 +38,7 @@ ModuleLoadRequest::ModuleLoadRequest(nsIURI* aURI,
: ScriptLoadRequest(ScriptKind::eModule,
aURI,
aElement,
aValidJSVersion,
aCORSMode,
aIntegrity,
aReferrer,
@ -53,6 +55,7 @@ ModuleLoadRequest::ModuleLoadRequest(nsIURI* aURI,
: ScriptLoadRequest(ScriptKind::eModule,
aURI,
aParent->mElement,
aParent->mValidJSVersion,
aParent->mCORSMode,
SRIMetadata(),
aParent->mURI,

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

@ -45,6 +45,7 @@ public:
// Create a top-level module load request.
ModuleLoadRequest(nsIURI* aURI,
nsIScriptElement* aElement,
ValidJSVersion aValidJSVersion,
CORSMode aCORSMode,
const SRIMetadata& aIntegrity,
nsIURI* aReferrer,

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

@ -41,6 +41,7 @@ NS_IMPL_CYCLE_COLLECTION_TRACE_END
ScriptLoadRequest::ScriptLoadRequest(ScriptKind aKind,
nsIURI* aURI,
nsIScriptElement* aElement,
ValidJSVersion aValidJSVersion,
mozilla::CORSMode aCORSMode,
const SRIMetadata& aIntegrity,
nsIURI* aReferrer,
@ -64,6 +65,7 @@ ScriptLoadRequest::ScriptLoadRequest(ScriptKind aKind,
, mScriptText()
, mScriptBytecode()
, mBytecodeOffset(0)
, mValidJSVersion(aValidJSVersion)
, mURI(aURI)
, mLineNo(1)
, mCORSMode(aCORSMode)

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

@ -29,6 +29,11 @@ enum class ScriptKind {
eModule
};
enum class ValidJSVersion : bool {
eInvalid,
eValid
};
/*
* A class that handles loading and evaluation of <script> elements.
*/
@ -49,6 +54,7 @@ public:
ScriptLoadRequest(ScriptKind aKind,
nsIURI* aURI,
nsIScriptElement* aElement,
ValidJSVersion aValidJSVersion,
mozilla::CORSMode aCORSMode,
const SRIMetadata &aIntegrity,
nsIURI* aReferrer,
@ -211,6 +217,7 @@ public:
mozilla::Vector<uint8_t> mScriptBytecode;
uint32_t mBytecodeOffset; // Offset of the bytecode in mScriptBytecode
ValidJSVersion mValidJSVersion;
const nsCOMPtr<nsIURI> mURI;
nsCOMPtr<nsIPrincipal> mTriggeringPrincipal;
nsCOMPtr<nsIPrincipal> mOriginPrincipal;

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

@ -1059,11 +1059,12 @@ ScriptLoader::StartLoad(ScriptLoadRequest* aRequest)
NS_ENSURE_SUCCESS(rv, rv);
// To avoid decoding issues, the build-id is part of the JSBytecodeMimeType
// constant.
// To avoid decoding issues, the JSVersion is explicitly guarded here, and the
// build-id is part of the JSBytecodeMimeType constant.
aRequest->mCacheInfo = nullptr;
nsCOMPtr<nsICacheInfoChannel> cic(do_QueryInterface(channel));
if (cic && nsContentUtils::IsBytecodeCacheEnabled()) {
if (cic && nsContentUtils::IsBytecodeCacheEnabled() &&
aRequest->mValidJSVersion == ValidJSVersion::eValid) {
if (!aRequest->IsLoadingSource()) {
// Inform the HTTP cache that we prefer to have information coming from the
// bytecode cache instead of the sources, if such entry is already registered.
@ -1173,6 +1174,63 @@ ScriptLoader::PreloadURIComparator::Equals(const PreloadInfo& aPi,
same;
}
/**
* Returns ValidJSVersion::eValid if aVersionStr is a string of the form '1.n',
* n = 0, ..., 8, and ValidJSVersion::eInvalid for other strings.
*/
static ValidJSVersion
ParseJavascriptVersion(const nsAString& aVersionStr)
{
if (aVersionStr.Length() != 3 || aVersionStr[0] != '1' ||
aVersionStr[1] != '.') {
return ValidJSVersion::eInvalid;
}
if ('0' <= aVersionStr[2] && aVersionStr[2] <= '8') {
return ValidJSVersion::eValid;
}
return ValidJSVersion::eInvalid;
}
static inline bool
ParseTypeAttribute(const nsAString& aType, ValidJSVersion* aVersion)
{
MOZ_ASSERT(!aType.IsEmpty());
MOZ_ASSERT(aVersion);
MOZ_ASSERT(*aVersion == ValidJSVersion::eValid);
nsContentTypeParser parser(aType);
nsAutoString mimeType;
nsresult rv = parser.GetType(mimeType);
NS_ENSURE_SUCCESS(rv, false);
if (!nsContentUtils::IsJavascriptMIMEType(mimeType)) {
return false;
}
// Get the version string, and ensure the language supports it.
nsAutoString versionName;
rv = parser.GetParameter("version", versionName);
if (rv == NS_ERROR_INVALID_ARG) {
Telemetry::Accumulate(Telemetry::SCRIPT_LOADED_WITH_VERSION, false);
// Argument not set.
return true;
}
if (NS_FAILED(rv)) {
return false;
}
*aVersion = ParseJavascriptVersion(versionName);
if (*aVersion == ValidJSVersion::eValid) {
Telemetry::Accumulate(Telemetry::SCRIPT_LOADED_WITH_VERSION, true);
return true;
}
return true;
}
static bool
CSPAllowsInlineScript(nsIScriptElement* aElement, nsIDocument* aDocument)
{
@ -1205,6 +1263,7 @@ ScriptLoadRequest*
ScriptLoader::CreateLoadRequest(ScriptKind aKind,
nsIURI* aURI,
nsIScriptElement* aElement,
ValidJSVersion aValidJSVersion,
CORSMode aCORSMode,
const SRIMetadata& aIntegrity,
mozilla::net::ReferrerPolicy aReferrerPolicy)
@ -1213,7 +1272,7 @@ ScriptLoader::CreateLoadRequest(ScriptKind aKind,
if (aKind == ScriptKind::eClassic) {
ScriptLoadRequest* slr = new ScriptLoadRequest(aKind, aURI, aElement,
aCORSMode, aIntegrity,
aValidJSVersion, aCORSMode, aIntegrity,
referrer, aReferrerPolicy);
LOG(("ScriptLoader %p creates ScriptLoadRequest %p", this, slr));
@ -1221,8 +1280,8 @@ ScriptLoader::CreateLoadRequest(ScriptKind aKind,
}
MOZ_ASSERT(aKind == ScriptKind::eModule);
return new ModuleLoadRequest(aURI, aElement, aCORSMode, aIntegrity, referrer,
aReferrerPolicy, this);
return new ModuleLoadRequest(aURI, aElement, aValidJSVersion, aCORSMode,
aIntegrity, referrer, aReferrerPolicy, this);
}
bool
@ -1251,11 +1310,13 @@ ScriptLoader::ProcessScriptElement(nsIScriptElement* aElement)
return false;
}
ValidJSVersion validJSVersion = ValidJSVersion::eValid;
// For classic scripts, check the type attribute to determine language and
// version. If type exists, it trumps the deprecated 'language='
if (scriptKind == ScriptKind::eClassic) {
if (!type.IsEmpty()) {
NS_ENSURE_TRUE(nsContentUtils::IsJavascriptMIMEType(type), false);
NS_ENSURE_TRUE(ParseTypeAttribute(type, &validJSVersion), false);
} else if (!hasType) {
// no 'type=' element
// "language" is a deprecated attribute of HTML, so we check it only for
@ -1368,8 +1429,9 @@ ScriptLoader::ProcessScriptElement(nsIScriptElement* aElement)
principal = scriptContent->NodePrincipal();
}
request = CreateLoadRequest(scriptKind, scriptURI, aElement, ourCORSMode,
sriMetadata, ourRefPolicy);
request = CreateLoadRequest(scriptKind, scriptURI, aElement,
validJSVersion, ourCORSMode, sriMetadata,
ourRefPolicy);
request->mTriggeringPrincipal = Move(principal);
request->mIsInline = false;
request->SetScriptMode(aElement->GetScriptDeferred(),
@ -1394,6 +1456,8 @@ ScriptLoader::ProcessScriptElement(nsIScriptElement* aElement)
NS_ASSERTION(!request->InCompilingStage(),
"Request should not yet be in compiling stage.");
request->mValidJSVersion = validJSVersion;
if (request->IsAsyncScript()) {
AddAsyncRequest(request);
if (request->IsReadyToRun()) {
@ -1496,9 +1560,10 @@ ScriptLoader::ProcessScriptElement(nsIScriptElement* aElement)
}
request = CreateLoadRequest(scriptKind, mDocument->GetDocumentURI(), aElement,
corsMode,
validJSVersion, corsMode,
SRIMetadata(), // SRI doesn't apply
ourRefPolicy);
request->mValidJSVersion = validJSVersion;
request->mIsInline = true;
request->mTriggeringPrincipal = mDocument->NodePrincipal();
request->mLineNo = aElement->GetScriptLineNumber();
@ -2127,6 +2192,10 @@ ScriptLoader::EvaluateScript(ScriptLoadRequest* aRequest)
return NS_ERROR_FAILURE;
}
if (aRequest->mValidJSVersion == ValidJSVersion::eInvalid) {
return NS_OK;
}
// New script entry point required, due to the "Create a script" sub-step of
// http://www.whatwg.org/specs/web-apps/current-work/#execute-the-script-block
nsAutoMicroTask mt;
@ -3141,7 +3210,7 @@ ScriptLoader::PreloadURI(nsIURI* aURI, const nsAString& aCharset,
}
RefPtr<ScriptLoadRequest> request =
CreateLoadRequest(ScriptKind::eClassic, aURI, nullptr,
CreateLoadRequest(ScriptKind::eClassic, aURI, nullptr, ValidJSVersion::eValid,
Element::StringToCORSMode(aCrossOrigin), sriMetadata,
aReferrerPolicy);
request->mTriggeringPrincipal = mDocument->NodePrincipal();

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

@ -342,6 +342,7 @@ private:
ScriptLoadRequest* CreateLoadRequest(ScriptKind aKind,
nsIURI* aURI,
nsIScriptElement* aElement,
ValidJSVersion aValidJSVersion,
mozilla::CORSMode aCORSMode,
const SRIMetadata& aIntegrity,
mozilla::net::ReferrerPolicy aReferrerPolicy);

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

@ -10,7 +10,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1022869
<script type="application/javascript" src="/tests/SimpleTest/SpawnTask.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<iframe src="about:blank"></iframe>
<script type="text/javascript">
<script type="text/javascript; version=1.8">
var f = document.getElementsByTagName("iframe")[0];

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

@ -7,7 +7,7 @@
<script type="application/javascript" src="/tests/SimpleTest/SpawnTask.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<iframe src="about:blank"></iframe>
<script type="text/javascript">
<script type="text/javascript; version=1.8">
function checkForFindDialog() {
let chromeScript = SpecialPowers.loadChromeScript(_ => {
@ -89,4 +89,4 @@
<pre id="test">
</pre>
</body>
</html>
</html>

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

@ -4,4 +4,3 @@ support-files =
[test_bug1053321.html]
skip-if = os == 'android' # bug 1386644
[test_whitespace.html]

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

@ -23,8 +23,8 @@ are unexpectedly blocked.
<body>
<script>
SimpleTest.waitForExplicitFinish();
// No need for an async test, we make it all before window.onload.
//
// We can't test whether the two scripts have not been executed here, since
// preloads of the two images below (that unblock the two tested <head>
// scripts) may happen sooner than this script executes.
@ -33,7 +33,6 @@ are unexpectedly blocked.
});
window.addEventListener("load", function() {
ok(window.script_executed_async, "Async script executed before onload");
SimpleTest.finish();
}, true);
</script>
<img src="file_blocked_script.sjs?unblock&defer"/>

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

@ -1,31 +0,0 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Test for ScriptLoader and type with whitespaces</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<script type="application/javascript">
let passed = false;
let tests = [
[ " application/javascript", true ],
[ "\tapplication/javascript\n\r \t", true ],
];
for (let i = 0; i < tests.length; ++i) {
passed = false;
let script = document.createElement('script');
script.setAttribute('type', tests[i][0]);
script.innerText = "passed = true;";
document.body.appendChild(script);
ok (passed, tests[i][1], "Test " + tests[i][0] + " passed");
}
</script>
</body>
</html>

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

@ -105,13 +105,21 @@ function report(testName, success) {
}
]]>
</script>
<script type="text/javascript; version=1.7"><![CDATA[
try {
eval("let x = 1;");
var success = true;
}
catch (e) { success = false; }
report("HTML script tags with explicit version", success)
]]></script>
<script type="text/javascript"><![CDATA[
try {
eval("let x = 1;");
var success = true;
}
catch (e) { success = false; }
is(success, true, "let should work in HTML script tags");
is(success, true, "let should work in versionless HTML script tags");
]]></script>
</pre>
</body>

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

@ -5,7 +5,7 @@
<title>Bug 453896 Test middle frame</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="Content-Style-Type" content="text/css">
<script type="application/javascript">
<script type="application/javascript; version=1.7">
function run(test_window)
{

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

@ -10,7 +10,7 @@
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=398962">Mozilla Bug 398962</a>
<iframe id="iframe" src="http://mochi.test:8888/tests/layout/style/test/chrome/moz_document_helper.html"></iframe>
<pre id="test">
<script type="application/javascript">
<script type="application/javascript; version=1.8">
var [gStyleSheetService, gIOService] = (function() {
return [

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

@ -12,7 +12,7 @@
<iframe id="iframe2" src="additional_sheets_helper.html"></iframe>
<pre id="test">
<script type="application/javascript">
<script type="application/javascript; version=1.8">
let gIOService = SpecialPowers.Cc["@mozilla.org/network/io-service;1"]
.getService(SpecialPowers.Ci.nsIIOService);

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

@ -9,7 +9,7 @@
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=737003">Mozilla Bug 737003</a>
<iframe id="iframe" src="additional_sheets_helper.html"></iframe>
<pre id="test">
<script type="application/javascript">
<script type="application/javascript; version=1.8">
var gIOService = SpecialPowers.Cc["@mozilla.org/network/io-service;1"]
.getService(SpecialPowers.Ci.nsIIOService)

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

@ -12,7 +12,7 @@
</div>
<pre id="test">
<script type="application/javascript">
<script type="application/javascript; version=1.7">
/** Test that preffed off properties do not appear in computed style **/

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

@ -15,7 +15,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=473400
</div>
<pre id="test">
<script class="testbody" type="application/javascript">
<script class="testbody" type="application/javascript; version=1.7">
/** Test for Bug 473400 **/

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

@ -1,5 +1,194 @@
[script-type-and-language-js.html]
[Script shouldn't run with type=" "]
[Script should run with type="application/ecmascript\\f"]
expected: FAIL
[Script should run with type="application/javascript\\f"]
expected: FAIL
[Script should run with type="application/x-ecmascript\\f"]
expected: FAIL
[Script should run with type="application/x-javascript\\f"]
expected: FAIL
[Script should run with type="\\fapplication/ecmascript"]
expected: FAIL
[Script should run with type="\\fapplication/javascript"]
expected: FAIL
[Script should run with type="\\fapplication/x-ecmascript"]
expected: FAIL
[Script should run with type="\\fapplication/x-javascript"]
expected: FAIL
[Script shouldn't run with type="application/ecmascript\\0"]
expected: FAIL
[Script shouldn't run with type="application/javascript\\0"]
expected: FAIL
[Script shouldn't run with type="application/x-ecmascript\\0"]
expected: FAIL
[Script shouldn't run with type="application/x-javascript\\0"]
expected: FAIL
[Script shouldn't run with type="application/ecmascript\\0foo"]
expected: FAIL
[Script shouldn't run with type="application/javascript\\0foo"]
expected: FAIL
[Script shouldn't run with type="application/x-ecmascript\\0foo"]
expected: FAIL
[Script shouldn't run with type="application/x-javascript\\0foo"]
expected: FAIL
[Script should run with type="text/ecmascript\\f"]
expected: FAIL
[Script should run with type="text/javascript\\f"]
expected: FAIL
[Script should run with type="text/javascript1.0\\f"]
expected: FAIL
[Script should run with type="text/javascript1.1\\f"]
expected: FAIL
[Script should run with type="text/javascript1.2\\f"]
expected: FAIL
[Script should run with type="text/javascript1.3\\f"]
expected: FAIL
[Script should run with type="text/javascript1.4\\f"]
expected: FAIL
[Script should run with type="text/javascript1.5\\f"]
expected: FAIL
[Script should run with type="text/jscript\\f"]
expected: FAIL
[Script should run with type="text/livescript\\f"]
expected: FAIL
[Script should run with type="text/x-ecmascript\\f"]
expected: FAIL
[Script should run with type="text/x-javascript\\f"]
expected: FAIL
[Script should run with type="\\ftext/ecmascript"]
expected: FAIL
[Script should run with type="\\ftext/javascript"]
expected: FAIL
[Script should run with type="\\ftext/javascript1.0"]
expected: FAIL
[Script should run with type="\\ftext/javascript1.1"]
expected: FAIL
[Script should run with type="\\ftext/javascript1.2"]
expected: FAIL
[Script should run with type="\\ftext/javascript1.3"]
expected: FAIL
[Script should run with type="\\ftext/javascript1.4"]
expected: FAIL
[Script should run with type="\\ftext/javascript1.5"]
expected: FAIL
[Script should run with type="\\ftext/jscript"]
expected: FAIL
[Script should run with type="\\ftext/livescript"]
expected: FAIL
[Script should run with type="\\ftext/x-ecmascript"]
expected: FAIL
[Script should run with type="\\ftext/x-javascript"]
expected: FAIL
[Script shouldn't run with type="text/ecmascript\\0"]
expected: FAIL
[Script shouldn't run with type="text/javascript\\0"]
expected: FAIL
[Script shouldn't run with type="text/javascript1.0\\0"]
expected: FAIL
[Script shouldn't run with type="text/javascript1.1\\0"]
expected: FAIL
[Script shouldn't run with type="text/javascript1.2\\0"]
expected: FAIL
[Script shouldn't run with type="text/javascript1.3\\0"]
expected: FAIL
[Script shouldn't run with type="text/javascript1.4\\0"]
expected: FAIL
[Script shouldn't run with type="text/javascript1.5\\0"]
expected: FAIL
[Script shouldn't run with type="text/jscript\\0"]
expected: FAIL
[Script shouldn't run with type="text/livescript\\0"]
expected: FAIL
[Script shouldn't run with type="text/x-ecmascript\\0"]
expected: FAIL
[Script shouldn't run with type="text/x-javascript\\0"]
expected: FAIL
[Script shouldn't run with type="text/ecmascript\\0foo"]
expected: FAIL
[Script shouldn't run with type="text/javascript\\0foo"]
expected: FAIL
[Script shouldn't run with type="text/javascript1.0\\0foo"]
expected: FAIL
[Script shouldn't run with type="text/javascript1.1\\0foo"]
expected: FAIL
[Script shouldn't run with type="text/javascript1.2\\0foo"]
expected: FAIL
[Script shouldn't run with type="text/javascript1.3\\0foo"]
expected: FAIL
[Script shouldn't run with type="text/javascript1.4\\0foo"]
expected: FAIL
[Script shouldn't run with type="text/javascript1.5\\0foo"]
expected: FAIL
[Script shouldn't run with type="text/jscript\\0foo"]
expected: FAIL
[Script shouldn't run with type="text/livescript\\0foo"]
expected: FAIL
[Script shouldn't run with type="text/x-ecmascript\\0foo"]
expected: FAIL
[Script shouldn't run with type="text/x-javascript\\0foo"]
expected: FAIL
[Script should run with language="ecmascript"]
@ -25,3 +214,4 @@
[Script should run with language="X-JAVASCRIPT"]
expected: FAIL

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

@ -109,6 +109,7 @@ skip-if = os == 'android' # unsupported.
[test_ext_idle.html]
[test_ext_inIncognitoContext_window.html]
skip-if = os == 'android' # Android does not support multiple windows.
[test_ext_jsversion.html]
[test_ext_listener_proxies.html]
[test_ext_new_tab_processType.html]
[test_ext_notifications.html]

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

@ -0,0 +1,71 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Test for simple WebExtension</title>
<meta charset="utf-8">
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SpawnTask.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/ExtensionTestUtils.js"></script>
<script type="text/javascript" src="head.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<script type="text/javascript">
"use strict";
add_task(async function test_versioned_js() {
// We need to deal with escaping the close script tags.
// May as well consolidate it into one place.
let script = attrs => `<script ${attrs}><\/script>`;
let extension = ExtensionTestUtils.loadExtension({
manifest: {
"background": {"page": "background.html"},
},
files: {
"background.html": `
<meta charset="utf-8">
${script('src="background.js" type="application/javascript"')}
${script('src="background-1.js" type="application/javascript;version=1.8"')}
${script('src="background-2.js" type="application/javascript;version=latest"')}
${script('src="background-3.js" type="application/javascript"')}
`,
"background.js": function() {
window.reportResult = msg => {
browser.test.assertEq(
msg, "background-script-3",
"Expected a message only from the unversioned background script.");
browser.test.sendMessage("finished");
};
},
"background-1.js": function() {
window.reportResult("background-script-1");
},
"background-2.js": function() {
window.reportResult("background-script-2");
},
"background-3.js": function() {
window.reportResult("background-script-3");
},
},
});
consoleMonitor.start([{message: /Versioned JavaScript.*not supported in WebExtension.*developer\.mozilla\.org/},
{message: /Versioned JavaScript.*not supported in WebExtension.*developer\.mozilla\.org/}]);
await Promise.all([extension.startup(),
extension.awaitMessage("finished")]);
await consoleMonitor.finished();
await extension.unload();
});
</script>
</body>
</html>

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

@ -13862,6 +13862,14 @@
"description": "Amount of time in milliseconds the main thread spends waiting for the paint thread to complete, if the time was greater than 200us.",
"bug_numbers": [1386968]
},
"SCRIPT_LOADED_WITH_VERSION": {
"record_in_processes": ["main", "content"],
"alert_emails": ["amarchesini@mozilla.com"],
"bug_numbers": [1418860],
"expires_in_version": "60",
"kind": "boolean",
"description": "Tracking how often scripts are loaded with a 'valid' version parameter. This telemetry ID helps us to decide if and when remove the support of script versioning."
},
"STYLO_PARALLEL_RESTYLE_FRACTION": {
"record_in_processes": ["content"],
"alert_emails": ["manish@mozilla.com"],

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

@ -5,7 +5,7 @@
<head>
<meta charset=UTF-8>
<title>Test page for link clicking</title>
<script type="text/javascript">
<script type="text/javascript; version=1.8">
function launch_download() {
window.open("download.bin", "_blank", "height=100,width=100");
}