From dad19047d2d187ec1b9736c947c44131088dcf2d Mon Sep 17 00:00:00 2001
From: flyingrub
Date: Thu, 10 Aug 2017 18:45:19 +0200
Subject: [PATCH 01/87] Bug 1389030 - Go to home when section has no data in
about:telemetry r=chutten
When switching to a ping that hasn't data for the current section go to
home section.
MozReview-Commit-ID: 2zTZUiyHe0M
--HG--
extra : rebase_source : 2abe235c99cf2b0b6579c9fbac940b5bc8a0a532
---
toolkit/content/aboutTelemetry.js | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/toolkit/content/aboutTelemetry.js b/toolkit/content/aboutTelemetry.js
index d0c4171d0414..97fc72eeb4e2 100644
--- a/toolkit/content/aboutTelemetry.js
+++ b/toolkit/content/aboutTelemetry.js
@@ -1899,6 +1899,13 @@ function adjustSearchState() {
}
}
+function adjustSection() {
+ let selectedCategory = document.querySelector(".category.selected");
+ if (!selectedCategory.classList.contains("has-data")) {
+ PingPicker._showStructuredPingData();
+ }
+}
+
/**
* Change the url according to the current section displayed
* e.g about:telemetry#general-data
@@ -2360,11 +2367,12 @@ function displayPingData(ping, updatePayloadList = false) {
try {
PingPicker.render();
displayRichPingData(ping, updatePayloadList);
+ adjustSearchState();
+ adjustSection();
} catch (err) {
console.log(err);
PingPicker._showRawPingData();
}
- adjustSearchState();
}
function displayRichPingData(ping, updatePayloadList) {
From cb7421f53115e15bce09d7c5ad12dd5d97cbba1d Mon Sep 17 00:00:00 2001
From: flyingrub
Date: Tue, 15 Aug 2017 14:22:39 +0200
Subject: [PATCH 02/87] Bug 1389255 - Fix the styling of multitable section in
about:telemetry r=chutten r?chutten
Also some minor css fixes to keyed histogram section.
MozReview-Commit-ID: LkRUBREkGwa
--HG--
extra : rebase_source : 0bf9ae1ae81562f85c4b9437fc0b698db982bc62
---
toolkit/content/aboutTelemetry.css | 13 +++----------
1 file changed, 3 insertions(+), 10 deletions(-)
diff --git a/toolkit/content/aboutTelemetry.css b/toolkit/content/aboutTelemetry.css
index 2459c2028cd5..fe53f52abe08 100644
--- a/toolkit/content/aboutTelemetry.css
+++ b/toolkit/content/aboutTelemetry.css
@@ -207,7 +207,6 @@ body[dir="rtl"] .histogram {
.keyed-histogram {
white-space: nowrap;
- padding: 15px;
position: relative; /* required for position:absolute of the contained .copy-node */
overflow: hidden;
}
@@ -215,7 +214,7 @@ body[dir="rtl"] .histogram {
.keyed-histogram-title {
text-overflow: ellipsis;
width: 100%;
- margin: 10px;
+ margin: 12px 0;
font-weight: bold;
font-size: 120%;
white-space: nowrap;
@@ -274,10 +273,9 @@ body[dir="rtl"] th {
}
caption {
- font-weight: bold;
- white-space: nowrap;
text-align: left;
- font-size: large;
+ font-size: xx-large;
+ margin: 1em 0 0.5em 0;
}
body[dir="rtl"] caption {
@@ -302,8 +300,3 @@ body[dir="rtl"] .copy-node {
#raw-ping-data {
font-size: 15px;
}
-
-caption {
- font-size: larger;
- margin: 5px 0;
-}
\ No newline at end of file
From 163ee806174a5824bbbcbb55c518eca742115cc3 Mon Sep 17 00:00:00 2001
From: Gijs Kruitbosch
Date: Tue, 15 Aug 2017 12:02:11 +0100
Subject: [PATCH 03/87] Bug 1390260 - make customize mode work in popup
windows, r=mkaply
MozReview-Commit-ID: 7lokGRuqNHv
--HG--
extra : rebase_source : 0015e3c60e97f117ddf3a72410f455e648a1138e
---
.../components/customizableui/CustomizeMode.jsm | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/browser/components/customizableui/CustomizeMode.jsm b/browser/components/customizableui/CustomizeMode.jsm
index bb46beb9c453..18e397b174c5 100644
--- a/browser/components/customizableui/CustomizeMode.jsm
+++ b/browser/components/customizableui/CustomizeMode.jsm
@@ -203,6 +203,21 @@ CustomizeMode.prototype = {
},
enter() {
+ if (!this.window.toolbar.visible) {
+ let w = this.window.getTopWin(true);
+ if (w) {
+ w.gCustomizeMode.enter();
+ return;
+ }
+ let obs = () => {
+ Services.obs.removeObserver(obs, "browser-delayed-startup-finished");
+ w = this.window.getTopWin(true);
+ w.gCustomizeMode.enter();
+ };
+ Services.obs.addObserver(obs, "browser-delayed-startup-finished");
+ this.window.openUILinkIn("about:newtab", "window");
+ return;
+ }
this._wantToBeInCustomizeMode = true;
if (this._customizing || this._handler.isEnteringCustomizeMode) {
From d0f97efd430a96fe0f07abbe7d1033a1d1507565 Mon Sep 17 00:00:00 2001
From: Gijs Kruitbosch
Date: Tue, 15 Aug 2017 17:42:16 +0100
Subject: [PATCH 04/87] Bug 1390260 - remove old customize test, add test that
checks it works in main window, r=mkaply
MozReview-Commit-ID: 9Tm8kLjxukB
--HG--
extra : rebase_source : a8d599d6e67151abdc2b65297b5cb5fcbc2dbea7
---
browser/base/content/test/general/browser.ini | 2 -
.../content/test/general/browser_bug422590.js | 59 -------------------
.../customizableui/test/browser.ini | 1 +
.../test/browser_open_from_popup.js | 19 ++++++
4 files changed, 20 insertions(+), 61 deletions(-)
delete mode 100644 browser/base/content/test/general/browser_bug422590.js
create mode 100644 browser/components/customizableui/test/browser_open_from_popup.js
diff --git a/browser/base/content/test/general/browser.ini b/browser/base/content/test/general/browser.ini
index 1b22c092a039..5bc26d6643f1 100644
--- a/browser/base/content/test/general/browser.ini
+++ b/browser/base/content/test/general/browser.ini
@@ -131,8 +131,6 @@ skip-if = true # browser_bug321000.js is disabled because newline handling is sh
# DO NOT ADD MORE TESTS HERE. USE A TOPICAL DIRECTORY INSTEAD.
[browser_bug419612.js]
# DO NOT ADD MORE TESTS HERE. USE A TOPICAL DIRECTORY INSTEAD.
-[browser_bug422590.js]
-# DO NOT ADD MORE TESTS HERE. USE A TOPICAL DIRECTORY INSTEAD.
[browser_bug423833.js]
skip-if = true # bug 428712
# DO NOT ADD MORE TESTS HERE. USE A TOPICAL DIRECTORY INSTEAD.
diff --git a/browser/base/content/test/general/browser_bug422590.js b/browser/base/content/test/general/browser_bug422590.js
deleted file mode 100644
index 4be14c54ccf7..000000000000
--- a/browser/base/content/test/general/browser_bug422590.js
+++ /dev/null
@@ -1,59 +0,0 @@
-function test() {
- waitForExplicitFinish();
-
- // test a normal browser window
- var newWin = openDialog(getBrowserURL(), "_blank", "chrome,all,dialog=no", "about:blank");
- ok(newWin, "got new normal window");
-
- whenDelayedStartupFinished(newWin, function() {
- testCustomize(newWin, function() {
- newWin.close();
- testChromeless();
- });
- });
-}
-
-function testChromeless() {
- // test a chromeless window
- var newWin = openDialog(getBrowserURL(), "_blank",
- "chrome,dialog=no,location=yes,toolbar=no", "about:blank");
- ok(newWin, "got new window");
-
- whenDelayedStartupFinished(newWin, function() {
- // Check that the search bar is hidden
- var searchBar = newWin.BrowserSearch.searchBar;
- ok(searchBar, "got search bar");
-
- var searchBarBO = searchBar.boxObject;
- is(searchBarBO.width, 0, "search bar hidden");
- is(searchBarBO.height, 0, "search bar hidden");
-
- testCustomize(newWin, function() {
- newWin.close();
- finish();
- });
- });
-}
-
-function testCustomize(aWindow, aCallback) {
- var fileMenu = aWindow.document.getElementById("file-menu");
- ok(fileMenu, "got file menu");
- is(fileMenu.disabled, false, "file menu initially enabled");
-
- openToolbarCustomizationUI(function() {
- // Can't use the property, since the binding may have since been removed
- // if the element is hidden (see bug 422590)
- is(fileMenu.getAttribute("disabled"), "true",
- "file menu is disabled during toolbar customization");
-
- closeToolbarCustomizationUI(onClose, aWindow);
- }, aWindow);
-
- function onClose() {
- is(fileMenu.getAttribute("disabled"), "false",
- "file menu is enabled after toolbar customization");
-
- if (aCallback)
- aCallback();
- }
-}
diff --git a/browser/components/customizableui/test/browser.ini b/browser/components/customizableui/test/browser.ini
index d3ff34012010..6edeb8c8930b 100644
--- a/browser/components/customizableui/test/browser.ini
+++ b/browser/components/customizableui/test/browser.ini
@@ -156,5 +156,6 @@ tags = fullscreen
[browser_editcontrols_update.js]
subsuite = clipboard
[browser_customization_context_menus.js]
+[browser_open_from_popup.js]
[browser_sidebar_toggle.js]
[browser_remote_tabs_button.js]
diff --git a/browser/components/customizableui/test/browser_open_from_popup.js b/browser/components/customizableui/test/browser_open_from_popup.js
new file mode 100644
index 000000000000..744c0201c624
--- /dev/null
+++ b/browser/components/customizableui/test/browser_open_from_popup.js
@@ -0,0 +1,19 @@
+"use strict";
+
+/**
+ * Check that opening customize mode in a popup opens it in the main window.
+ */
+add_task(async function open_customize_mode_from_popup() {
+ let promiseWindow = BrowserTestUtils.waitForNewWindow(true);
+ ContentTask.spawn(gBrowser.selectedBrowser, null, function() {
+ content.window.open("about:blank", "_blank", "height=300,toolbar=no");
+ });
+ let win = await promiseWindow;
+ let customizePromise = BrowserTestUtils.waitForEvent(gNavToolbox, "customizationready");
+ win.gCustomizeMode.enter();
+ await customizePromise;
+ ok(document.documentElement.hasAttribute("customizing"),
+ "Should have opened customize mode in the parent window");
+ await endCustomizing();
+ await BrowserTestUtils.closeWindow(win);
+});
From 3afc31df222bd9bd4a088b69971ceb9d141cf574 Mon Sep 17 00:00:00 2001
From: Masatoshi Kimura
Date: Mon, 14 Aug 2017 20:38:59 +0900
Subject: [PATCH 05/87] Bug 1390106 - Stop using versioned scripts in
addon-sdk. r=mossop
MozReview-Commit-ID: C5122oYHTWx
--HG--
extra : rebase_source : 90f0846b9d9ca3543a16b28f8ae9bd00d56e4173
---
addon-sdk/source/lib/sdk/deprecated/window-utils.js | 4 ++--
addon-sdk/source/lib/sdk/lang/weak-set.js | 4 ++--
addon-sdk/source/lib/sdk/util/collection.js | 2 +-
addon-sdk/source/lib/sdk/util/list.js | 13 -------------
4 files changed, 5 insertions(+), 18 deletions(-)
diff --git a/addon-sdk/source/lib/sdk/deprecated/window-utils.js b/addon-sdk/source/lib/sdk/deprecated/window-utils.js
index 93c0ab7b8e86..962314bc8737 100644
--- a/addon-sdk/source/lib/sdk/deprecated/window-utils.js
+++ b/addon-sdk/source/lib/sdk/deprecated/window-utils.js
@@ -31,7 +31,7 @@ function getWindows() {
* @return A generator that yields XUL windows exposing the
* nsIDOMWindow interface.
*/
-function windowIterator() {
+function* windowIterator() {
// Bug 752631: We only pass already loaded window in order to avoid
// breaking XUL windows DOM. DOM is broken when some JS code try
// to access DOM during "uninitialized" state of the related document.
@@ -48,7 +48,7 @@ exports.windowIterator = windowIterator;
* A generator that yields browser windows exposing the `nsIDOMWindow`
* interface.
*/
-function browserWindowIterator() {
+function* browserWindowIterator() {
for (let window of windowIterator()) {
if (isBrowser(window))
yield window;
diff --git a/addon-sdk/source/lib/sdk/lang/weak-set.js b/addon-sdk/source/lib/sdk/lang/weak-set.js
index 8972602a50c1..6adc9b11216f 100644
--- a/addon-sdk/source/lib/sdk/lang/weak-set.js
+++ b/addon-sdk/source/lib/sdk/lang/weak-set.js
@@ -54,7 +54,7 @@ function clear(target) {
}
exports.clear = clear;
-function iterator(target) {
+function* iterator(target) {
let refs = getRefsFor(target);
for (let ref of refs) {
@@ -72,4 +72,4 @@ function iterator(target) {
refs.delete(ref);
}
}
-exports.iterator = iterator;
+exports[Symbol.iterator] = iterator;
diff --git a/addon-sdk/source/lib/sdk/util/collection.js b/addon-sdk/source/lib/sdk/util/collection.js
index 194a2947087d..9af07c4e9629 100644
--- a/addon-sdk/source/lib/sdk/util/collection.js
+++ b/addon-sdk/source/lib/sdk/util/collection.js
@@ -57,7 +57,7 @@ function Collection(array) {
* Provides iteration over the collection. Items are yielded in the order
* they were added.
*/
- this.__iterator__ = function Collection___iterator__() {
+ this[Symbol.iterator] = function* Collection___iterator__() {
let items = array.slice();
for (let i = 0; i < items.length; i++)
yield items[i];
diff --git a/addon-sdk/source/lib/sdk/util/list.js b/addon-sdk/source/lib/sdk/util/list.js
index 6d7d2dea9d92..e8afe50eac25 100644
--- a/addon-sdk/source/lib/sdk/util/list.js
+++ b/addon-sdk/source/lib/sdk/util/list.js
@@ -37,19 +37,6 @@ const listOptions = {
toString: function toString() {
return 'List(' + listNS(this).keyValueMap + ')';
},
- /**
- * Custom iterator providing `List`s enumeration behavior.
- * We cant reuse `_iterator` that is defined by `Iterable` since it provides
- * iteration in an arbitrary order.
- * @see https://developer.mozilla.org/en/JavaScript/Reference/Statements/for...in
- * @param {Boolean} onKeys
- */
- __iterator__: function __iterator__(onKeys, onKeyValue) {
- let array = listNS(this).keyValueMap.slice(0),
- i = -1;
- for (let element of array)
- yield onKeyValue ? [++i, element] : onKeys ? ++i : element;
- },
};
listOptions[Symbol.iterator] = function iterator() {
return listNS(this).keyValueMap.slice(0)[Symbol.iterator]();
From 38894511bc41c37b974645822ee0511c0cfe2d25 Mon Sep 17 00:00:00 2001
From: Masatoshi Kimura
Date: Mon, 14 Aug 2017 20:42:55 +0900
Subject: [PATCH 06/87] Bug 1390106 - Stop using versioned scripts in dom.
r=mrbkap
MozReview-Commit-ID: 89KvCoTAg3I
--HG--
extra : rebase_source : 24831fa454a1cc6fff70a9b1eb509d0f5aeb800a
---
dom/base/nsFrameMessageManager.cpp | 4 ++--
dom/security/test/cors/browser_CORS-console-warnings.js | 2 +-
dom/workers/RuntimeService.cpp | 2 +-
dom/workers/ScriptLoader.cpp | 2 +-
dom/xbl/nsXBLProtoImplField.cpp | 2 +-
dom/xbl/nsXBLProtoImplMethod.cpp | 2 +-
dom/xbl/nsXBLProtoImplProperty.cpp | 4 ++--
dom/xbl/nsXBLPrototypeHandler.cpp | 2 +-
dom/xul/nsXULContentSink.cpp | 6 +++---
9 files changed, 13 insertions(+), 13 deletions(-)
diff --git a/dom/base/nsFrameMessageManager.cpp b/dom/base/nsFrameMessageManager.cpp
index 15c40ee21996..ebf6ddf6872f 100644
--- a/dom/base/nsFrameMessageManager.cpp
+++ b/dom/base/nsFrameMessageManager.cpp
@@ -1662,7 +1662,7 @@ nsMessageManagerScriptExecutor::TryCacheLoadAndCompileScript(
return;
}
- JS::CompileOptions options(cx, JSVERSION_LATEST);
+ JS::CompileOptions options(cx, JSVERSION_DEFAULT);
options.setFileAndLine(url.get(), 1);
options.setNoScriptRval(true);
@@ -1728,7 +1728,7 @@ nsMessageManagerScriptExecutor::InitChildGlobalInternal(
JS::CompartmentOptions options;
options.creationOptions().setSystemZone();
- options.behaviors().setVersion(JSVERSION_LATEST);
+ options.behaviors().setVersion(JSVERSION_DEFAULT);
if (xpc::SharedMemoryEnabled()) {
options.creationOptions().setSharedMemoryAndAtomicsEnabled(true);
diff --git a/dom/security/test/cors/browser_CORS-console-warnings.js b/dom/security/test/cors/browser_CORS-console-warnings.js
index 451d3a59410a..b4b90e3f058c 100644
--- a/dom/security/test/cors/browser_CORS-console-warnings.js
+++ b/dom/security/test/cors/browser_CORS-console-warnings.js
@@ -27,7 +27,7 @@ function on_new_message(event, new_messages) {
}
}
-function do_cleanup() {
+function* do_cleanup() {
if (webconsole) {
webconsole.ui.off("new-messages", on_new_message);
}
diff --git a/dom/workers/RuntimeService.cpp b/dom/workers/RuntimeService.cpp
index fdbdca8a31aa..ff1e7319614c 100644
--- a/dom/workers/RuntimeService.cpp
+++ b/dom/workers/RuntimeService.cpp
@@ -2020,7 +2020,7 @@ RuntimeService::Init()
if (!sDefaultJSSettings.gcSettings[0].IsSet()) {
sDefaultJSSettings.contextOptions = JS::ContextOptions();
sDefaultJSSettings.chrome.maxScriptRuntime = -1;
- sDefaultJSSettings.chrome.compartmentOptions.behaviors().setVersion(JSVERSION_LATEST);
+ sDefaultJSSettings.chrome.compartmentOptions.behaviors().setVersion(JSVERSION_DEFAULT);
sDefaultJSSettings.content.maxScriptRuntime = MAX_SCRIPT_RUN_TIME_SEC;
#ifdef JS_GC_ZEAL
sDefaultJSSettings.gcZealFrequency = JS_DEFAULT_ZEAL_FREQ;
diff --git a/dom/workers/ScriptLoader.cpp b/dom/workers/ScriptLoader.cpp
index 582a2131ceb1..0948e8b1f860 100644
--- a/dom/workers/ScriptLoader.cpp
+++ b/dom/workers/ScriptLoader.cpp
@@ -1961,7 +1961,7 @@ ScriptExecutorRunnable::WorkerRun(JSContext* aCx, WorkerPrivate* aWorkerPrivate)
.setNoScriptRval(true);
if (mScriptLoader.mWorkerScriptType == DebuggerScript) {
- options.setVersion(JSVERSION_LATEST);
+ options.setVersion(JSVERSION_DEFAULT);
}
MOZ_ASSERT(loadInfo.mMutedErrorFlag.isSome());
diff --git a/dom/xbl/nsXBLProtoImplField.cpp b/dom/xbl/nsXBLProtoImplField.cpp
index 28da50e03b52..cca6a83d9cb7 100644
--- a/dom/xbl/nsXBLProtoImplField.cpp
+++ b/dom/xbl/nsXBLProtoImplField.cpp
@@ -434,7 +434,7 @@ nsXBLProtoImplField::InstallField(JS::Handle aBoundNode,
JS::Rooted result(cx);
JS::CompileOptions options(cx);
options.setFileAndLine(uriSpec.get(), mLineNumber)
- .setVersion(JSVERSION_LATEST);
+ .setVersion(JSVERSION_DEFAULT);
JS::AutoObjectVector scopeChain(cx);
if (!nsJSUtils::GetScopeChainForElement(cx, boundElement, scopeChain)) {
return NS_ERROR_OUT_OF_MEMORY;
diff --git a/dom/xbl/nsXBLProtoImplMethod.cpp b/dom/xbl/nsXBLProtoImplMethod.cpp
index 31b215ab37cc..39a51a70b0ba 100644
--- a/dom/xbl/nsXBLProtoImplMethod.cpp
+++ b/dom/xbl/nsXBLProtoImplMethod.cpp
@@ -193,7 +193,7 @@ nsXBLProtoImplMethod::CompileMember(AutoJSAPI& jsapi, const nsString& aClassStr,
JS::CompileOptions options(cx);
options.setFileAndLine(functionUri.get(),
uncompiledMethod->mBodyText.GetLineNumber())
- .setVersion(JSVERSION_LATEST);
+ .setVersion(JSVERSION_DEFAULT);
JS::Rooted methodObject(cx);
JS::AutoObjectVector emptyVector(cx);
nsresult rv = nsJSUtils::CompileFunction(jsapi, emptyVector, options, cname,
diff --git a/dom/xbl/nsXBLProtoImplProperty.cpp b/dom/xbl/nsXBLProtoImplProperty.cpp
index a821ee0f1bdc..9a366ce9ab8b 100644
--- a/dom/xbl/nsXBLProtoImplProperty.cpp
+++ b/dom/xbl/nsXBLProtoImplProperty.cpp
@@ -199,7 +199,7 @@ nsXBLProtoImplProperty::CompileMember(AutoJSAPI& jsapi, const nsString& aClassSt
JSAutoCompartment ac(cx, aClassObject);
JS::CompileOptions options(cx);
options.setFileAndLine(functionUri.get(), getterText->GetLineNumber())
- .setVersion(JSVERSION_LATEST);
+ .setVersion(JSVERSION_DEFAULT);
nsCString name = NS_LITERAL_CSTRING("get_") + NS_ConvertUTF16toUTF8(mName);
JS::Rooted getterObject(cx);
JS::AutoObjectVector emptyVector(cx);
@@ -245,7 +245,7 @@ nsXBLProtoImplProperty::CompileMember(AutoJSAPI& jsapi, const nsString& aClassSt
JSAutoCompartment ac(cx, aClassObject);
JS::CompileOptions options(cx);
options.setFileAndLine(functionUri.get(), setterText->GetLineNumber())
- .setVersion(JSVERSION_LATEST);
+ .setVersion(JSVERSION_DEFAULT);
nsCString name = NS_LITERAL_CSTRING("set_") + NS_ConvertUTF16toUTF8(mName);
JS::Rooted setterObject(cx);
JS::AutoObjectVector emptyVector(cx);
diff --git a/dom/xbl/nsXBLPrototypeHandler.cpp b/dom/xbl/nsXBLPrototypeHandler.cpp
index 88e0b8a468d7..968089af3abd 100644
--- a/dom/xbl/nsXBLPrototypeHandler.cpp
+++ b/dom/xbl/nsXBLPrototypeHandler.cpp
@@ -435,7 +435,7 @@ nsXBLPrototypeHandler::EnsureEventHandler(AutoJSAPI& jsapi, nsIAtom* aName,
JSAutoCompartment ac(cx, scopeObject);
JS::CompileOptions options(cx);
options.setFileAndLine(bindingURI.get(), mLineNumber)
- .setVersion(JSVERSION_LATEST);
+ .setVersion(JSVERSION_DEFAULT);
JS::Rooted handlerFun(cx);
JS::AutoObjectVector emptyVector(cx);
diff --git a/dom/xul/nsXULContentSink.cpp b/dom/xul/nsXULContentSink.cpp
index 8e68b7907be1..1cbe4d5ada31 100644
--- a/dom/xul/nsXULContentSink.cpp
+++ b/dom/xul/nsXULContentSink.cpp
@@ -835,7 +835,7 @@ XULContentSinkImpl::OpenScript(const char16_t** aAttributes,
const uint32_t aLineNumber)
{
bool isJavaScript = true;
- uint32_t version = JSVERSION_LATEST;
+ uint32_t version = JSVERSION_DEFAULT;
nsresult rv;
// Look for SRC attribute and look for a LANGUAGE attribute
@@ -861,14 +861,14 @@ XULContentSinkImpl::OpenScript(const char16_t** aAttributes,
if (nsContentUtils::IsJavascriptMIMEType(mimeType)) {
isJavaScript = true;
- version = JSVERSION_LATEST;
+ version = JSVERSION_DEFAULT;
// Get the version string, and ensure that JavaScript supports it.
nsAutoString versionName;
rv = parser.GetParameter("version", versionName);
if (NS_SUCCEEDED(rv)) {
- version = nsContentUtils::ParseJavascriptVersion(versionName);
+ version = JSVERSION_UNKNOWN;
} else if (rv != NS_ERROR_INVALID_ARG) {
return rv;
}
From 6b248fe3cdfc183808f602776e671047e7705a41 Mon Sep 17 00:00:00 2001
From: Masatoshi Kimura
Date: Mon, 14 Aug 2017 20:43:47 +0900
Subject: [PATCH 07/87] Bug 1390106 - Stop using versioned scripts in js/src.
r=luke
MozReview-Commit-ID: IfPBaEr62Mi
--HG--
extra : rebase_source : 0dc69e03fead2713091cfd553d45dd9d1c485d27
---
js/src/gdb/gdb-tests.cpp | 2 +-
js/src/jsapi-tests/testPreserveJitCode.cpp | 2 +-
js/src/jsapi-tests/testWeakMap.cpp | 2 +-
js/src/jsapi-tests/tests.cpp | 2 +-
js/src/shell/js.cpp | 2 +-
js/src/vm/SelfHosting.cpp | 2 +-
6 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/js/src/gdb/gdb-tests.cpp b/js/src/gdb/gdb-tests.cpp
index f5737e13b8f8..edb81c838224 100644
--- a/js/src/gdb/gdb-tests.cpp
+++ b/js/src/gdb/gdb-tests.cpp
@@ -79,7 +79,7 @@ main(int argc, const char** argv)
/* Create the global object. */
JS::CompartmentOptions options;
- options.behaviors().setVersion(JSVERSION_LATEST);
+ options.behaviors().setVersion(JSVERSION_DEFAULT);
RootedObject global(cx, checkPtr(JS_NewGlobalObject(cx, &global_class,
nullptr, JS::FireOnNewGlobalHook, options)));
diff --git a/js/src/jsapi-tests/testPreserveJitCode.cpp b/js/src/jsapi-tests/testPreserveJitCode.cpp
index ad2716cbf88e..583f3ef0e8dc 100644
--- a/js/src/jsapi-tests/testPreserveJitCode.cpp
+++ b/js/src/jsapi-tests/testPreserveJitCode.cpp
@@ -91,7 +91,7 @@ createTestGlobal(bool preserveJitCode)
{
JS::CompartmentOptions options;
options.creationOptions().setPreserveJitCode(preserveJitCode);
- options.behaviors().setVersion(JSVERSION_LATEST);
+ options.behaviors().setVersion(JSVERSION_DEFAULT);
return JS_NewGlobalObject(cx, getGlobalClass(), nullptr, JS::FireOnNewGlobalHook, options);
}
END_TEST(test_PreserveJitCode)
diff --git a/js/src/jsapi-tests/testWeakMap.cpp b/js/src/jsapi-tests/testWeakMap.cpp
index 5cecea1b02f1..7376a66a891b 100644
--- a/js/src/jsapi-tests/testWeakMap.cpp
+++ b/js/src/jsapi-tests/testWeakMap.cpp
@@ -237,7 +237,7 @@ JSObject* newDelegate()
/* Create the global object. */
JS::CompartmentOptions options;
- options.behaviors().setVersion(JSVERSION_LATEST);
+ options.behaviors().setVersion(JSVERSION_DEFAULT);
JS::RootedObject global(cx, JS_NewGlobalObject(cx, Jsvalify(&delegateClass), nullptr,
JS::FireOnNewGlobalHook, options));
diff --git a/js/src/jsapi-tests/tests.cpp b/js/src/jsapi-tests/tests.cpp
index 7a11a4d3de0a..cfd29c429702 100644
--- a/js/src/jsapi-tests/tests.cpp
+++ b/js/src/jsapi-tests/tests.cpp
@@ -87,7 +87,7 @@ JSObject* JSAPITest::createGlobal(JSPrincipals* principals)
options.creationOptions().setStreamsEnabled(true);
#endif
printf("enabled\n");
- options.behaviors().setVersion(JSVERSION_LATEST);
+ options.behaviors().setVersion(JSVERSION_DEFAULT);
newGlobal = JS_NewGlobalObject(cx, getGlobalClass(), principals, JS::FireOnNewGlobalHook,
options);
if (!newGlobal)
diff --git a/js/src/shell/js.cpp b/js/src/shell/js.cpp
index 16889ef5a7d4..c8c73b24ea9f 100644
--- a/js/src/shell/js.cpp
+++ b/js/src/shell/js.cpp
@@ -631,7 +631,7 @@ InitModuleLoader(JSContext* cx)
options.setFileAndLine("shell/ModuleLoader.js", 1);
options.setSelfHostingMode(false);
options.setCanLazilyParse(false);
- options.setVersion(JSVERSION_LATEST);
+ options.setVersion(JSVERSION_DEFAULT);
options.werrorOption = true;
options.strictOption = true;
diff --git a/js/src/vm/SelfHosting.cpp b/js/src/vm/SelfHosting.cpp
index dd9e7861fcf8..43fcb9acc18c 100644
--- a/js/src/vm/SelfHosting.cpp
+++ b/js/src/vm/SelfHosting.cpp
@@ -2604,7 +2604,7 @@ js::FillSelfHostingCompileOptions(CompileOptions& options)
options.setFileAndLine("self-hosted", 1);
options.setSelfHostingMode(true);
options.setCanLazilyParse(false);
- options.setVersion(JSVERSION_LATEST);
+ options.setVersion(JSVERSION_DEFAULT);
options.werrorOption = true;
options.strictOption = true;
From 43dd1b22aff26a4a0209e6078dd723e60224a5de Mon Sep 17 00:00:00 2001
From: Masatoshi Kimura
Date: Mon, 14 Aug 2017 20:45:14 +0900
Subject: [PATCH 08/87] Bug 1390106 - Stop using versioned scripts in
js/xpconnect. r=mccr8
MozReview-Commit-ID: LP7bXQd7ahD
--HG--
extra : rebase_source : b0d3b9052d333698dbb1e6e6a0da9556fe60a91b
---
js/xpconnect/loader/ScriptPreloader.cpp | 2 +-
js/xpconnect/loader/mozJSComponentLoader.cpp | 4 ++--
js/xpconnect/loader/mozJSSubScriptLoader.cpp | 2 +-
js/xpconnect/src/XPCComponents.cpp | 12 ++++--------
js/xpconnect/src/XPCShellImpl.cpp | 2 +-
js/xpconnect/tests/chrome/test_bug596580.xul | 2 +-
js/xpconnect/tests/unit/test_xrayed_iterator.js | 10 +++++-----
7 files changed, 15 insertions(+), 19 deletions(-)
diff --git a/js/xpconnect/loader/ScriptPreloader.cpp b/js/xpconnect/loader/ScriptPreloader.cpp
index e12976805a52..437c11bc48b8 100644
--- a/js/xpconnect/loader/ScriptPreloader.cpp
+++ b/js/xpconnect/loader/ScriptPreloader.cpp
@@ -998,7 +998,7 @@ ScriptPreloader::DecodeNextBatch(size_t chunkSize)
MOZ_RELEASE_ASSERT(jsapi.Init(xpc::CompilationScope()));
JSContext* cx = jsapi.cx();
- JS::CompileOptions options(cx, JSVERSION_LATEST);
+ JS::CompileOptions options(cx, JSVERSION_DEFAULT);
options.setNoScriptRval(true)
.setSourceIsLazy(true);
diff --git a/js/xpconnect/loader/mozJSComponentLoader.cpp b/js/xpconnect/loader/mozJSComponentLoader.cpp
index e9723c1f7ef5..7fac937a982a 100644
--- a/js/xpconnect/loader/mozJSComponentLoader.cpp
+++ b/js/xpconnect/loader/mozJSComponentLoader.cpp
@@ -472,7 +472,7 @@ mozJSComponentLoader::CreateLoaderGlobal(JSContext* aCx,
.setSystemZone()
.setAddonId(aAddonID);
- options.behaviors().setVersion(JSVERSION_LATEST);
+ options.behaviors().setVersion(JSVERSION_DEFAULT);
if (xpc::SharedMemoryEnabled())
options.creationOptions().setSharedMemoryAndAtomicsEnabled(true);
@@ -650,7 +650,7 @@ mozJSComponentLoader::ObjectForLocation(ComponentLoaderInfo& aInfo,
// See bug 1303754.
CompileOptions options(cx);
options.setNoScriptRval(true)
- .setVersion(JSVERSION_LATEST)
+ .setVersion(JSVERSION_DEFAULT)
.setFileAndLine(nativePath.get(), 1)
.setSourceIsLazy(cache || ScriptPreloader::GetSingleton().Active());
diff --git a/js/xpconnect/loader/mozJSSubScriptLoader.cpp b/js/xpconnect/loader/mozJSSubScriptLoader.cpp
index 9e610b92f2df..563830262ef5 100644
--- a/js/xpconnect/loader/mozJSSubScriptLoader.cpp
+++ b/js/xpconnect/loader/mozJSSubScriptLoader.cpp
@@ -138,7 +138,7 @@ PrepareScript(nsIURI* uri,
{
JS::CompileOptions options(cx);
options.setFileAndLine(uriStr, 1)
- .setVersion(JSVERSION_LATEST)
+ .setVersion(JSVERSION_DEFAULT)
.setNoScriptRval(!wantReturnValue);
if (!charset.IsVoid()) {
char16_t* scriptBuf = nullptr;
diff --git a/js/xpconnect/src/XPCComponents.cpp b/js/xpconnect/src/XPCComponents.cpp
index e3f1c01c4f60..c677bcdfc24a 100644
--- a/js/xpconnect/src/XPCComponents.cpp
+++ b/js/xpconnect/src/XPCComponents.cpp
@@ -2402,16 +2402,12 @@ nsXPCComponents_Utils::EvalInSandbox(const nsAString& source,
if (!bytes)
return NS_ERROR_INVALID_ARG;
- jsVersion = JS_StringToVersion(bytes.ptr());
- // Explicitly check for "latest", which we support for sandboxes but
- // isn't in the set of web-exposed version strings.
- if (jsVersion == JSVERSION_UNKNOWN &&
- !strcmp(bytes.ptr(), "latest"))
+ // Treat non-default version designation as default.
+ if (JS_StringToVersion(bytes.ptr()) == JSVERSION_UNKNOWN &&
+ strcmp(bytes.ptr(), "latest"))
{
- jsVersion = JSVERSION_LATEST;
- }
- if (jsVersion == JSVERSION_UNKNOWN)
return NS_ERROR_INVALID_ARG;
+ }
}
// Optional fourth and fifth arguments: filename and line number.
diff --git a/js/xpconnect/src/XPCShellImpl.cpp b/js/xpconnect/src/XPCShellImpl.cpp
index 46439c23ba85..ae5b64563779 100644
--- a/js/xpconnect/src/XPCShellImpl.cpp
+++ b/js/xpconnect/src/XPCShellImpl.cpp
@@ -1433,7 +1433,7 @@ XRE_XPCShellMain(int argc, char** argv, char** envp,
options.creationOptions().setNewZoneInSystemZoneGroup();
if (xpc::SharedMemoryEnabled())
options.creationOptions().setSharedMemoryAndAtomicsEnabled(true);
- options.behaviors().setVersion(JSVERSION_LATEST);
+ options.behaviors().setVersion(JSVERSION_DEFAULT);
nsCOMPtr holder;
rv = nsXPConnect::XPConnect()->
InitClassesWithNewWrappedGlobal(cx,
diff --git a/js/xpconnect/tests/chrome/test_bug596580.xul b/js/xpconnect/tests/chrome/test_bug596580.xul
index fab7058ac14d..9bd8354590ae 100644
--- a/js/xpconnect/tests/chrome/test_bug596580.xul
+++ b/js/xpconnect/tests/chrome/test_bug596580.xul
@@ -14,7 +14,7 @@
+
+
+
+