mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 13:21:05 +00:00
Bug 1418860 - Adding telemetry to see how often version param is used in ScriptLoader type, r=jonco, data-r=francois
This commit is contained in:
parent
6ea1901fa9
commit
9d60eea296
@ -19,7 +19,7 @@ function test() {
|
|||||||
"<script type='text/javascript'>",
|
"<script type='text/javascript'>",
|
||||||
"let b = 42;",
|
"let b = 42;",
|
||||||
"</script>",
|
"</script>",
|
||||||
"<script type='text/javascript;version=1.8'>",
|
"<script type='text/javascript'>",
|
||||||
"let c = 42;",
|
"let c = 42;",
|
||||||
"</script>",
|
"</script>",
|
||||||
"</head>"
|
"</head>"
|
||||||
@ -44,14 +44,14 @@ function test() {
|
|||||||
"The first script was located correctly.");
|
"The first script was located correctly.");
|
||||||
is(parsed.getScriptInfo(source.indexOf("let b")).toSource(), "({start:85, length:13, index:1})",
|
is(parsed.getScriptInfo(source.indexOf("let b")).toSource(), "({start:85, length:13, index:1})",
|
||||||
"The second script was located correctly.");
|
"The second script was located correctly.");
|
||||||
is(parsed.getScriptInfo(source.indexOf("let c")).toSource(), "({start:151, length:13, index:2})",
|
is(parsed.getScriptInfo(source.indexOf("let c")).toSource(), "({start:139, length:13, index:2})",
|
||||||
"The third script was located correctly.");
|
"The third script was located correctly.");
|
||||||
|
|
||||||
is(parsed.getScriptInfo(source.indexOf("let a") - 1).toSource(), "({start:31, length:13, index:0})",
|
is(parsed.getScriptInfo(source.indexOf("let a") - 1).toSource(), "({start:31, length:13, index:0})",
|
||||||
"The left edge of the first script was interpreted correctly.");
|
"The left edge of the first script was interpreted correctly.");
|
||||||
is(parsed.getScriptInfo(source.indexOf("let b") - 1).toSource(), "({start:85, length:13, index:1})",
|
is(parsed.getScriptInfo(source.indexOf("let b") - 1).toSource(), "({start:85, length:13, index:1})",
|
||||||
"The left edge of the second script was interpreted correctly.");
|
"The left edge of the second script was interpreted correctly.");
|
||||||
is(parsed.getScriptInfo(source.indexOf("let c") - 1).toSource(), "({start:151, length:13, index:2})",
|
is(parsed.getScriptInfo(source.indexOf("let c") - 1).toSource(), "({start:139, length:13, index:2})",
|
||||||
"The left edge of the third script was interpreted correctly.");
|
"The left edge of the third script was interpreted correctly.");
|
||||||
|
|
||||||
is(parsed.getScriptInfo(source.indexOf("let a") - 2).toSource(), "({start:-1, length:-1, index:-1})",
|
is(parsed.getScriptInfo(source.indexOf("let a") - 2).toSource(), "({start:-1, length:-1, index:-1})",
|
||||||
@ -65,7 +65,7 @@ function test() {
|
|||||||
"The right edge of the first script was interpreted correctly.");
|
"The right edge of the first script was interpreted correctly.");
|
||||||
is(parsed.getScriptInfo(source.indexOf("let b") + 12).toSource(), "({start:85, length:13, index:1})",
|
is(parsed.getScriptInfo(source.indexOf("let b") + 12).toSource(), "({start:85, length:13, index:1})",
|
||||||
"The right edge of the second script was interpreted correctly.");
|
"The right edge of the second script was interpreted correctly.");
|
||||||
is(parsed.getScriptInfo(source.indexOf("let c") + 12).toSource(), "({start:151, length:13, index:2})",
|
is(parsed.getScriptInfo(source.indexOf("let c") + 12).toSource(), "({start:139, length:13, index:2})",
|
||||||
"The right edge of the third script was interpreted correctly.");
|
"The right edge of the third script was interpreted correctly.");
|
||||||
|
|
||||||
is(parsed.getScriptInfo(source.indexOf("let a") + 13).toSource(), "({start:-1, length:-1, index:-1})",
|
is(parsed.getScriptInfo(source.indexOf("let a") + 13).toSource(), "({start:-1, length:-1, index:-1})",
|
||||||
|
@ -19,7 +19,7 @@ function test() {
|
|||||||
"a.push('<script type=\"text/javascript\">');",
|
"a.push('<script type=\"text/javascript\">');",
|
||||||
"a.push('var b = 42;');",
|
"a.push('var b = 42;');",
|
||||||
"a.push('</script>');",
|
"a.push('</script>');",
|
||||||
"a.push('<script type=\"text/javascript;version=1.8\">');",
|
"a.push('<script type=\"text/javascript\">');",
|
||||||
"a.push('var c = 42;');",
|
"a.push('var c = 42;');",
|
||||||
"a.push('</script>');"
|
"a.push('</script>');"
|
||||||
].join("\n");
|
].join("\n");
|
||||||
@ -34,11 +34,11 @@ function test() {
|
|||||||
is(parsed.scriptCount, 1,
|
is(parsed.scriptCount, 1,
|
||||||
"There should be 1 script parsed in the parent source.");
|
"There should be 1 script parsed in the parent source.");
|
||||||
|
|
||||||
is(parsed.getScriptInfo(source.indexOf("let a")).toSource(), "({start:0, length:261, index:0})",
|
is(parsed.getScriptInfo(source.indexOf("let a")).toSource(), "({start:0, length:249, index:0})",
|
||||||
"The script location is correct (1).");
|
"The script location is correct (1).");
|
||||||
is(parsed.getScriptInfo(source.indexOf("<script>")).toSource(), "({start:0, length:261, index:0})",
|
is(parsed.getScriptInfo(source.indexOf("<script>")).toSource(), "({start:0, length:249, index:0})",
|
||||||
"The script location is correct (2).");
|
"The script location is correct (2).");
|
||||||
is(parsed.getScriptInfo(source.indexOf("</script>")).toSource(), "({start:0, length:261, index:0})",
|
is(parsed.getScriptInfo(source.indexOf("</script>")).toSource(), "({start:0, length:249, index:0})",
|
||||||
"The script location is correct (3).");
|
"The script location is correct (3).");
|
||||||
|
|
||||||
finish();
|
finish();
|
||||||
|
@ -12,7 +12,7 @@ function test() {
|
|||||||
|
|
||||||
let source = [
|
let source = [
|
||||||
'<script type="text/javascript" src="chrome://foo.js"/>',
|
'<script type="text/javascript" src="chrome://foo.js"/>',
|
||||||
'<script type="application/javascript;version=1.8" src="chrome://baz.js"/>',
|
'<script type="application/javascript" src="chrome://baz.js"/>',
|
||||||
'<script async defer src="chrome://foobar.js"/>',
|
'<script async defer src="chrome://foobar.js"/>',
|
||||||
'<script type="application/javascript"/>"hello third"',
|
'<script type="application/javascript"/>"hello third"',
|
||||||
'<script type="application/javascript">"hello fourth"</script>',
|
'<script type="application/javascript">"hello fourth"</script>',
|
||||||
@ -34,7 +34,7 @@ function test() {
|
|||||||
|
|
||||||
is(parsed.getScriptInfo(source.indexOf("hello third!")).toSource(), "({start:-1, length:-1, index:-1})",
|
is(parsed.getScriptInfo(source.indexOf("hello third!")).toSource(), "({start:-1, length:-1, index:-1})",
|
||||||
"Inline script on self-closing tag not considered a script");
|
"Inline script on self-closing tag not considered a script");
|
||||||
is(parsed.getScriptInfo(source.indexOf("hello fourth")).toSource(), "({start:267, length:14, index:4})",
|
is(parsed.getScriptInfo(source.indexOf("hello fourth")).toSource(), "({start:255, length:14, index:4})",
|
||||||
"The fourth script was located correctly.");
|
"The fourth script was located correctly.");
|
||||||
|
|
||||||
finish();
|
finish();
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<title>Web Console test for bug 632347 - generators</title>
|
<title>Web Console test for bug 632347 - generators</title>
|
||||||
<!-- Any copyright is dedicated to the Public Domain.
|
<!-- Any copyright is dedicated to the Public Domain.
|
||||||
http://creativecommons.org/publicdomain/zero/1.0/ -->
|
http://creativecommons.org/publicdomain/zero/1.0/ -->
|
||||||
<script type="application/javascript;version=1.8">
|
<script type="application/javascript">
|
||||||
(function(){
|
(function(){
|
||||||
function genFunc() {
|
function genFunc() {
|
||||||
var a = 5;
|
var a = 5;
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<title>Web Console test for bug 632347 - generators</title>
|
<title>Web Console test for bug 632347 - generators</title>
|
||||||
<!-- Any copyright is dedicated to the Public Domain.
|
<!-- Any copyright is dedicated to the Public Domain.
|
||||||
http://creativecommons.org/publicdomain/zero/1.0/ -->
|
http://creativecommons.org/publicdomain/zero/1.0/ -->
|
||||||
<script type="application/javascript;version=1.8">
|
<script type="application/javascript">
|
||||||
(function(){
|
(function(){
|
||||||
function* genFunc() {
|
function* genFunc() {
|
||||||
var a = 5;
|
var a = 5;
|
||||||
|
@ -1207,12 +1207,22 @@ ParseTypeAttribute(const nsAString& aType, ValidJSVersion* aVersion)
|
|||||||
nsAutoString versionName;
|
nsAutoString versionName;
|
||||||
rv = parser.GetParameter("version", versionName);
|
rv = parser.GetParameter("version", versionName);
|
||||||
|
|
||||||
if (NS_SUCCEEDED(rv)) {
|
if (rv == NS_ERROR_INVALID_ARG) {
|
||||||
*aVersion = ParseJavascriptVersion(versionName);
|
Telemetry::Accumulate(Telemetry::SCRIPT_LOADED_WITH_VERSION, false);
|
||||||
} else if (rv != NS_ERROR_INVALID_ARG) {
|
// Argument not set.
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (NS_FAILED(rv)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
*aVersion = ParseJavascriptVersion(versionName);
|
||||||
|
if (*aVersion == ValidJSVersion::Valid) {
|
||||||
|
Telemetry::Accumulate(Telemetry::SCRIPT_LOADED_WITH_VERSION, true);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<html><body>
|
<html><body>
|
||||||
<iframe id="frame" sandbox="allow-scripts allow-popups"></iframe>
|
<iframe id="frame" sandbox="allow-scripts allow-popups"></iframe>
|
||||||
<script type="application/javascript;version=1.8">
|
<script type="application/javascript">
|
||||||
onmessage = function(e) {
|
onmessage = function(e) {
|
||||||
parent.postMessage(e.data, '*');
|
parent.postMessage(e.data, '*');
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
<body>
|
<body>
|
||||||
<div id="container"></div>
|
<div id="container"></div>
|
||||||
<iframe id="frame"></iframe>
|
<iframe id="frame"></iframe>
|
||||||
<script type="application/javascript;version=1.8">
|
<script type="application/javascript">
|
||||||
var urls = [ "https://example.com/tests/dom/websocket/tests/iframe_webSocket_sandbox.html",
|
var urls = [ "https://example.com/tests/dom/websocket/tests/iframe_webSocket_sandbox.html",
|
||||||
"https://example.com/tests/dom/websocket/tests/iframe_webSocket_sandbox.html?nested",
|
"https://example.com/tests/dom/websocket/tests/iframe_webSocket_sandbox.html?nested",
|
||||||
"https://example.com/tests/dom/websocket/tests/iframe_webSocket_sandbox.html?popup" ];
|
"https://example.com/tests/dom/websocket/tests/iframe_webSocket_sandbox.html?popup" ];
|
||||||
|
@ -13867,5 +13867,13 @@
|
|||||||
"n_buckets": 50,
|
"n_buckets": 50,
|
||||||
"description": "Amount of time in milliseconds the main thread spends waiting for the paint thread to complete, if the time was greater than 200us.",
|
"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]
|
"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."
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user