From 77bd81595d07fd1aee75470aa1b5944337294a34 Mon Sep 17 00:00:00 2001 From: Moonchild Date: Mon, 29 May 2023 22:47:26 +0200 Subject: [PATCH 1/6] Issue #2256 - Implement Object.hasOwn(object, property) This is a convenience access function to hasOwnProperty. Trivial, self-hosted implementation providing the interface to the already existing hasOwnProperty cpp function with additional toObject for spec compliance. Resolves #2256 --- js/src/builtin/Object.cpp | 1 + js/src/builtin/Object.js | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/js/src/builtin/Object.cpp b/js/src/builtin/Object.cpp index 70a21079c0..5221afb617 100644 --- a/js/src/builtin/Object.cpp +++ b/js/src/builtin/Object.cpp @@ -1240,6 +1240,7 @@ static const JSFunctionSpec object_static_methods[] = { JS_FN("seal", obj_seal, 1, 0), JS_FN("isSealed", obj_isSealed, 1, 0), JS_SELF_HOSTED_FN("fromEntries", "ObjectFromEntries", 1, 0), + JS_SELF_HOSTED_FN("hasOwn", "ObjectHasOwn", 2, 0), JS_FS_END }; diff --git a/js/src/builtin/Object.js b/js/src/builtin/Object.js index c4739037e3..59d4807317 100644 --- a/js/src/builtin/Object.js +++ b/js/src/builtin/Object.js @@ -220,3 +220,12 @@ function ObjectFromEntries(iter) { return obj; } + +// Proposal https://github.com/tc39/proposal-accessible-object-hasownproperty +// Object.hasOwn (Object, Property) +function ObjectHasOwn(O, P) { + // Step 1. + var obj = ToObject(O); + // Step 2-3. + return callFunction(std_Object_hasOwnProperty, obj, P); +} From 2a7ff7ce1a7152d635ba1b5143898cad18bf2d56 Mon Sep 17 00:00:00 2001 From: Moonchild Date: Thu, 1 Jun 2023 18:45:35 +0200 Subject: [PATCH 2/6] Issue #2257 - Remove rematerialized frames after bailouts and exceptions. This ensures that rematerialized frames used by the devtools debugger are properly removed so that no stale data is used during bailouts. --- js/src/jit/BaselineBailouts.cpp | 26 ++++++++++++++++++++------ js/src/jit/JitFrames.cpp | 5 +++++ js/src/vm/Stack.cpp | 2 ++ 3 files changed, 27 insertions(+), 6 deletions(-) diff --git a/js/src/jit/BaselineBailouts.cpp b/js/src/jit/BaselineBailouts.cpp index ffeb07a058..30c83a5042 100644 --- a/js/src/jit/BaselineBailouts.cpp +++ b/js/src/jit/BaselineBailouts.cpp @@ -1803,6 +1803,14 @@ jit::FinishBailoutToBaseline(BaselineBailoutInfo* bailoutInfo) MOZ_ASSERT(numFrames > 0); BailoutKind bailoutKind = bailoutInfo->bailoutKind; bool checkGlobalDeclarationConflicts = bailoutInfo->checkGlobalDeclarationConflicts; + uint8_t* incomingStack = bailoutInfo->incomingStack; + + // We have to get rid of the rematerialized frame, whether it is + // restored or unwound. + auto guardRemoveRematerializedFramesFromDebugger = mozilla::MakeScopeExit([&] { + JitActivation* act = cx->activation()->asJit(); + act->removeRematerializedFramesFromDebugger(cx, incomingStack); + }); // Free the bailout buffer. js_free(bailoutInfo); @@ -1876,6 +1884,7 @@ jit::FinishBailoutToBaseline(BaselineBailoutInfo* bailoutInfo) if (frameno == numFrames - 1) { outerScript = frame->script(); outerFp = iter.fp(); + MOZ_ASSERT(outerFp == incomingStack); } frameno++; @@ -1902,18 +1911,23 @@ jit::FinishBailoutToBaseline(BaselineBailoutInfo* bailoutInfo) // We must attempt to copy all rematerialized frames over, // even if earlier ones failed, to invoke the proper frame // cleanup in the Debugger. - ok = CopyFromRematerializedFrame(cx, act, outerFp, --inlineDepth, - iter.baselineFrame()); + if (!CopyFromRematerializedFrame(cx, act, outerFp, --inlineDepth, + iter.baselineFrame())) + { + ok = false; + } } ++iter; } - // After copying from all the rematerialized frames, remove them from - // the table to keep the table up to date. - act->removeRematerializedFrame(outerFp); - if (!ok) return false; + + // After copying from all the rematerialized frames, remove them from + // the table to keep the table up to date. + guardRemoveRematerializedFramesFromDebugger.release(); + act->removeRematerializedFrame(outerFp); + } JitSpew(JitSpew_BaselineBailouts, diff --git a/js/src/jit/JitFrames.cpp b/js/src/jit/JitFrames.cpp index 6f159151d4..c343800e0d 100644 --- a/js/src/jit/JitFrames.cpp +++ b/js/src/jit/JitFrames.cpp @@ -888,7 +888,12 @@ HandleException(ResumeFromException* rfe) ++frames; } + // Remove left-over state which might have been needed for bailout. activation->removeIonFrameRecovery(iter.jsFrame()); + activation->removeRematerializedFrame(iter.fp()); + + // If invalidated, decrement the number of frames remaining on the + // stack for the given IonScript. if (invalidated) ionScript->decrementInvalidationCount(cx->runtime()->defaultFreeOp()); diff --git a/js/src/vm/Stack.cpp b/js/src/vm/Stack.cpp index a18874c8f1..b1bb8a753a 100644 --- a/js/src/vm/Stack.cpp +++ b/js/src/vm/Stack.cpp @@ -1584,6 +1584,8 @@ jit::JitActivation::removeRematerializedFramesFromDebugger(JSContext* cx, uint8_ if (RematerializedFrameTable::Ptr p = rematerializedFrames_->lookup(top)) { for (uint32_t i = 0; i < p->value().length(); i++) Debugger::handleUnrecoverableIonBailoutError(cx, p->value()[i]); + RematerializedFrame::FreeInVector(p->value()); + rematerializedFrames_->remove(p); } } From e3d51b39b6b9c296715bc0bb0ffdbf6cb8819c73 Mon Sep 17 00:00:00 2001 From: Moonchild Date: Thu, 18 May 2023 10:14:48 +0200 Subject: [PATCH 3/6] [Pale-Moon] Issue #1925 - Add pref to control history menu length. Limits set are minimum 1 entry (0 would mean unlimited so this can't be used to completely remove the history list from the menu) and maximum 50 which would overflow on most screens anyway. Default remains 15 if undefined. Resolves #1925 --- application/palemoon/base/content/browser-places.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/application/palemoon/base/content/browser-places.js b/application/palemoon/base/content/browser-places.js index 4283ad25c2..e3508ef553 100644 --- a/application/palemoon/base/content/browser-places.js +++ b/application/palemoon/base/content/browser-places.js @@ -504,8 +504,13 @@ function HistoryMenu(aPopupShowingEvent) { XPCOMUtils.defineLazyServiceGetter(this, "_ss", "@mozilla.org/browser/sessionstore;1", "nsISessionStore"); + let maxResults = Services.prefs.getIntPref("browser.history.menuMaxResults",15); + if (maxResults < 1 || maxResults > 50) { + // Return to sanity... + maxResults = 15; + } PlacesMenu.call(this, aPopupShowingEvent, - "place:sort=4&maxResults=15"); + "place:sort=4&maxResults=" + maxResults.toString().trim()); } HistoryMenu.prototype = { From 075eebec12a69fc3c01c6c4ade87733fc90b9295 Mon Sep 17 00:00:00 2001 From: Job Bautista Date: Thu, 18 May 2023 17:03:08 +0800 Subject: [PATCH 4/6] [Pale-Moon] Issue #1925 - Follow-up: Don't show link items when pref is less than 1. A user setting the pref to 0 most likely wants to get rid of the items, so let's allow that by simply not calling PlacesMenu.call at all in that case. --- .../palemoon/base/content/browser-places.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/application/palemoon/base/content/browser-places.js b/application/palemoon/base/content/browser-places.js index e3508ef553..c861c41607 100644 --- a/application/palemoon/base/content/browser-places.js +++ b/application/palemoon/base/content/browser-places.js @@ -504,13 +504,16 @@ function HistoryMenu(aPopupShowingEvent) { XPCOMUtils.defineLazyServiceGetter(this, "_ss", "@mozilla.org/browser/sessionstore;1", "nsISessionStore"); - let maxResults = Services.prefs.getIntPref("browser.history.menuMaxResults",15); - if (maxResults < 1 || maxResults > 50) { - // Return to sanity... - maxResults = 15; + let maxResults = Services.prefs.getIntPref("browser.history.menuMaxResults", 15); + // Workaround so that maxResults = 0 wouldn't create unlimited items + if (maxResults > 0) { + if (maxResults > 50) { + // Return to sanity... + maxResults = 15; + } + PlacesMenu.call(this, aPopupShowingEvent, + "place:sort=4&maxResults=" + maxResults.toString().trim()); } - PlacesMenu.call(this, aPopupShowingEvent, - "place:sort=4&maxResults=" + maxResults.toString().trim()); } HistoryMenu.prototype = { From 1768eb1930a63c40316f8febb9276ef423d08ee2 Mon Sep 17 00:00:00 2001 From: Moonchild Date: Thu, 18 May 2023 14:13:23 +0200 Subject: [PATCH 5/6] [Pale-Moon] Issue #1925 - Follow-up: Throw errors on invalid values. Uses defaults for negative values and caps upper limit. --- application/palemoon/base/content/browser-places.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/application/palemoon/base/content/browser-places.js b/application/palemoon/base/content/browser-places.js index c861c41607..f58b4118e3 100644 --- a/application/palemoon/base/content/browser-places.js +++ b/application/palemoon/base/content/browser-places.js @@ -505,15 +505,21 @@ function HistoryMenu(aPopupShowingEvent) { "@mozilla.org/browser/sessionstore;1", "nsISessionStore"); let maxResults = Services.prefs.getIntPref("browser.history.menuMaxResults", 15); - // Workaround so that maxResults = 0 wouldn't create unlimited items + if (maxResults < 0) { + Components.utils.reportError("Maximum number of history menu entries is invalid! Using defaults."); + maxResults = 15; + } if (maxResults > 0) { if (maxResults > 50) { // Return to sanity... - maxResults = 15; + Components.utils.reportError("Maximum number of history menu entries is too large! Capping to 50."); + maxResults = 50; } PlacesMenu.call(this, aPopupShowingEvent, "place:sort=4&maxResults=" + maxResults.toString().trim()); - } + } else { + // maxResults == 0; do nothing. This suppresses the history entries. + } } HistoryMenu.prototype = { From 4b0e27bb4c1a64860ea835139bfd4d5b484f6d46 Mon Sep 17 00:00:00 2001 From: Moonchild Date: Mon, 29 May 2023 15:32:09 +0200 Subject: [PATCH 6/6] [Pale-Moon] [SSUAO] Update chase.com override after breakage. --- application/palemoon/branding/shared/pref/uaoverrides.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/palemoon/branding/shared/pref/uaoverrides.inc b/application/palemoon/branding/shared/pref/uaoverrides.inc index 415a524fda..156d17fcb1 100644 --- a/application/palemoon/branding/shared/pref/uaoverrides.inc +++ b/application/palemoon/branding/shared/pref/uaoverrides.inc @@ -21,7 +21,6 @@ pref("@GUAO_PREF@.addons.mozilla.org","Mozilla/5.0 (%OS_SLICE% rv:@GRE_VERSION@) // Required for domains that are unresponsive to requests from users (or likely to be) pref("@GUAO_PREF@.aol.com","Mozilla/5.0 (%OS_SLICE% rv:@GK_VERSION@) @GK_SLICE@ @FX_SLICE@ (Pale Moon)"); pref("@GUAO_PREF@.bing.com","Mozilla/5.0 (%OS_SLICE% rv:@GK_VERSION@) @GK_SLICE@ @FX_SLICE@ (Pale Moon)"); -pref("@GUAO_PREF@.chase.com","Mozilla/5.0 (%OS_SLICE% rv:79.0) @GK_SLICE@ Firefox/79.0"); pref("@GUAO_PREF@.dropbox.com","Mozilla/5.0 (%OS_SLICE% rv:68.9) @GK_SLICE@ Firefox/68.9 (Pale Moon)"); pref("@GUAO_PREF@.instagram.com","Mozilla/5.0 (%OS_SLICE% rv:68.0) @GK_SLICE@ Firefox/68.0"); pref("@GUAO_PREF@.kroger.com","Mozilla/5.0 (%OS_SLICE% rv:86.0) @GK_SLICE@ Firefox/86.0 (Pale Moon)"); @@ -60,6 +59,7 @@ pref("@GUAO_PREF@.zoho.com","Mozilla/5.0 (%OS_SLICE% rv:@GRE_VERSION@) @GRE_DATE pref("@GUAO_PREF@.humblebundle.com","Mozilla/5.0 (%OS_SLICE% rv:@GK_VERSION@) @GK_SLICE@ @FX_SLICE@ (Pale Moon)"); pref("@GUAO_PREF@.privat24.ua","Mozilla/5.0 (%OS_SLICE% rv:38.0) @GK_SLICE@ Firefox/38.0"); pref("@GUAO_PREF@.citi.com","Mozilla/5.0 (%OS_SLICE% rv:68.0) @GK_SLICE@ Firefox/68.0 SeaMonkey/2.53.12"); +pref("@GUAO_PREF@.chase.com","Mozilla/5.0 (%OS_SLICE% rv:112.0) @GK_SLICE@ Firefox/112.0"); pref("@GUAO_PREF@.facebook.com","Mozilla/5.0 (%OS_SLICE% rv:68.0) @GK_SLICE@ Firefox/68.0 @PM_SLICE@"); pref("@GUAO_PREF@.netflix.com","Mozilla/5.0 (Windows NT 6.1; rv:45.9) @GK_SLICE@ Firefox/45.9"); pref("@GUAO_PREF@.netflximg.net","Mozilla/5.0 (Windows NT 6.1; rv:45.9) @GK_SLICE@ Firefox/45.9");