summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--application/basilisk/components/nsBrowserGlue.js36
-rw-r--r--application/palemoon/components/nsBrowserGlue.js8
-rw-r--r--js/src/jsapi.h2
-rw-r--r--js/src/vm/Stopwatch.cpp25
-rw-r--r--toolkit/components/perfmonitoring/nsPerformanceStats.cpp11
-rw-r--r--toolkit/components/perfmonitoring/nsPerformanceStats.h2
-rw-r--r--toolkit/mozapps/extensions/content/extensions.xml14
7 files changed, 49 insertions, 49 deletions
diff --git a/application/basilisk/components/nsBrowserGlue.js b/application/basilisk/components/nsBrowserGlue.js
index 3258159b6..d77e97f87 100644
--- a/application/basilisk/components/nsBrowserGlue.js
+++ b/application/basilisk/components/nsBrowserGlue.js
@@ -1080,24 +1080,19 @@ BrowserGlue.prototype = {
// For any add-ons that were installed disabled and can be enabled offer
// them to the user.
- let win = RecentWindow.getMostRecentBrowserWindow();
- AddonManager.getAllAddons(addons => {
- for (let addon of addons) {
- // If this add-on has already seen (or seen is undefined for non-XPI
- // add-ons) then skip it.
- if (addon.seen !== false) {
- continue;
- }
-
- // If this add-on cannot be enabled (either already enabled or
- // appDisabled) then skip it.
- if (!(addon.permissions & AddonManager.PERM_CAN_ENABLE)) {
- continue;
- }
-
- win.openUILinkIn("about:newaddon?id=" + addon.id, "tab");
- }
- });
+ let changedIDs = AddonManager.getStartupChanges(AddonManager.STARTUP_CHANGE_INSTALLED);
+ if (changedIDs.length > 0) {
+ let win = this.getMostRecentBrowserWindow();
+ AddonManager.getAddonsByIDs(changedIDs, function(aAddons) {
+ aAddons.forEach(function(aAddon) {
+ // If the add-on isn't user disabled or can't be enabled then skip it.
+ if (!aAddon.userDisabled || !(aAddon.permissions & AddonManager.PERM_CAN_ENABLE))
+ return;
+
+ win.openUILinkIn("about:newaddon?id=" + aAddon.id, "tab");
+ })
+ });
+ }
let signingRequired;
if (AppConstants.MOZ_REQUIRE_SIGNING) {
@@ -1110,6 +1105,11 @@ BrowserGlue.prototype = {
let disabledAddons = AddonManager.getStartupChanges(AddonManager.STARTUP_CHANGE_DISABLED);
AddonManager.getAddonsByIDs(disabledAddons, (addons) => {
for (let addon of addons) {
+ // WEs return null, skip.
+ if (!addon) {
+ continue;
+ }
+
if (addon.type == "experiment")
continue;
diff --git a/application/palemoon/components/nsBrowserGlue.js b/application/palemoon/components/nsBrowserGlue.js
index 64b193d43..78b14a2e4 100644
--- a/application/palemoon/components/nsBrowserGlue.js
+++ b/application/palemoon/components/nsBrowserGlue.js
@@ -552,14 +552,6 @@ BrowserGlue.prototype = {
this._showPlacesLockedNotificationBox();
}
- // If there are plugins installed that are outdated, and the user hasn't
- // been warned about them yet, open the plugins update page.
- // Pale Moon: disable this functionality, people are already notified
- // if they visit a page with an outdated plugin, and they can check
- // properly from the plugins page as well.
-// if (Services.prefs.getBoolPref(PREF_PLUGINS_NOTIFYUSER))
-// this._showPluginUpdatePage();
-
// For any add-ons that were installed disabled and can be enabled offer
// them to the user.
let changedIDs = AddonManager.getStartupChanges(AddonManager.STARTUP_CHANGE_INSTALLED);
diff --git a/js/src/jsapi.h b/js/src/jsapi.h
index 0983f034f..799396a0a 100644
--- a/js/src/jsapi.h
+++ b/js/src/jsapi.h
@@ -6566,7 +6566,7 @@ struct JS_PUBLIC_API(PerformanceGroup) {
uint64_t refCount_;
};
-using PerformanceGroupVector = mozilla::Vector<RefPtr<js::PerformanceGroup>, 0, SystemAllocPolicy>;
+using PerformanceGroupVector = mozilla::Vector<RefPtr<js::PerformanceGroup>, 8, SystemAllocPolicy>;
/**
* Commit any Performance Monitoring data.
diff --git a/js/src/vm/Stopwatch.cpp b/js/src/vm/Stopwatch.cpp
index 7a6acb970..5b5ec6196 100644
--- a/js/src/vm/Stopwatch.cpp
+++ b/js/src/vm/Stopwatch.cpp
@@ -20,6 +20,7 @@
#include "gc/Zone.h"
#include "vm/Runtime.h"
+
namespace js {
bool
@@ -136,6 +137,9 @@ PerformanceMonitoring::start()
bool
PerformanceMonitoring::commit()
{
+ // Maximal initialization size, in elements for the vector of groups.
+ static const size_t MAX_GROUPS_INIT_CAPACITY = 1024;
+
#if !defined(MOZ_HAVE_RDTSC)
// The AutoStopwatch is only executed if `MOZ_HAVE_RDTSC`.
return false;
@@ -152,13 +156,24 @@ PerformanceMonitoring::commit()
return true;
}
- PerformanceGroupVector recentGroups;
- recentGroups_.swap(recentGroups);
+ // The move operation is generally constant time, unless
+ // `recentGroups_.length()` is very small, in which case
+ // it's fast just because it's small.
+ PerformanceGroupVector recentGroups(Move(recentGroups_));
+ recentGroups_ = PerformanceGroupVector(); // Reconstruct after `Move`.
bool success = true;
if (stopwatchCommitCallback)
success = stopwatchCommitCallback(iteration_, recentGroups, stopwatchCommitClosure);
+ // Heuristic: we expect to have roughly the same number of groups as in
+ // the previous iteration.
+ const size_t capacity = recentGroups.capacity() < MAX_GROUPS_INIT_CAPACITY ?
+ recentGroups.capacity() :
+ MAX_GROUPS_INIT_CAPACITY;
+ success = recentGroups_.reserve(capacity)
+ && success;
+
// Reset immediately, to make sure that we're not hit by the end
// of a nested event loop (which would cause `commit` to be called
// twice in succession).
@@ -227,7 +242,7 @@ AutoStopwatch::AutoStopwatch(JSContext* cx MOZ_GUARD_OBJECT_NOTIFIER_PARAM_IN_IM
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
JSCompartment* compartment = cx_->compartment();
- if (compartment->scheduledForDestruction)
+ if (MOZ_UNLIKELY(compartment->scheduledForDestruction))
return;
JSRuntime* runtime = cx_->runtime();
@@ -266,11 +281,11 @@ AutoStopwatch::~AutoStopwatch()
}
JSCompartment* compartment = cx_->compartment();
- if (compartment->scheduledForDestruction)
+ if (MOZ_UNLIKELY(compartment->scheduledForDestruction))
return;
JSRuntime* runtime = cx_->runtime();
- if (iteration_ != runtime->performanceMonitoring.iteration()) {
+ if (MOZ_UNLIKELY(iteration_ != runtime->performanceMonitoring.iteration())) {
// We have entered a nested event loop at some point.
// Any information we may have is obsolete.
return;
diff --git a/toolkit/components/perfmonitoring/nsPerformanceStats.cpp b/toolkit/components/perfmonitoring/nsPerformanceStats.cpp
index 6c470356a..59d84ced1 100644
--- a/toolkit/components/perfmonitoring/nsPerformanceStats.cpp
+++ b/toolkit/components/perfmonitoring/nsPerformanceStats.cpp
@@ -1082,6 +1082,9 @@ nsPerformanceStatsService::GetPerformanceGroups(JSContext* cx,
return false;
}
+ // Returning a vector that is too large would cause allocations all over the
+ // place in the JS engine. We want to be sure that all data is stored inline.
+ MOZ_ASSERT(out.length() <= out.sMaxInlineStorage);
return true;
}
@@ -1310,8 +1313,12 @@ nsPerformanceStatsService::GetResources(uint64_t* userTime,
void
nsPerformanceStatsService::NotifyJankObservers(const mozilla::Vector<uint64_t>& aPreviousJankLevels) {
- GroupVector alerts;
- mPendingAlerts.swap(alerts);
+
+ // The move operation is generally constant time, unless
+ // `mPendingAlerts.length()` is very small, in which case it's fast anyway.
+ GroupVector alerts(Move(mPendingAlerts));
+ mPendingAlerts = GroupVector(); // Reconstruct after `Move`.
+
if (!mPendingAlertsCollector) {
// We are shutting down.
return;
diff --git a/toolkit/components/perfmonitoring/nsPerformanceStats.h b/toolkit/components/perfmonitoring/nsPerformanceStats.h
index 6902c840d..661a78a1a 100644
--- a/toolkit/components/perfmonitoring/nsPerformanceStats.h
+++ b/toolkit/components/perfmonitoring/nsPerformanceStats.h
@@ -19,7 +19,7 @@
class nsPerformanceGroup;
class nsPerformanceGroupDetails;
-typedef mozilla::Vector<RefPtr<nsPerformanceGroup>> GroupVector;
+typedef mozilla::Vector<RefPtr<nsPerformanceGroup>, 8> GroupVector;
/**
* A data structure for registering observers interested in
diff --git a/toolkit/mozapps/extensions/content/extensions.xml b/toolkit/mozapps/extensions/content/extensions.xml
index cbd05bfa9..9c8fda8ed 100644
--- a/toolkit/mozapps/extensions/content/extensions.xml
+++ b/toolkit/mozapps/extensions/content/extensions.xml
@@ -941,10 +941,6 @@
#endif
oncommand="document.getBindingParent(this).showPreferences();"/>
<!-- label="&cmd.debugAddon.label;" -->
- <xul:button anonid="debug-btn" class="addon-control debug"
- label="&cmd.debugAddon.label;"
- oncommand="document.getBindingParent(this).debug();"/>
-
<xul:button anonid="enable-btn" class="addon-control enable"
label="&cmd.enableAddon.label;"
oncommand="document.getBindingParent(this).userDisabled = false;"/>
@@ -1087,10 +1083,6 @@
document.getAnonymousElementByAttribute(this, "anonid",
"enable-btn");
</field>
- <field name="_debugBtn">
- document.getAnonymousElementByAttribute(this, "anonid",
- "debug-btn");
- </field>
<field name="_disableBtn">
document.getAnonymousElementByAttribute(this, "anonid",
"disable-btn");
@@ -1430,12 +1422,6 @@
this.mAddon.install.state != AddonManager.STATE_INSTALLED);
this._showStatus(showProgress ? "progress" : "none");
- let debuggable = this.mAddon.isDebuggable &&
- Services.prefs.getBoolPref('devtools.chrome.enabled') &&
- Services.prefs.getBoolPref('devtools.debugger.remote-enabled');
-
- this._debugBtn.disabled = this._debugBtn.hidden = !debuggable
-
if (this.mAddon.type == "experiment") {
this.removeAttribute("notification");
let prefix = "experiment.";