This is an automated email from the git hooks/post-receive script.
pierov pushed a change to branch geckoview-96.0.3-11.0-1 in repository tor-browser.
from e423b6c4bc10b squash! TB4: Tor Browser's Firefox preference overrides. new b34f03b3d2227 Bug 1770137 - Make notification code use Object.create. r=Gijs,freddyb new c99d40a267993 Bug 1770137 - Part 2, r=Gijs new 6ddb87320f760 Bug 1770048: Improve self-hosted new_List r=jandem,tcampbell,a=dsmith
The 3 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference.
Summary of changes: dom/notification/old/NotificationDB.jsm | 19 ++++++++++--------- js/src/builtin/Array.cpp | 19 +++++++++++++++++++ js/src/builtin/Array.h | 2 ++ js/src/builtin/Module.js | 16 ++++++++-------- js/src/builtin/RegExp.js | 6 +++--- js/src/builtin/Utilities.js | 11 +---------- js/src/vm/SelfHosting.cpp | 1 + 7 files changed, 44 insertions(+), 30 deletions(-)
This is an automated email from the git hooks/post-receive script.
pierov pushed a commit to branch geckoview-96.0.3-11.0-1 in repository tor-browser.
commit b34f03b3d22275e8647498b068e257a9e23d2ac9 Author: Peter Van der Beken peterv@propagandism.org AuthorDate: Thu May 19 14:31:53 2022 +0000
Bug 1770137 - Make notification code use Object.create. r=Gijs,freddyb
Differential Revision: https://phabricator.services.mozilla.com/D146798 --- dom/notification/old/NotificationDB.jsm | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/dom/notification/old/NotificationDB.jsm b/dom/notification/old/NotificationDB.jsm index e950404f500b7..eb27b6782ff7a 100644 --- a/dom/notification/old/NotificationDB.jsm +++ b/dom/notification/old/NotificationDB.jsm @@ -40,8 +40,8 @@ var NotificationDB = { return; }
- this.notifications = {}; - this.byTag = {}; + this.notifications = Object.create(null); + this.byTag = Object.create(null); this.loaded = false;
this.tasks = []; // read/write operation queue @@ -111,7 +111,7 @@ var NotificationDB = { // populate the list of notifications by tag if (this.notifications) { for (var origin in this.notifications) { - this.byTag[origin] = {}; + this.byTag[origin] = Object.create(null); for (var id in this.notifications[origin]) { var curNotification = this.notifications[origin][id]; if (curNotification.tag) { @@ -344,8 +344,8 @@ var NotificationDB = { var origin = data.origin; var notification = data.notification; if (!this.notifications[origin]) { - this.notifications[origin] = {}; - this.byTag[origin] = {}; + this.notifications[origin] = Object.create(null); + this.byTag[origin] = Object.create(null); }
// We might have existing notification with this tag,
This is an automated email from the git hooks/post-receive script.
pierov pushed a commit to branch geckoview-96.0.3-11.0-1 in repository tor-browser.
commit c99d40a2679939a413c90ea91698af6f8dc0b5fa Author: Nika Layzell nika@thelayzells.com AuthorDate: Thu May 19 21:51:15 2022 +0000
Bug 1770137 - Part 2, r=Gijs
Differential Revision: https://phabricator.services.mozilla.com/D146851 --- dom/notification/old/NotificationDB.jsm | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/dom/notification/old/NotificationDB.jsm b/dom/notification/old/NotificationDB.jsm index eb27b6782ff7a..4d52c96c1aa9c 100644 --- a/dom/notification/old/NotificationDB.jsm +++ b/dom/notification/old/NotificationDB.jsm @@ -75,13 +75,14 @@ var NotificationDB = { },
filterNonAppNotifications(notifications) { + let result = Object.create(null); for (let origin in notifications) { + result[origin] = Object.create(null); let persistentNotificationCount = 0; for (let id in notifications[origin]) { if (notifications[origin][id].serviceWorkerRegistrationScope) { persistentNotificationCount++; - } else { - delete notifications[origin][id]; + result[origin][id] = notifications[origin][id]; } } if (persistentNotificationCount == 0) { @@ -90,11 +91,11 @@ var NotificationDB = { "Origin " + origin + " is not linked to an app manifest, deleting." ); } - delete notifications[origin]; + delete result[origin]; } }
- return notifications; + return result; },
// Attempt to read notification file, if it's not there we will create it.
This is an automated email from the git hooks/post-receive script.
pierov pushed a commit to branch geckoview-96.0.3-11.0-1 in repository tor-browser.
commit 6ddb87320f7602dee517ef0bdd465da9ca30998b Author: Iain Ireland iireland@mozilla.com AuthorDate: Thu May 19 14:30:10 2022 +0000
Bug 1770048: Improve self-hosted new_List r=jandem,tcampbell,a=dsmith
Differential Revision: https://phabricator.services.mozilla.com/D146760 --- js/src/builtin/Array.cpp | 19 +++++++++++++++++++ js/src/builtin/Array.h | 2 ++ js/src/builtin/Module.js | 16 ++++++++-------- js/src/builtin/RegExp.js | 6 +++--- js/src/builtin/Utilities.js | 11 +---------- js/src/vm/SelfHosting.cpp | 1 + 6 files changed, 34 insertions(+), 21 deletions(-)
diff --git a/js/src/builtin/Array.cpp b/js/src/builtin/Array.cpp index 5df078df1d00b..af6b8c5f7db06 100644 --- a/js/src/builtin/Array.cpp +++ b/js/src/builtin/Array.cpp @@ -4503,3 +4503,22 @@ JS_PUBLIC_API bool JS::SetArrayLength(JSContext* cx, Handle<JSObject*> obj,
return SetLengthProperty(cx, obj, length); } + +bool js::intrinsic_newList(JSContext* cx, unsigned argc, js::Value* vp) { + CallArgs args = CallArgsFromVp(argc, vp); + MOZ_ASSERT(args.length() == 0); + + RootedShape shape(cx, GetArrayShapeWithProto(cx, nullptr)); + if (!shape) { + return false; + } + + uint32_t length = 0; + ArrayObject* list = ::NewArrayWithShape<0>(cx, shape, length, GenericObject); + if (!list) { + return false; + } + + args.rval().setObject(*list); + return true; +} diff --git a/js/src/builtin/Array.h b/js/src/builtin/Array.h index 518ecd673627d..280ff922236c7 100644 --- a/js/src/builtin/Array.h +++ b/js/src/builtin/Array.h @@ -123,6 +123,8 @@ extern bool array_slice(JSContext* cx, unsigned argc, js::Value* vp); extern JSObject* ArraySliceDense(JSContext* cx, HandleObject obj, int32_t begin, int32_t end, HandleObject result);
+extern bool intrinsic_newList(JSContext* cx, unsigned argc, js::Value* vp); + /* * Append the given (non-hole) value to the end of an array. The array must be * a newborn array -- that is, one which has not been exposed to script for diff --git a/js/src/builtin/Module.js b/js/src/builtin/Module.js index 55648c6630437..0aadc5d359358 100644 --- a/js/src/builtin/Module.js +++ b/js/src/builtin/Module.js @@ -14,7 +14,7 @@ function CallModuleResolveHook(module, moduleRequest, expectedMinimumStatus)
// https://tc39.es/ecma262/#sec-getexportednames // ES2020 15.2.1.17.2 GetExportedNames -function ModuleGetExportedNames(exportStarSet = []) +function ModuleGetExportedNames(exportStarSet = new_List()) { if (!IsObject(this) || !IsModule(this)) { return callFunction(CallModuleMethodIfWrapped, this, exportStarSet, @@ -26,13 +26,13 @@ function ModuleGetExportedNames(exportStarSet = [])
// Step 4 if (callFunction(ArrayIncludes, exportStarSet, module)) - return []; + return new_List();
// Step 5 DefineDataProperty(exportStarSet, exportStarSet.length, module);
// Step 6 - let exportedNames = []; + let exportedNames = new_List(); let namesCount = 0;
// Step 7 @@ -99,7 +99,7 @@ function ModuleSetStatus(module, newStatus) // - If the request is found to be ambiguous, the string `"ambiguous"` is // returned. // -function ModuleResolveExport(exportName, resolveSet = []) +function ModuleResolveExport(exportName, resolveSet = new_List()) { assert(typeof exportName === "string", "ModuleResolveExport");
@@ -206,7 +206,7 @@ function GetModuleNamespace(module) // Step 4 if (typeof namespace === "undefined") { let exportedNames = callFunction(module.getExportedNames, module); - let unambiguousNames = []; + let unambiguousNames = new_List(); for (let i = 0; i < exportedNames.length; i++) { let name = exportedNames[i]; let resolution = callFunction(module.resolveExport, module, name); @@ -312,7 +312,7 @@ function ModuleInstantiate() }
// Step 3 - let stack = []; + let stack = new_List();
// Steps 4-5 try { @@ -601,7 +601,7 @@ function ModuleEvaluate() const capability = CreateTopLevelCapability(module);
// Step 4 - let stack = []; + let stack = new_List();
// Steps 5-6 try { @@ -746,7 +746,7 @@ function InnerModuleEvaluation(module, stack, index) }
// https://tc39.es/proposal-top-level-await/#sec-gather-async-parent-completion... -function GatherAsyncParentCompletions(module, execList = []) { +function GatherAsyncParentCompletions(module, execList = new_List()) { assert(module.status == MODULE_STATUS_EVALUATED, "bad status for async module");
// Step 5. diff --git a/js/src/builtin/RegExp.js b/js/src/builtin/RegExp.js index 81b5d6f34c119..619664288c86a 100644 --- a/js/src/builtin/RegExp.js +++ b/js/src/builtin/RegExp.js @@ -349,7 +349,7 @@ function RegExpReplaceSlowPath(rx, S, lengthS, replaceValue, }
// Step 9. - var results = []; + var results = new_List(); var nResults = 0;
// Step 11. @@ -456,7 +456,7 @@ function RegExpGetComplexReplacement(result, matched, S, position, functionalReplace, firstDollarIndex) { // Step 14.h. - var captures = []; + var captures = new_List(); var capturesLength = 0;
// Step 14.k.i (reordered). @@ -546,7 +546,7 @@ function RegExpGetFunctionalReplacement(result, S, position, replaceValue) { }
// Steps 14.g-i, 14.k.i-ii. - var captures = []; + var captures = new_List(); for (var n = 0; n <= nCaptures; n++) { assert(typeof result[n] === "string" || result[n] === undefined, "RegExpMatcher returns only strings and undefined"); diff --git a/js/src/builtin/Utilities.js b/js/src/builtin/Utilities.js index 64ea59e4f2a2a..18400b490b6ef 100644 --- a/js/src/builtin/Utilities.js +++ b/js/src/builtin/Utilities.js @@ -27,16 +27,7 @@ // code are installed via the std_functions JSFunctionSpec[] in // SelfHosting.cpp.
-/********** List / Record specification types **********/ - -// A "List" is an internal type used in the ECMAScript spec to define a simple -// ordered list of values. It is never exposed to user script, but we use a -// simple Object (with null prototype) as a convenient implementation. -// -// NOTE: This does not track a `length` field. -function new_List() { - return std_Object_create(null); -} +/********** Specification types **********/
// A "Record" is an internal type used in the ECMAScript spec to define a struct diff --git a/js/src/vm/SelfHosting.cpp b/js/src/vm/SelfHosting.cpp index 18442bb86c4e3..d4df3cacc7ca9 100644 --- a/js/src/vm/SelfHosting.cpp +++ b/js/src/vm/SelfHosting.cpp @@ -2434,6 +2434,7 @@ static const JSFunctionSpec intrinsic_functions[] = { #endif // JS_HAS_INTL_API
// Standard builtins used by self-hosting. + JS_FN("new_List", intrinsic_newList, 0, 0), JS_INLINABLE_FN("std_Array", array_construct, 1, 0, Array), JS_INLINABLE_FN("std_Array_pop", array_pop, 0, 0, ArrayPop), JS_INLINABLE_FN("std_Array_push", array_push, 1, 0, ArrayPush),
tor-commits@lists.torproject.org