diff options
author | wolfbeast <mcwerewolf@gmail.com> | 2018-09-17 08:51:49 +0200 |
---|---|---|
committer | wolfbeast <mcwerewolf@gmail.com> | 2018-09-17 08:51:49 +0200 |
commit | 882aaf5b1fda7b216051b55e268de78fd5126f42 (patch) | |
tree | ccb3f6f6299a5d1c603e6b73d3892f635bb96a8e /toolkit | |
parent | 8ee235ca5df26f39ca3066935bef90c4d28dd61a (diff) | |
parent | d118d486a680ed42030b1bdee263a29831da3e86 (diff) | |
download | UXP-882aaf5b1fda7b216051b55e268de78fd5126f42.tar UXP-882aaf5b1fda7b216051b55e268de78fd5126f42.tar.gz UXP-882aaf5b1fda7b216051b55e268de78fd5126f42.tar.lz UXP-882aaf5b1fda7b216051b55e268de78fd5126f42.tar.xz UXP-882aaf5b1fda7b216051b55e268de78fd5126f42.zip |
Merge branch 'master' into Pale_Moon-release
# Conflicts:
# application/palemoon/config/version.txt
# js/src/jit/x86-shared/AssemblerBuffer-x86-shared.h
# toolkit/components/search/orginal/nsSearchService.js
Diffstat (limited to 'toolkit')
37 files changed, 101 insertions, 736 deletions
diff --git a/toolkit/components/alerts/nsAlertsService.cpp b/toolkit/components/alerts/nsAlertsService.cpp index dd67ad983..73dbb265c 100644 --- a/toolkit/components/alerts/nsAlertsService.cpp +++ b/toolkit/components/alerts/nsAlertsService.cpp @@ -6,7 +6,6 @@ #include "mozilla/dom/ContentChild.h" #include "mozilla/dom/PermissionMessageUtils.h" #include "mozilla/Preferences.h" -#include "mozilla/Telemetry.h" #include "nsXULAppAPI.h" #include "nsAlertsService.h" @@ -292,9 +291,6 @@ NS_IMETHODIMP nsAlertsService::SetManualDoNotDisturb(bool aDoNotDisturb) NS_ENSURE_TRUE(alertsDND, NS_ERROR_NOT_IMPLEMENTED); nsresult rv = alertsDND->SetManualDoNotDisturb(aDoNotDisturb); - if (NS_SUCCEEDED(rv)) { - Telemetry::Accumulate(Telemetry::ALERTS_SERVICE_DND_ENABLED, 1); - } return rv; #endif } diff --git a/toolkit/components/downloads/ApplicationReputation.cpp b/toolkit/components/downloads/ApplicationReputation.cpp index 7bd219dbf..a369ca884 100644 --- a/toolkit/components/downloads/ApplicationReputation.cpp +++ b/toolkit/components/downloads/ApplicationReputation.cpp @@ -34,7 +34,6 @@ #include "mozilla/LoadContext.h" #include "mozilla/Preferences.h" #include "mozilla/Services.h" -#include "mozilla/Telemetry.h" #include "mozilla/TimeStamp.h" #include "nsAutoPtr.h" @@ -59,7 +58,6 @@ using mozilla::DocShellOriginAttributes; using mozilla::PrincipalOriginAttributes; using mozilla::Preferences; using mozilla::TimeStamp; -using mozilla::Telemetry::Accumulate; using safe_browsing::ClientDownloadRequest; using safe_browsing::ClientDownloadRequest_CertificateChain; using safe_browsing::ClientDownloadRequest_Resource; @@ -356,7 +354,6 @@ PendingDBLookup::HandleEvent(const nsACString& tables) Preferences::GetCString(PREF_DOWNLOAD_BLOCK_TABLE, &blockList); if (!mAllowlistOnly && FindInReadable(blockList, tables)) { mPendingLookup->mBlocklistCount++; - Accumulate(mozilla::Telemetry::APPLICATION_REPUTATION_LOCAL, BLOCK_LIST); LOG(("Found principal %s on blocklist [this = %p]", mSpec.get(), this)); return mPendingLookup->OnComplete(true, NS_OK, nsIApplicationReputationService::VERDICT_DANGEROUS); @@ -366,13 +363,11 @@ PendingDBLookup::HandleEvent(const nsACString& tables) Preferences::GetCString(PREF_DOWNLOAD_ALLOW_TABLE, &allowList); if (FindInReadable(allowList, tables)) { mPendingLookup->mAllowlistCount++; - Accumulate(mozilla::Telemetry::APPLICATION_REPUTATION_LOCAL, ALLOW_LIST); LOG(("Found principal %s on allowlist [this = %p]", mSpec.get(), this)); // Don't call onComplete, since blocklisting trumps allowlisting } else { LOG(("Didn't find principal %s on any list [this = %p]", mSpec.get(), this)); - Accumulate(mozilla::Telemetry::APPLICATION_REPUTATION_LOCAL, NO_LIST); } return mPendingLookup->LookupNext(); } @@ -1000,7 +995,7 @@ PendingLookup::GetSpecHash(nsACString& aSpec, nsACString& hexEncodedHash) static const char* const hex = "0123456789ABCDEF"; hexEncodedHash.SetCapacity(2 * binaryHash.Length()); for (size_t i = 0; i < binaryHash.Length(); ++i) { - auto c = static_cast<const unsigned char>(binaryHash[i]); + auto c = static_cast<unsigned char>(binaryHash[i]); hexEncodedHash.Append(hex[(c >> 4) & 0x0F]); hexEncodedHash.Append(hex[c & 0x0F]); } @@ -1144,8 +1139,6 @@ PendingLookup::OnComplete(bool shouldBlock, nsresult rv, uint32_t verdict) mTimeoutTimer = nullptr; } - Accumulate(mozilla::Telemetry::APPLICATION_REPUTATION_SHOULD_BLOCK, - shouldBlock); double t = (TimeStamp::Now() - mStartTime).ToMilliseconds(); LOG(("Application Reputation verdict is %lu, obtained in %f ms [this = %p]", verdict, t, this)); @@ -1393,8 +1386,6 @@ PendingLookup::Notify(nsITimer* aTimer) { LOG(("Remote lookup timed out [this = %p]", this)); MOZ_ASSERT(aTimer == mTimeoutTimer); - Accumulate(mozilla::Telemetry::APPLICATION_REPUTATION_REMOTE_LOOKUP_TIMEOUT, - true); mChannel->Cancel(NS_ERROR_NET_TIMEOUT); mTimeoutTimer->Cancel(); return NS_OK; @@ -1457,8 +1448,6 @@ PendingLookup::OnStopRequest(nsIRequest *aRequest, bool shouldBlock = false; uint32_t verdict = nsIApplicationReputationService::VERDICT_SAFE; - Accumulate(mozilla::Telemetry::APPLICATION_REPUTATION_REMOTE_LOOKUP_TIMEOUT, - false); nsresult rv = OnStopRequestInternal(aRequest, aContext, aResult, &shouldBlock, &verdict); @@ -1473,8 +1462,6 @@ PendingLookup::OnStopRequestInternal(nsIRequest *aRequest, bool* aShouldBlock, uint32_t* aVerdict) { if (NS_FAILED(aResult)) { - Accumulate(mozilla::Telemetry::APPLICATION_REPUTATION_SERVER, - SERVER_RESPONSE_FAILED); return aResult; } @@ -1483,22 +1470,16 @@ PendingLookup::OnStopRequestInternal(nsIRequest *aRequest, nsresult rv; nsCOMPtr<nsIHttpChannel> channel = do_QueryInterface(aRequest, &rv); if (NS_FAILED(rv)) { - Accumulate(mozilla::Telemetry::APPLICATION_REPUTATION_SERVER, - SERVER_RESPONSE_FAILED); return rv; } uint32_t status = 0; rv = channel->GetResponseStatus(&status); if (NS_FAILED(rv)) { - Accumulate(mozilla::Telemetry::APPLICATION_REPUTATION_SERVER, - SERVER_RESPONSE_FAILED); return rv; } if (status != 200) { - Accumulate(mozilla::Telemetry::APPLICATION_REPUTATION_SERVER, - SERVER_RESPONSE_FAILED); return NS_ERROR_NOT_AVAILABLE; } @@ -1506,16 +1487,9 @@ PendingLookup::OnStopRequestInternal(nsIRequest *aRequest, safe_browsing::ClientDownloadResponse response; if (!response.ParseFromString(buf)) { LOG(("Invalid protocol buffer response [this = %p]: %s", this, buf.c_str())); - Accumulate(mozilla::Telemetry::APPLICATION_REPUTATION_SERVER, - SERVER_RESPONSE_INVALID); return NS_ERROR_CANNOT_CONVERT_DATA; } - Accumulate(mozilla::Telemetry::APPLICATION_REPUTATION_SERVER, - SERVER_RESPONSE_VALID); - // Clamp responses 0-7, we only know about 0-4 for now. - Accumulate(mozilla::Telemetry::APPLICATION_REPUTATION_SERVER_VERDICT, - std::min<uint32_t>(response.verdict(), 7)); switch(response.verdict()) { case safe_browsing::ClientDownloadResponse::DANGEROUS: *aShouldBlock = Preferences::GetBool(PREF_BLOCK_DANGEROUS, true); @@ -1583,11 +1557,8 @@ ApplicationReputationService::QueryReputation( NS_ENSURE_ARG_POINTER(aQuery); NS_ENSURE_ARG_POINTER(aCallback); - Accumulate(mozilla::Telemetry::APPLICATION_REPUTATION_COUNT, true); nsresult rv = QueryReputationInternal(aQuery, aCallback); if (NS_FAILED(rv)) { - Accumulate(mozilla::Telemetry::APPLICATION_REPUTATION_SHOULD_BLOCK, - false); aCallback->OnComplete(false, rv, nsIApplicationReputationService::VERDICT_SAFE); } diff --git a/toolkit/components/osfile/modules/osfile_async_front.jsm b/toolkit/components/osfile/modules/osfile_async_front.jsm index 964e53084..93c7e66d6 100644 --- a/toolkit/components/osfile/modules/osfile_async_front.jsm +++ b/toolkit/components/osfile/modules/osfile_async_front.jsm @@ -56,7 +56,6 @@ Cu.import("resource://gre/modules/Task.jsm", this); // The implementation of communications Cu.import("resource://gre/modules/PromiseWorker.jsm", this); Cu.import("resource://gre/modules/Services.jsm", this); -Cu.import("resource://gre/modules/TelemetryStopwatch.jsm", this); Cu.import("resource://gre/modules/AsyncShutdown.jsm", this); var Native = Cu.import("resource://gre/modules/osfile/osfile_native.jsm", {}); @@ -1171,13 +1170,10 @@ File.writeAtomic = function writeAtomic(path, buffer, options = {}) { if (isTypedArray(buffer) && (!("bytes" in options))) { options.bytes = buffer.byteLength; }; - let refObj = {}; - TelemetryStopwatch.start("OSFILE_WRITEATOMIC_JANK_MS", refObj); let promise = Scheduler.post("writeAtomic", [Type.path.toMsg(path), Type.void_t.in_ptr.toMsg(buffer), options], [options, buffer, path]); - TelemetryStopwatch.finish("OSFILE_WRITEATOMIC_JANK_MS", refObj); return promise; }; diff --git a/toolkit/components/perfmonitoring/nsPerformanceStats.cpp b/toolkit/components/perfmonitoring/nsPerformanceStats.cpp index eb924de46..33aeaf7c2 100644 --- a/toolkit/components/perfmonitoring/nsPerformanceStats.cpp +++ b/toolkit/components/perfmonitoring/nsPerformanceStats.cpp @@ -27,7 +27,6 @@ #include "mozilla/ArrayUtils.h" #include "mozilla/EventStateManager.h" #include "mozilla/Services.h" -#include "mozilla/Telemetry.h" #if defined(XP_WIN) #include <processthreadsapi.h> @@ -957,22 +956,7 @@ nsPerformanceStatsService::SetJankAlertBufferingDelay(uint32_t value) { nsresult nsPerformanceStatsService::UpdateTelemetry() { - // Promote everything to floating-point explicitly before dividing. - const double processStayed = mProcessStayed; - const double processMoved = mProcessMoved; - - if (processStayed <= 0 || processMoved <= 0 || processStayed + processMoved <= 0) { - // Overflow/underflow/nothing to report - return NS_OK; - } - - const double proportion = (100 * processStayed) / (processStayed + processMoved); - if (proportion < 0 || proportion > 100) { - // Overflow/underflow - return NS_OK; - } - - mozilla::Telemetry::Accumulate(mozilla::Telemetry::PERF_MONITORING_TEST_CPU_RESCHEDULING_PROPORTION_MOVED, (uint32_t)proportion); + /* STUB */ return NS_OK; } diff --git a/toolkit/components/places/Database.cpp b/toolkit/components/places/Database.cpp index 37502e2a1..a87c14b37 100644 --- a/toolkit/components/places/Database.cpp +++ b/toolkit/components/places/Database.cpp @@ -615,9 +615,6 @@ Database::BackupAndReplaceDatabaseFile(nsCOMPtr<mozIStorageService>& aStorage) // Set up a pref to try replacing the database at the next startup. Preferences::SetBool(PREF_FORCE_DATABASE_REPLACEMENT, true); } - // Report the corruption through telemetry. - Telemetry::Accumulate(Telemetry::PLACES_DATABASE_CORRUPTION_HANDLING_STAGE, - static_cast<int8_t>(stage)); }); // Close database connection if open. diff --git a/toolkit/components/places/FaviconHelpers.cpp b/toolkit/components/places/FaviconHelpers.cpp index 69c202338..ca08cdff4 100644 --- a/toolkit/components/places/FaviconHelpers.cpp +++ b/toolkit/components/places/FaviconHelpers.cpp @@ -14,7 +14,6 @@ #include "nsNavHistory.h" #include "nsFaviconService.h" #include "mozilla/storage.h" -#include "mozilla/Telemetry.h" #include "nsNetUtil.h" #include "nsPrintfCString.h" #include "nsStreamUtils.h" @@ -581,33 +580,6 @@ AsyncFetchAndSetIconForPage::OnStopRequest(nsIRequest* aRequest, mIcon.expiration = GetExpirationTimeFromChannel(channel); - // Telemetry probes to measure the favicon file sizes for each different file type. - // This allow us to measure common file sizes while also observing each type popularity. - if (mIcon.mimeType.EqualsLiteral("image/png")) { - mozilla::Telemetry::Accumulate(mozilla::Telemetry::PLACES_FAVICON_PNG_SIZES, mIcon.data.Length()); - } - else if (mIcon.mimeType.EqualsLiteral("image/x-icon") || - mIcon.mimeType.EqualsLiteral("image/vnd.microsoft.icon")) { - mozilla::Telemetry::Accumulate(mozilla::Telemetry::PLACES_FAVICON_ICO_SIZES, mIcon.data.Length()); - } - else if (mIcon.mimeType.EqualsLiteral("image/jpeg") || - mIcon.mimeType.EqualsLiteral("image/pjpeg")) { - mozilla::Telemetry::Accumulate(mozilla::Telemetry::PLACES_FAVICON_JPEG_SIZES, mIcon.data.Length()); - } - else if (mIcon.mimeType.EqualsLiteral("image/gif")) { - mozilla::Telemetry::Accumulate(mozilla::Telemetry::PLACES_FAVICON_GIF_SIZES, mIcon.data.Length()); - } - else if (mIcon.mimeType.EqualsLiteral("image/bmp") || - mIcon.mimeType.EqualsLiteral("image/x-windows-bmp")) { - mozilla::Telemetry::Accumulate(mozilla::Telemetry::PLACES_FAVICON_BMP_SIZES, mIcon.data.Length()); - } - else if (mIcon.mimeType.EqualsLiteral("image/svg+xml")) { - mozilla::Telemetry::Accumulate(mozilla::Telemetry::PLACES_FAVICON_SVG_SIZES, mIcon.data.Length()); - } - else { - mozilla::Telemetry::Accumulate(mozilla::Telemetry::PLACES_FAVICON_OTHER_SIZES, mIcon.data.Length()); - } - rv = OptimizeIconSize(mIcon, favicons); NS_ENSURE_SUCCESS(rv, rv); diff --git a/toolkit/components/places/Helpers.cpp b/toolkit/components/places/Helpers.cpp index 66c4e79a9..dda162197 100644 --- a/toolkit/components/places/Helpers.cpp +++ b/toolkit/components/places/Helpers.cpp @@ -385,9 +385,7 @@ AsyncStatementCallbackNotifier::HandleCompletion(uint16_t aReason) NS_IMETHODIMP AsyncStatementTelemetryTimer::HandleCompletion(uint16_t aReason) { - if (aReason == mozIStorageStatementCallback::REASON_FINISHED) { - Telemetry::AccumulateTimeDelta(mHistogramId, mStart); - } + /* STUB */ return NS_OK; } diff --git a/toolkit/components/places/UnifiedComplete.js b/toolkit/components/places/UnifiedComplete.js index acd358b11..2efae9cbe 100644 --- a/toolkit/components/places/UnifiedComplete.js +++ b/toolkit/components/places/UnifiedComplete.js @@ -262,8 +262,6 @@ Cu.import("resource://gre/modules/Services.jsm"); XPCOMUtils.defineLazyModuleGetter(this, "PlacesUtils", "resource://gre/modules/PlacesUtils.jsm"); -XPCOMUtils.defineLazyModuleGetter(this, "TelemetryStopwatch", - "resource://gre/modules/TelemetryStopwatch.jsm"); XPCOMUtils.defineLazyModuleGetter(this, "NetUtil", "resource://gre/modules/NetUtil.jsm"); XPCOMUtils.defineLazyModuleGetter(this, "Preferences", @@ -887,10 +885,6 @@ Search.prototype = { if (!this.pending) return; - TelemetryStopwatch.start(TELEMETRY_1ST_RESULT, this); - if (this._searchString) - TelemetryStopwatch.start(TELEMETRY_6_FIRST_RESULTS, this); - // Since we call the synchronous parseSubmissionURL function later, we must // wait for the initialization of PlacesSearchAutocompleteProvider first. yield PlacesSearchAutocompleteProvider.ensureInitialized(); @@ -1468,9 +1462,6 @@ Search.prototype = { }, _onResultRow: function (row) { - if (this._localMatchesCount == 0) { - TelemetryStopwatch.finish(TELEMETRY_1ST_RESULT, this); - } let queryType = row.getResultByIndex(QUERYINDEX_QUERYTYPE); let match; switch (queryType) { @@ -1566,9 +1557,6 @@ Search.prototype = { match.style, match.finalCompleteValue); - if (this._result.matchCount == 6) - TelemetryStopwatch.finish(TELEMETRY_6_FIRST_RESULTS, this); - this.notifyResults(true); }, @@ -2088,8 +2076,6 @@ UnifiedComplete.prototype = { * results or not. */ finishSearch: function (notify=false) { - TelemetryStopwatch.cancel(TELEMETRY_1ST_RESULT, this); - TelemetryStopwatch.cancel(TELEMETRY_6_FIRST_RESULTS, this); // Clear state now to avoid race conditions, see below. let search = this._currentSearch; if (!search) diff --git a/toolkit/components/places/nsPlacesAutoComplete.js b/toolkit/components/places/nsPlacesAutoComplete.js index 29bdae4c1..9c6452ecd 100644 --- a/toolkit/components/places/nsPlacesAutoComplete.js +++ b/toolkit/components/places/nsPlacesAutoComplete.js @@ -8,8 +8,6 @@ Components.utils.import("resource://gre/modules/XPCOMUtils.jsm"); Components.utils.import("resource://gre/modules/Services.jsm"); XPCOMUtils.defineLazyModuleGetter(this, "PlacesUtils", "resource://gre/modules/PlacesUtils.jsm"); -XPCOMUtils.defineLazyModuleGetter(this, "TelemetryStopwatch", - "resource://gre/modules/TelemetryStopwatch.jsm"); XPCOMUtils.defineLazyModuleGetter(this, "NetUtil", "resource://gre/modules/NetUtil.jsm"); XPCOMUtils.defineLazyModuleGetter(this, "Task", @@ -1510,8 +1508,6 @@ urlInlineComplete.prototype = { // Do a synchronous search on the table of hosts. let query = this._hostQuery; query.params.search_string = this._currentSearchString.toLowerCase(); - // This is just to measure the delay to reach the UI, not the query time. - TelemetryStopwatch.start(DOMAIN_QUERY_TELEMETRY); let wrapper = new AutoCompleteStatementCallbackWrapper(this, { handleResult: aResultSet => { if (this._pendingSearch != pendingSearch) @@ -1541,7 +1537,6 @@ urlInlineComplete.prototype = { handleCompletion: aReason => { if (this._pendingSearch != pendingSearch) return; - TelemetryStopwatch.finish(DOMAIN_QUERY_TELEMETRY); this._finishSearch(); } }, this._db); diff --git a/toolkit/components/search/current/nsSearchService.js b/toolkit/components/search/current/nsSearchService.js index 9f9003516..99e73b50b 100644 --- a/toolkit/components/search/current/nsSearchService.js +++ b/toolkit/components/search/current/nsSearchService.js @@ -21,8 +21,6 @@ XPCOMUtils.defineLazyModuleGetter(this, "OS", "resource://gre/modules/osfile.jsm"); XPCOMUtils.defineLazyModuleGetter(this, "Task", "resource://gre/modules/Task.jsm"); -XPCOMUtils.defineLazyModuleGetter(this, "TelemetryStopwatch", - "resource://gre/modules/TelemetryStopwatch.jsm"); XPCOMUtils.defineLazyModuleGetter(this, "SearchStaticData", "resource://gre/modules/SearchStaticData.jsm"); XPCOMUtils.defineLazyModuleGetter(this, "setTimeout", @@ -3873,21 +3871,17 @@ SearchService.prototype = { LOG("SearchService.init"); let self = this; if (!this._initStarted) { - TelemetryStopwatch.start("SEARCH_SERVICE_INIT_MS"); this._initStarted = true; Task.spawn(function* task() { try { // Complete initialization by calling asynchronous initializer. yield self._asyncInit(); - TelemetryStopwatch.finish("SEARCH_SERVICE_INIT_MS"); } catch (ex) { if (ex.result == Cr.NS_ERROR_ALREADY_INITIALIZED) { // No need to pursue asynchronous because synchronous fallback was // called and has finished. - TelemetryStopwatch.finish("SEARCH_SERVICE_INIT_MS"); } else { self._initObservers.reject(ex); - TelemetryStopwatch.cancel("SEARCH_SERVICE_INIT_MS"); } } }); diff --git a/toolkit/components/search/orginal/nsSearchService.js b/toolkit/components/search/orginal/nsSearchService.js index 56d378b39..8d81e1a27 100644 --- a/toolkit/components/search/orginal/nsSearchService.js +++ b/toolkit/components/search/orginal/nsSearchService.js @@ -2237,7 +2237,10 @@ Engine.prototype = { get lazySerializeTask() { if (!this._lazySerializeTask) { let task = function taskCallback() { - this._serializeToFile(); + // This check should be done by caller, but it is better to be safe than sorry. + if (!this._readOnly && this._file) { + this._serializeToFile(); + } }.bind(this); this._lazySerializeTask = new DeferredTask(task, LAZY_SERIALIZE_DELAY); } @@ -2245,6 +2248,17 @@ Engine.prototype = { return this._lazySerializeTask; }, + // This API is required by some search engine management extensions, so let's restore it. + // Old API was using a timer to do its work, but this can lead us too far. If extension is + // rely on such subtle internal details, that extension should be fixed, not browser. + _lazySerializeToFile: function SRCH_ENG_lazySerializeToFile() { + // This check should be done by caller, but it is better to be safe than sorry. + // Besides, we don't have to create a task for r/o or non-file engines. + if (!this._readOnly && this._file) { + this.lazySerializeTask.arm(); + } + }, + /** * Serializes the engine object to file. */ @@ -3058,6 +3072,10 @@ SearchService.prototype = { continue; } + // Write out serialized search engine files when rebuilding cache. + // Do it lazily, to: 1) reuse existing API; 2) make browser interface more responsive + engine._lazySerializeToFile(); + let cacheKey = parent.path; if (!cache.directories[cacheKey]) { let cacheEntry = {}; diff --git a/toolkit/components/startup/nsAppStartup.cpp b/toolkit/components/startup/nsAppStartup.cpp index 391389605..53f8c5670 100644 --- a/toolkit/components/startup/nsAppStartup.cpp +++ b/toolkit/components/startup/nsAppStartup.cpp @@ -758,11 +758,6 @@ nsAppStartup::GetStartupInfo(JSContext* aCx, JS::MutableHandle<JS::Value> aRetva procTime = TimeStamp::ProcessCreation(error); - if (error) { - Telemetry::Accumulate(Telemetry::STARTUP_MEASUREMENT_ERRORS, - StartupTimeline::PROCESS_CREATION); - } - StartupTimeline::Record(StartupTimeline::PROCESS_CREATION, procTime); } @@ -777,8 +772,6 @@ nsAppStartup::GetStartupInfo(JSContext* aCx, JS::MutableHandle<JS::Value> aRetva // Always define main to aid with bug 689256. stamp = procTime; MOZ_ASSERT(!stamp.IsNull()); - Telemetry::Accumulate(Telemetry::STARTUP_MEASUREMENT_ERRORS, - StartupTimeline::MAIN); } if (!stamp.IsNull()) { @@ -787,8 +780,6 @@ nsAppStartup::GetStartupInfo(JSContext* aCx, JS::MutableHandle<JS::Value> aRetva / PR_USEC_PER_MSEC; JS::Rooted<JSObject*> date(aCx, JS::NewDateObject(aCx, JS::TimeClip(prStamp))); JS_DefineProperty(aCx, obj, StartupTimeline::Describe(ev), date, JSPROP_ENUMERATE); - } else { - Telemetry::Accumulate(Telemetry::STARTUP_MEASUREMENT_ERRORS, ev); } } } @@ -887,9 +878,6 @@ nsAppStartup::TrackStartupCrashBegin(bool *aIsSafeModeNecessary) if (PR_Now() / PR_USEC_PER_SEC <= lastSuccessfulStartup) return NS_ERROR_FAILURE; - // The last startup was a crash so include it in the count regardless of when it happened. - Telemetry::Accumulate(Telemetry::STARTUP_CRASH_DETECTED, true); - if (inSafeMode) { GetAutomaticSafeModeNecessary(aIsSafeModeNecessary); return NS_OK; diff --git a/toolkit/components/telemetry/TelemetryStopwatch.jsm b/toolkit/components/telemetry/TelemetryStopwatch.jsm deleted file mode 100644 index ab6c6eafb..000000000 --- a/toolkit/components/telemetry/TelemetryStopwatch.jsm +++ /dev/null @@ -1,335 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * You can obtain one at http://mozilla.org/MPL/2.0/. */ - -const Cc = Components.classes; -const Ci = Components.interfaces; -const Cu = Components.utils; - -this.EXPORTED_SYMBOLS = ["TelemetryStopwatch"]; - -Cu.import("resource://gre/modules/Log.jsm", this); -var Telemetry = Cc["@mozilla.org/base/telemetry;1"] - .getService(Ci.nsITelemetry); - -// Weak map does not allow using null objects as keys. These objects are used -// as 'null' placeholders. -const NULL_OBJECT = {}; -const NULL_KEY = {}; - -/** - * Timers is a variation of a Map used for storing information about running - * Stopwatches. Timers has the following data structure: - * - * { - * "HISTOGRAM_NAME": WeakMap { - * Object || NULL_OBJECT: Map { - * "KEY" || NULL_KEY: startTime - * ... - * } - * ... - * } - * ... - * } - * - * - * @example - * // Stores current time for a keyed histogram "PLAYING_WITH_CUTE_ANIMALS". - * Timers.put("PLAYING_WITH_CUTE_ANIMALS", null, "CATS", Date.now()); - * - * @example - * // Returns information about a simple Stopwatch. - * let startTime = Timers.get("PLAYING_WITH_CUTE_ANIMALS", null, "CATS"); - */ -let Timers = { - _timers: new Map(), - - _validTypes: function(histogram, obj, key) { - let nonEmptyString = value => { - return typeof value === "string" && value !== "" && value.length > 0; - }; - return nonEmptyString(histogram) && - typeof obj == "object" && - (key === NULL_KEY || nonEmptyString(key)); - }, - - get: function(histogram, obj, key) { - key = key === null ? NULL_KEY : key; - obj = obj || NULL_OBJECT; - - if (!this.has(histogram, obj, key)) { - return null; - } - - return this._timers.get(histogram).get(obj).get(key); - }, - - put: function(histogram, obj, key, startTime) { - key = key === null ? NULL_KEY : key; - obj = obj || NULL_OBJECT; - - if (!this._validTypes(histogram, obj, key)) { - return false; - } - - let objectMap = this._timers.get(histogram) || new WeakMap(); - let keyedInfo = objectMap.get(obj) || new Map(); - keyedInfo.set(key, startTime); - objectMap.set(obj, keyedInfo); - this._timers.set(histogram, objectMap); - return true; - }, - - has: function(histogram, obj, key) { - key = key === null ? NULL_KEY : key; - obj = obj || NULL_OBJECT; - - return this._timers.has(histogram) && - this._timers.get(histogram).has(obj) && - this._timers.get(histogram).get(obj).has(key); - }, - - delete: function(histogram, obj, key) { - key = key === null ? NULL_KEY : key; - obj = obj || NULL_OBJECT; - - if (!this.has(histogram, obj, key)) { - return false; - } - let objectMap = this._timers.get(histogram); - let keyedInfo = objectMap.get(obj); - if (keyedInfo.size > 1) { - keyedInfo.delete(key); - return true; - } - objectMap.delete(obj); - // NOTE: - // We never delete empty objecMaps from this._timers because there is no - // nice solution for tracking the number of objects in a WeakMap. - // WeakMap is not enumerable, so we can't deterministically say when it's - // empty. We accept that trade-off here, given that entries for short-lived - // objects will go away when they are no longer referenced - return true; - } -}; - -this.TelemetryStopwatch = { - /** - * Starts a timer associated with a telemetry histogram. The timer can be - * directly associated with a histogram, or with a pair of a histogram and - * an object. - * - * @param {String} aHistogram - a string which must be a valid histogram name. - * - * @param {Object} aObj - Optional parameter. If specified, the timer is - * associated with this object, meaning that multiple - * timers for the same histogram may be run - * concurrently, as long as they are associated with - * different objects. - * - * @returns {Boolean} True if the timer was successfully started, false - * otherwise. If a timer already exists, it can't be - * started again, and the existing one will be cleared in - * order to avoid measurements errors. - */ - start: function(aHistogram, aObj) { - return TelemetryStopwatchImpl.start(aHistogram, aObj, null); - }, - - /** - * Deletes the timer associated with a telemetry histogram. The timer can be - * directly associated with a histogram, or with a pair of a histogram and - * an object. Important: Only use this method when a legitimate cancellation - * should be done. - * - * @param {String} aHistogram - a string which must be a valid histogram name. - * - * @param {Object} aObj - Optional parameter. If specified, the timer is - * associated with this object, meaning that multiple - * timers or a same histogram may be run concurrently, - * as long as they are associated with different - * objects. - * - * @returns {Boolean} True if the timer exist and it was cleared, False - * otherwise. - */ - cancel: function(aHistogram, aObj) { - return TelemetryStopwatchImpl.cancel(aHistogram, aObj, null); - }, - - /** - * Returns the elapsed time for a particular stopwatch. Primarily for - * debugging purposes. Must be called prior to finish. - * - * @param {String} aHistogram - a string which must be a valid histogram name. - * If an invalid name is given, the function will - * throw. - * - * @param (Object) aObj - Optional parameter which associates the histogram - * timer with the given object. - * - * @returns {Integer} time in milliseconds or -1 if the stopwatch was not - * found. - */ - timeElapsed: function(aHistogram, aObj) { - return TelemetryStopwatchImpl.timeElapsed(aHistogram, aObj, null); - }, - - /** - * Stops the timer associated with the given histogram (and object), - * calculates the time delta between start and finish, and adds the value - * to the histogram. - * - * @param {String} aHistogram - a string which must be a valid histogram name. - * - * @param {Object} aObj - Optional parameter which associates the histogram - * timer with the given object. - * - * @returns {Boolean} True if the timer was succesfully stopped and the data - * was added to the histogram, False otherwise. - */ - finish: function(aHistogram, aObj) { - return TelemetryStopwatchImpl.finish(aHistogram, aObj, null); - }, - - /** - * Starts a timer associated with a keyed telemetry histogram. The timer can - * be directly associated with a histogram and its key. Similarly to - * @see{TelemetryStopwatch.stat} the histogram and its key can be associated - * with an object. Each key may have multiple associated objects and each - * object can be associated with multiple keys. - * - * @param {String} aHistogram - a string which must be a valid histogram name. - * - * @param {String} aKey - a string which must be a valid histgram key. - * - * @param {Object} aObj - Optional parameter. If specified, the timer is - * associated with this object, meaning that multiple - * timers for the same histogram may be run - * concurrently,as long as they are associated with - * different objects. - * - * @returns {Boolean} True if the timer was successfully started, false - * otherwise. If a timer already exists, it can't be - * started again, and the existing one will be cleared in - * order to avoid measurements errors. - */ - startKeyed: function(aHistogram, aKey, aObj) { - return TelemetryStopwatchImpl.start(aHistogram, aObj, aKey); - }, - - /** - * Deletes the timer associated with a keyed histogram. Important: Only use - * this method when a legitimate cancellation should be done. - * - * @param {String} aHistogram - a string which must be a valid histogram name. - * - * @param {String} aKey - a string which must be a valid histgram key. - * - * @param {Object} aObj - Optional parameter. If specified, the timer - * associated with this object is deleted. - * - * @return {Boolean} True if the timer exist and it was cleared, False - * otherwise. - */ - cancelKeyed: function(aHistogram, aKey, aObj) { - return TelemetryStopwatchImpl.cancel(aHistogram, aObj, aKey); - }, - - /** - * Returns the elapsed time for a particular stopwatch. Primarily for - * debugging purposes. Must be called prior to finish. - * - * @param {String} aHistogram - a string which must be a valid histogram name. - * - * @param {String} aKey - a string which must be a valid histgram key. - * - * @param {Object} aObj - Optional parameter. If specified, the timer - * associated with this object is used to calculate - * the elapsed time. - * - * @return {Integer} time in milliseconds or -1 if the stopwatch was not - * found. - */ - timeElapsedKeyed: function(aHistogram, aKey, aObj) { - return TelemetryStopwatchImpl.timeElapsed(aHistogram, aObj, aKey); - }, - - /** - * Stops the timer associated with the given keyed histogram (and object), - * calculates the time delta between start and finish, and adds the value - * to the keyed histogram. - * - * @param {String} aHistogram - a string which must be a valid histogram name. - * - * @param {String} aKey - a string which must be a valid histgram key. - * - * @param {Object} aObj - optional parameter which associates the histogram - * timer with the given object. - * - * @returns {Boolean} True if the timer was succesfully stopped and the data - * was added to the histogram, False otherwise. - */ - finishKeyed: function(aHistogram, aKey, aObj) { - return TelemetryStopwatchImpl.finish(aHistogram, aObj, aKey); - } -}; - -this.TelemetryStopwatchImpl = { - start: function(histogram, object, key) { - if (Timers.has(histogram, object, key)) { - Timers.delete(histogram, object, key); - Cu.reportError(`TelemetryStopwatch: key "${histogram}" was already ` + - "initialized"); - return false; - } - - return Timers.put(histogram, object, key, Components.utils.now()); - }, - - cancel: function (histogram, object, key) { - return Timers.delete(histogram, object, key); - }, - - timeElapsed: function(histogram, object, key) { - let startTime = Timers.get(histogram, object, key); - if (startTime === null) { - Cu.reportError("TelemetryStopwatch: requesting elapsed time for " + - `nonexisting stopwatch. Histogram: "${histogram}", ` + - `key: "${key}"`); - return -1; - } - - try { - let delta = Components.utils.now() - startTime - return Math.round(delta); - } catch (e) { - Cu.reportError("TelemetryStopwatch: failed to calculate elapsed time " + - `for Histogram: "${histogram}", key: "${key}", ` + - `exception: ${Log.exceptionStr(e)}`); - return -1; - } - }, - - finish: function(histogram, object, key) { - let delta = this.timeElapsed(histogram, object, key); - if (delta == -1) { - return false; - } - - try { - if (key) { - Telemetry.getKeyedHistogramById(histogram).add(key, delta); - } else { - Telemetry.getHistogramById(histogram).add(delta); - } - } catch (e) { - Cu.reportError("TelemetryStopwatch: failed to update the Histogram " + - `"${histogram}", using key: "${key}", ` + - `exception: ${Log.exceptionStr(e)}`); - return false; - } - - return Timers.delete(histogram, object, key); - } -} diff --git a/toolkit/components/telemetry/moz.build b/toolkit/components/telemetry/moz.build index 118d61b71..7765c59b4 100644 --- a/toolkit/components/telemetry/moz.build +++ b/toolkit/components/telemetry/moz.build @@ -64,7 +64,6 @@ EXTRA_JS_MODULES += [ 'TelemetryReportingPolicy.jsm', 'TelemetrySend.jsm', 'TelemetrySession.jsm', - 'TelemetryStopwatch.jsm', 'TelemetryStorage.jsm', 'TelemetryTimestamps.jsm', 'TelemetryUtils.jsm', diff --git a/toolkit/components/telemetry/tests/unit/test_TelemetryStopwatch.js b/toolkit/components/telemetry/tests/unit/test_TelemetryStopwatch.js deleted file mode 100644 index d162d9b17..000000000 --- a/toolkit/components/telemetry/tests/unit/test_TelemetryStopwatch.js +++ /dev/null @@ -1,156 +0,0 @@ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ - -var tmpScope = {}; -Cu.import("resource://gre/modules/TelemetryStopwatch.jsm", tmpScope); -var TelemetryStopwatch = tmpScope.TelemetryStopwatch; - -const HIST_NAME = "TELEMETRY_SEND_SUCCESS"; -const HIST_NAME2 = "RANGE_CHECKSUM_ERRORS"; -const KEYED_HIST = { id: "TELEMETRY_INVALID_PING_TYPE_SUBMITTED", key: "TEST" }; - -var refObj = {}, refObj2 = {}; - -var originalCount1, originalCount2; - -function run_test() { - let histogram = Telemetry.getHistogramById(HIST_NAME); - let snapshot = histogram.snapshot(); - originalCount1 = snapshot.counts.reduce((a, b) => a += b); - - histogram = Telemetry.getHistogramById(HIST_NAME2); - snapshot = histogram.snapshot(); - originalCount2 = snapshot.counts.reduce((a, b) => a += b); - - histogram = Telemetry.getKeyedHistogramById(KEYED_HIST.id); - snapshot = histogram.snapshot(KEYED_HIST.key); - originalCount3 = snapshot.counts.reduce((a, b) => a += b); - - do_check_false(TelemetryStopwatch.start(3)); - do_check_false(TelemetryStopwatch.start({})); - do_check_false(TelemetryStopwatch.start("", 3)); - do_check_false(TelemetryStopwatch.start("", "")); - do_check_false(TelemetryStopwatch.start({}, {})); - - do_check_true(TelemetryStopwatch.start("mark1")); - do_check_true(TelemetryStopwatch.start("mark2")); - - do_check_true(TelemetryStopwatch.start("mark1", refObj)); - do_check_true(TelemetryStopwatch.start("mark2", refObj)); - - // Same timer can't be re-started before being stopped - do_check_false(TelemetryStopwatch.start("mark1")); - do_check_false(TelemetryStopwatch.start("mark1", refObj)); - - // Can't stop a timer that was accidentaly started twice - do_check_false(TelemetryStopwatch.finish("mark1")); - do_check_false(TelemetryStopwatch.finish("mark1", refObj)); - - do_check_true(TelemetryStopwatch.start("NON-EXISTENT_HISTOGRAM")); - do_check_false(TelemetryStopwatch.finish("NON-EXISTENT_HISTOGRAM")); - - do_check_true(TelemetryStopwatch.start("NON-EXISTENT_HISTOGRAM", refObj)); - do_check_false(TelemetryStopwatch.finish("NON-EXISTENT_HISTOGRAM", refObj)); - - do_check_true(TelemetryStopwatch.start(HIST_NAME)); - do_check_true(TelemetryStopwatch.start(HIST_NAME2)); - do_check_true(TelemetryStopwatch.start(HIST_NAME, refObj)); - do_check_true(TelemetryStopwatch.start(HIST_NAME2, refObj)); - do_check_true(TelemetryStopwatch.start(HIST_NAME, refObj2)); - do_check_true(TelemetryStopwatch.start(HIST_NAME2, refObj2)); - - do_check_true(TelemetryStopwatch.finish(HIST_NAME)); - do_check_true(TelemetryStopwatch.finish(HIST_NAME2)); - do_check_true(TelemetryStopwatch.finish(HIST_NAME, refObj)); - do_check_true(TelemetryStopwatch.finish(HIST_NAME2, refObj)); - do_check_true(TelemetryStopwatch.finish(HIST_NAME, refObj2)); - do_check_true(TelemetryStopwatch.finish(HIST_NAME2, refObj2)); - - // Verify that TS.finish deleted the timers - do_check_false(TelemetryStopwatch.finish(HIST_NAME)); - do_check_false(TelemetryStopwatch.finish(HIST_NAME, refObj)); - - // Verify that they can be used again - do_check_true(TelemetryStopwatch.start(HIST_NAME)); - do_check_true(TelemetryStopwatch.start(HIST_NAME, refObj)); - do_check_true(TelemetryStopwatch.finish(HIST_NAME)); - do_check_true(TelemetryStopwatch.finish(HIST_NAME, refObj)); - - do_check_false(TelemetryStopwatch.finish("unknown-mark")); // Unknown marker - do_check_false(TelemetryStopwatch.finish("unknown-mark", {})); // Unknown object - do_check_false(TelemetryStopwatch.finish(HIST_NAME, {})); // Known mark on unknown object - - // Test cancel - do_check_true(TelemetryStopwatch.start(HIST_NAME)); - do_check_true(TelemetryStopwatch.start(HIST_NAME, refObj)); - do_check_true(TelemetryStopwatch.cancel(HIST_NAME)); - do_check_true(TelemetryStopwatch.cancel(HIST_NAME, refObj)); - - // Verify that can not cancel twice - do_check_false(TelemetryStopwatch.cancel(HIST_NAME)); - do_check_false(TelemetryStopwatch.cancel(HIST_NAME, refObj)); - - // Verify that cancel removes the timers - do_check_false(TelemetryStopwatch.finish(HIST_NAME)); - do_check_false(TelemetryStopwatch.finish(HIST_NAME, refObj)); - - // Verify that keyed stopwatch reject invalid keys. - for (let key of [3, {}, ""]) { - do_check_false(TelemetryStopwatch.startKeyed(KEYED_HIST.id, key)); - } - - // Verify that keyed histograms can be started. - do_check_true(TelemetryStopwatch.startKeyed("HISTOGRAM", "KEY1")); - do_check_true(TelemetryStopwatch.startKeyed("HISTOGRAM", "KEY2")); - do_check_true(TelemetryStopwatch.startKeyed("HISTOGRAM", "KEY1", refObj)); - do_check_true(TelemetryStopwatch.startKeyed("HISTOGRAM", "KEY2", refObj)); - - // Restarting keyed histograms should fail. - do_check_false(TelemetryStopwatch.startKeyed("HISTOGRAM", "KEY1")); - do_check_false(TelemetryStopwatch.startKeyed("HISTOGRAM", "KEY1", refObj)); - - // Finishing a stopwatch of a non existing histogram should return false. - do_check_false(TelemetryStopwatch.finishKeyed("HISTOGRAM", "KEY2")); - do_check_false(TelemetryStopwatch.finishKeyed("HISTOGRAM", "KEY2", refObj)); - - // Starting & finishing a keyed stopwatch for an existing histogram should work. - do_check_true(TelemetryStopwatch.startKeyed(KEYED_HIST.id, KEYED_HIST.key)); - do_check_true(TelemetryStopwatch.finishKeyed(KEYED_HIST.id, KEYED_HIST.key)); - // Verify that TS.finish deleted the timers - do_check_false(TelemetryStopwatch.finishKeyed(KEYED_HIST.id, KEYED_HIST.key)); - - // Verify that they can be used again - do_check_true(TelemetryStopwatch.startKeyed(KEYED_HIST.id, KEYED_HIST.key)); - do_check_true(TelemetryStopwatch.finishKeyed(KEYED_HIST.id, KEYED_HIST.key)); - - do_check_false(TelemetryStopwatch.finishKeyed("unknown-mark", "unknown-key")); - do_check_false(TelemetryStopwatch.finishKeyed(KEYED_HIST.id, "unknown-key")); - - // Verify that keyed histograms can only be canceled through "keyed" API. - do_check_true(TelemetryStopwatch.startKeyed(KEYED_HIST.id, KEYED_HIST.key)); - do_check_false(TelemetryStopwatch.cancel(KEYED_HIST.id, KEYED_HIST.key)); - do_check_true(TelemetryStopwatch.cancelKeyed(KEYED_HIST.id, KEYED_HIST.key)); - do_check_false(TelemetryStopwatch.cancelKeyed(KEYED_HIST.id, KEYED_HIST.key)); - - finishTest(); -} - -function finishTest() { - let histogram = Telemetry.getHistogramById(HIST_NAME); - let snapshot = histogram.snapshot(); - let newCount = snapshot.counts.reduce((a, b) => a += b); - - do_check_eq(newCount - originalCount1, 5, "The correct number of histograms were added for histogram 1."); - - histogram = Telemetry.getHistogramById(HIST_NAME2); - snapshot = histogram.snapshot(); - newCount = snapshot.counts.reduce((a, b) => a += b); - - do_check_eq(newCount - originalCount2, 3, "The correct number of histograms were added for histogram 2."); - - histogram = Telemetry.getKeyedHistogramById(KEYED_HIST.id); - snapshot = histogram.snapshot(KEYED_HIST.key); - newCount = snapshot.counts.reduce((a, b) => a += b); - - do_check_eq(newCount - originalCount3, 2, "The correct number of histograms were added for histogram 3."); -} diff --git a/toolkit/components/telemetry/tests/unit/xpcshell.ini b/toolkit/components/telemetry/tests/unit/xpcshell.ini index 42354c4cd..224516f57 100644 --- a/toolkit/components/telemetry/tests/unit/xpcshell.ini +++ b/toolkit/components/telemetry/tests/unit/xpcshell.ini @@ -41,7 +41,6 @@ tags = addons [test_TelemetryController_idle.js] [test_TelemetryControllerShutdown.js] tags = addons -[test_TelemetryStopwatch.js] [test_TelemetryControllerBuildID.js] [test_TelemetrySendOldPings.js] skip-if = os == "android" # Disabled due to intermittent orange on Android diff --git a/toolkit/components/url-classifier/Classifier.cpp b/toolkit/components/url-classifier/Classifier.cpp index bbaeaf535..b9d0ace1b 100644 --- a/toolkit/components/url-classifier/Classifier.cpp +++ b/toolkit/components/url-classifier/Classifier.cpp @@ -15,7 +15,6 @@ #include "nsNetCID.h" #include "nsPrintfCString.h" #include "nsThreadUtils.h" -#include "mozilla/Telemetry.h" #include "mozilla/Logging.h" #include "mozilla/SyncRunnable.h" #include "mozilla/Base64.h" @@ -413,8 +412,6 @@ Classifier::Check(const nsACString& aSpec, uint32_t aFreshnessGuarantee, LookupResultArray& aResults) { - Telemetry::AutoTimer<Telemetry::URLCLASSIFIER_CL_CHECK_TIME> timer; - // Get the set of fragments based on the url. This is necessary because we // only look up at most 5 URLs per aSpec, even if aSpec has more than 5 // components. @@ -498,9 +495,6 @@ Classifier::Check(const nsACString& aSpec, matchingStatistics |= PrefixMatch::eMatchV2Prefix; } } - - Telemetry::Accumulate(Telemetry::URLCLASSIFIER_PREFIX_MATCH, - static_cast<uint8_t>(matchingStatistics)); } return NS_OK; @@ -509,8 +503,6 @@ Classifier::Check(const nsACString& aSpec, nsresult Classifier::ApplyUpdates(nsTArray<TableUpdate*>* aUpdates) { - Telemetry::AutoTimer<Telemetry::URLCLASSIFIER_CL_UPDATE_TIME> timer; - PRIntervalTime clockStart = 0; if (LOG_ENABLED()) { clockStart = PR_IntervalNow(); diff --git a/toolkit/components/url-classifier/Entries.h b/toolkit/components/url-classifier/Entries.h index 969f4f739..b7fb34516 100644 --- a/toolkit/components/url-classifier/Entries.h +++ b/toolkit/components/url-classifier/Entries.h @@ -100,7 +100,7 @@ struct SafebrowsingHash aStr.SetCapacity(2 * len); for (size_t i = 0; i < len; ++i) { - const char c = static_cast<const char>(buf[i]); + const char c = static_cast<char>(buf[i]); aStr.Append(lut[(c >> 4) & 0x0F]); aStr.Append(lut[c & 15]); } diff --git a/toolkit/components/url-classifier/LookupCache.cpp b/toolkit/components/url-classifier/LookupCache.cpp index 5a3b1e36d..7c4d7682b 100644 --- a/toolkit/components/url-classifier/LookupCache.cpp +++ b/toolkit/components/url-classifier/LookupCache.cpp @@ -6,7 +6,6 @@ #include "LookupCache.h" #include "HashStore.h" #include "nsISeekableStream.h" -#include "mozilla/Telemetry.h" #include "mozilla/Logging.h" #include "nsNetUtil.h" #include "prprf.h" @@ -451,9 +450,6 @@ nsresult LookupCacheV2::Build(AddPrefixArray& aAddPrefixes, AddCompleteArray& aAddCompletes) { - Telemetry::Accumulate(Telemetry::URLCLASSIFIER_LC_COMPLETIONS, - static_cast<uint32_t>(aAddCompletes.Length())); - mUpdateCompletions.Clear(); mUpdateCompletions.SetCapacity(aAddCompletes.Length()); for (uint32_t i = 0; i < aAddCompletes.Length(); i++) { @@ -462,9 +458,6 @@ LookupCacheV2::Build(AddPrefixArray& aAddPrefixes, aAddCompletes.Clear(); mUpdateCompletions.Sort(); - Telemetry::Accumulate(Telemetry::URLCLASSIFIER_LC_PREFIXES, - static_cast<uint32_t>(aAddPrefixes.Length())); - nsresult rv = ConstructPrefixSet(aAddPrefixes); NS_ENSURE_SUCCESS(rv, rv); mPrimed = true; @@ -548,8 +541,6 @@ static void EnsureSorted(T* aArray) nsresult LookupCacheV2::ConstructPrefixSet(AddPrefixArray& aAddPrefixes) { - Telemetry::AutoTimer<Telemetry::URLCLASSIFIER_PS_CONSTRUCT_TIME> timer; - nsTArray<uint32_t> array; if (!array.SetCapacity(aAddPrefixes.Length(), fallible)) { return NS_ERROR_OUT_OF_MEMORY; diff --git a/toolkit/components/url-classifier/LookupCacheV4.cpp b/toolkit/components/url-classifier/LookupCacheV4.cpp index 7258ae358..a96e4931a 100644 --- a/toolkit/components/url-classifier/LookupCacheV4.cpp +++ b/toolkit/components/url-classifier/LookupCacheV4.cpp @@ -144,9 +144,6 @@ LookupCacheV4::LoadFromFile(nsIFile* aFile) } rv = VerifyChecksum(checksum); - Telemetry::Accumulate(Telemetry::URLCLASSIFIER_VLPS_LOAD_CORRUPT, - rv == NS_ERROR_FILE_CORRUPTED); - return rv; } @@ -231,8 +228,6 @@ LookupCacheV4::ApplyUpdate(TableUpdateV4* aTableUpdate, if (!isOldMapEmpty && !isAddMapEmpty) { if (smallestOldPrefix == smallestAddPrefix) { LOG(("Add prefix should not exist in the original prefix set.")); - Telemetry::Accumulate(Telemetry::URLCLASSIFIER_UPDATE_ERROR_TYPE, - DUPLICATE_PREFIX); return NS_ERROR_FAILURE; } @@ -274,15 +269,11 @@ LookupCacheV4::ApplyUpdate(TableUpdateV4* aTableUpdate, // the number of original prefix plus add prefix. if (index <= 0) { LOG(("There are still prefixes remaining after reaching maximum runs.")); - Telemetry::Accumulate(Telemetry::URLCLASSIFIER_UPDATE_ERROR_TYPE, - INFINITE_LOOP); return NS_ERROR_FAILURE; } if (removalIndex < removalArray.Length()) { LOG(("There are still prefixes to remove after exhausting the old PrefixSet.")); - Telemetry::Accumulate(Telemetry::URLCLASSIFIER_UPDATE_ERROR_TYPE, - WRONG_REMOVAL_INDICES); return NS_ERROR_FAILURE; } @@ -290,8 +281,6 @@ LookupCacheV4::ApplyUpdate(TableUpdateV4* aTableUpdate, crypto->Finish(false, checksum); if (aTableUpdate->Checksum().IsEmpty()) { LOG(("Update checksum missing.")); - Telemetry::Accumulate(Telemetry::URLCLASSIFIER_UPDATE_ERROR_TYPE, - MISSING_CHECKSUM); // Generate our own checksum to tableUpdate to ensure there is always // checksum in .metadata @@ -300,8 +289,6 @@ LookupCacheV4::ApplyUpdate(TableUpdateV4* aTableUpdate, } else if (aTableUpdate->Checksum() != checksum){ LOG(("Checksum mismatch after applying partial update")); - Telemetry::Accumulate(Telemetry::URLCLASSIFIER_UPDATE_ERROR_TYPE, - CHECKSUM_MISMATCH); return NS_ERROR_FAILURE; } diff --git a/toolkit/components/url-classifier/VariableLengthPrefixSet.cpp b/toolkit/components/url-classifier/VariableLengthPrefixSet.cpp index e9d6770d3..a387a698c 100644 --- a/toolkit/components/url-classifier/VariableLengthPrefixSet.cpp +++ b/toolkit/components/url-classifier/VariableLengthPrefixSet.cpp @@ -209,8 +209,6 @@ VariableLengthPrefixSet::LoadFromFile(nsIFile* aFile) NS_ENSURE_ARG_POINTER(aFile); - Telemetry::AutoTimer<Telemetry::URLCLASSIFIER_VLPS_FILELOAD_TIME> timer; - nsCOMPtr<nsIInputStream> localInFile; nsresult rv = NS_NewLocalFileInputStream(getter_AddRefs(localInFile), aFile, PR_RDONLY | nsIFile::OS_READAHEAD); @@ -255,15 +253,12 @@ VariableLengthPrefixSet::StoreToFile(nsIFile* aFile) uint32_t fileSize = 0; // Preallocate the file storage - { - nsCOMPtr<nsIFileOutputStream> fos(do_QueryInterface(localOutFile)); - Telemetry::AutoTimer<Telemetry::URLCLASSIFIER_VLPS_FALLOCATE_TIME> timer; + nsCOMPtr<nsIFileOutputStream> fos(do_QueryInterface(localOutFile)); - fileSize += mFixedPrefixSet->CalculatePreallocateSize(); - fileSize += CalculatePreallocateSize(); + fileSize += mFixedPrefixSet->CalculatePreallocateSize(); + fileSize += CalculatePreallocateSize(); - Unused << fos->Preallocate(fileSize); - } + Unused << fos->Preallocate(fileSize); // Convert to buffered stream nsCOMPtr<nsIOutputStream> out = diff --git a/toolkit/components/url-classifier/nsUrlClassifierDBService.cpp b/toolkit/components/url-classifier/nsUrlClassifierDBService.cpp index 2ad8b6b51..d3018aa2d 100644 --- a/toolkit/components/url-classifier/nsUrlClassifierDBService.cpp +++ b/toolkit/components/url-classifier/nsUrlClassifierDBService.cpp @@ -37,7 +37,6 @@ #include "mozilla/Mutex.h" #include "mozilla/Preferences.h" #include "mozilla/TimeStamp.h" -#include "mozilla/Telemetry.h" #include "mozilla/Logging.h" #include "prprf.h" #include "prnetdb.h" @@ -320,9 +319,6 @@ nsUrlClassifierDBServiceWorker::HandlePendingLookups() MutexAutoUnlock unlock(mPendingLookupLock); DoLookup(lookup.mKey, lookup.mTables, lookup.mCallback); } - double lookupTime = (TimeStamp::Now() - lookup.mStartTime).ToMilliseconds(); - Telemetry::Accumulate(Telemetry::URLCLASSIFIER_LOOKUP_TIME, - static_cast<uint32_t>(lookupTime)); } return NS_OK; @@ -1818,8 +1814,6 @@ nsUrlClassifierDBService::Shutdown() gShuttingDownThread = true; - Telemetry::AutoTimer<Telemetry::URLCLASSIFIER_SHUTDOWN_TIME> timer; - mCompleters.Clear(); nsCOMPtr<nsIPrefBranch> prefs = do_GetService(NS_PREFSERVICE_CONTRACTID); diff --git a/toolkit/components/url-classifier/nsUrlClassifierPrefixSet.cpp b/toolkit/components/url-classifier/nsUrlClassifierPrefixSet.cpp index 874565470..3cfdf7a35 100644 --- a/toolkit/components/url-classifier/nsUrlClassifierPrefixSet.cpp +++ b/toolkit/components/url-classifier/nsUrlClassifierPrefixSet.cpp @@ -315,8 +315,6 @@ nsUrlClassifierPrefixSet::LoadFromFile(nsIFile* aFile) { MutexAutoLock lock(mLock); - Telemetry::AutoTimer<Telemetry::URLCLASSIFIER_PS_FILELOAD_TIME> timer; - nsCOMPtr<nsIInputStream> localInFile; nsresult rv = NS_NewLocalFileInputStream(getter_AddRefs(localInFile), aFile, PR_RDONLY | nsIFile::OS_READAHEAD); @@ -356,17 +354,13 @@ nsUrlClassifierPrefixSet::StoreToFile(nsIFile* aFile) uint32_t fileSize; - // Preallocate the file storage - { - nsCOMPtr<nsIFileOutputStream> fos(do_QueryInterface(localOutFile)); - Telemetry::AutoTimer<Telemetry::URLCLASSIFIER_PS_FALLOCATE_TIME> timer; + nsCOMPtr<nsIFileOutputStream> fos(do_QueryInterface(localOutFile)); - fileSize = CalculatePreallocateSize(); + fileSize = CalculatePreallocateSize(); - // Ignore failure, the preallocation is a hint and we write out the entire - // file later on - Unused << fos->Preallocate(fileSize); - } + // Ignore failure, the preallocation is a hint and we write out the entire + // file later on + Unused << fos->Preallocate(fileSize); // Convert to buffered stream nsCOMPtr<nsIOutputStream> out = diff --git a/toolkit/components/url-classifier/nsUrlClassifierStreamUpdater.cpp b/toolkit/components/url-classifier/nsUrlClassifierStreamUpdater.cpp index 554bff342..e230f6951 100644 --- a/toolkit/components/url-classifier/nsUrlClassifierStreamUpdater.cpp +++ b/toolkit/components/url-classifier/nsUrlClassifierStreamUpdater.cpp @@ -646,9 +646,6 @@ nsUrlClassifierStreamUpdater::OnStartRequest(nsIRequest *request, if (NS_FAILED(status)) { // Assume we're overloading the server and trigger backoff. downloadError = true; - mozilla::Telemetry::Accumulate(mozilla::Telemetry::URLCLASSIFIER_UPDATE_REMOTE_STATUS, - 15 /* unknown response code */); - } else { bool succeeded = false; rv = httpChannel->GetRequestSucceeded(&succeeded); @@ -657,8 +654,6 @@ nsUrlClassifierStreamUpdater::OnStartRequest(nsIRequest *request, uint32_t requestStatus; rv = httpChannel->GetResponseStatus(&requestStatus); NS_ENSURE_SUCCESS(rv, rv); - mozilla::Telemetry::Accumulate(mozilla::Telemetry::URLCLASSIFIER_UPDATE_REMOTE_STATUS, - HTTPStatusToBucket(requestStatus)); LOG(("nsUrlClassifierStreamUpdater::OnStartRequest %s (%d)", succeeded ? "succeeded" : "failed", requestStatus)); if (!succeeded) { diff --git a/toolkit/content/browser-content.js b/toolkit/content/browser-content.js index 2276f8a0d..e1114672c 100644 --- a/toolkit/content/browser-content.js +++ b/toolkit/content/browser-content.js @@ -841,6 +841,35 @@ var FindBar = { fakeEvent[k] = event[k]; } } +#ifdef MC_PALEMOON + let findBarId = "FindToolbar"; + // The FindBar is in the chrome window's context, not in tabbrowser + // - see also bug 537013 + let chromeWin = null; + try { + chromeWin = content + .QueryInterface(Ci.nsIInterfaceRequestor) + .getInterface(Ci.nsIWebNavigation) + .QueryInterface(Ci.nsIDocShellTreeItem) + .rootTreeItem + .QueryInterface(Ci.nsIInterfaceRequestor) + .getInterface(Ci.nsIDOMWindow) + .QueryInterface(Ci.nsIDOMChromeWindow); + } catch (e) { + Cu.reportError( + "The FindBar - the chrome window's context was not detected:\n" + e); + } + if (chromeWin && chromeWin.document.getElementById(findBarId)) { + try { + chromeWin.document.getElementById(findBarId) + .browser = Services.wm.getMostRecentWindow("navigator:browser") + .gBrowser.mCurrentBrowser; + } catch (e) { + Cu.reportError( + "The FindBar - cannot set the property 'browser':\n" + e); + } + } +#endif // sendSyncMessage returns an array of the responses from all listeners let rv = sendSyncMessage("Findbar:Keypress", { diff --git a/toolkit/content/jar.mn b/toolkit/content/jar.mn index e1d432cb3..c11d3abed 100644 --- a/toolkit/content/jar.mn +++ b/toolkit/content/jar.mn @@ -39,7 +39,7 @@ toolkit.jar: content/global/plugins.html content/global/plugins.css content/global/browser-child.js - content/global/browser-content.js +* content/global/browser-content.js * content/global/buildconfig.html content/global/contentAreaUtils.js #ifndef MOZ_FENNEC diff --git a/toolkit/content/widgets/findbar.xml b/toolkit/content/widgets/findbar.xml index b92fb1d05..c312a6a25 100644 --- a/toolkit/content/widgets/findbar.xml +++ b/toolkit/content/widgets/findbar.xml @@ -282,6 +282,7 @@ return this._browser; ]]></getter> <setter><![CDATA[ + let prefsvc = this._prefsvc; if (this._browser) { if (this._browser.messageManager) { this._browser.messageManager.removeMessageListener("Findbar:Keypress", this); @@ -300,7 +301,9 @@ this._browser.messageManager.addMessageListener("Findbar:Mouseup", this); this._browser.finder.addResultListener(this); - this._findField.value = this._browser._lastSearchString; + if (prefsvc.getBoolPref("findbar.termPerTab") == true) { + this._findField.value = this._browser._lastSearchString; + } } return val; ]]></setter> diff --git a/toolkit/content/widgets/tabbox.xml b/toolkit/content/widgets/tabbox.xml index 02adb70b3..60c395c13 100644 --- a/toolkit/content/widgets/tabbox.xml +++ b/toolkit/content/widgets/tabbox.xml @@ -792,19 +792,6 @@ <field name="arrowKeysShouldWrap" readonly="true"> /Mac/.test(navigator.platform) </field> - <property name="TelemetryStopwatch" readonly="true"> - <getter><![CDATA[ - let module = {}; - Cu.import("resource://gre/modules/TelemetryStopwatch.jsm", module); - Object.defineProperty(this, "TelemetryStopwatch", { - configurable: true, - enumerable: true, - writable: true, - value: module.TelemetryStopwatch - }); - return module.TelemetryStopwatch; - ]]></getter> - </property> </implementation> <handlers> @@ -814,11 +801,6 @@ return; if (this != this.parentNode.selectedItem) { // Not selected yet - let stopwatchid = this.parentNode.getAttribute("stopwatchid"); - if (stopwatchid) { - this.TelemetryStopwatch.start(stopwatchid); - } - // Call this before setting the 'ignorefocus' attribute because this // will pass on focus if the formerly selected tab was focused as well. this.parentNode._selectNewTab(this); @@ -836,10 +818,6 @@ this.setAttribute("ignorefocus", "true"); setTimeout(tab => tab.removeAttribute("ignorefocus"), 0, this); } - - if (stopwatchid) { - this.TelemetryStopwatch.finish(stopwatchid); - } } // Otherwise this tab is already selected and we will fall // through to mousedown behavior which sets focus on the current tab, diff --git a/toolkit/locales/Makefile.in b/toolkit/locales/Makefile.in index 189e0b1b0..198d9aaa8 100644 --- a/toolkit/locales/Makefile.in +++ b/toolkit/locales/Makefile.in @@ -16,7 +16,9 @@ libs-%: @$(MAKE) -C ../../netwerk/locales/ libs AB_CD=$* XPI_NAME=locale-$* @$(MAKE) -C ../../dom/locales/ libs AB_CD=$* XPI_NAME=locale-$* @$(MAKE) -C ../../security/manager/locales/ libs AB_CD=$* XPI_NAME=locale-$* +ifdef MOZ_DEVTOOLS_SERVER @$(MAKE) -C ../../devtools/shared/locales/ libs AB_CD=$* XPI_NAME=locale-$* +endif @$(MAKE) libs AB_CD=$* XPI_NAME=locale-$* # target to be used by multi-locale l10n builds, just add this locale diff --git a/toolkit/themes/linux/global/jar.mn b/toolkit/themes/linux/global/jar.mn index b161f8cae..ba665adff 100644 --- a/toolkit/themes/linux/global/jar.mn +++ b/toolkit/themes/linux/global/jar.mn @@ -32,7 +32,7 @@ toolkit.jar: skin/classic/global/splitter.css skin/classic/global/tabbox.css skin/classic/global/textbox.css - skin/classic/global/toolbar.css +* skin/classic/global/toolbar.css skin/classic/global/toolbarbutton.css skin/classic/global/tree.css skin/classic/global/alerts/alert.css (alerts/alert.css) diff --git a/toolkit/themes/linux/global/toolbar.css b/toolkit/themes/linux/global/toolbar.css index f17fea12f..1d52aeb8f 100644 --- a/toolkit/themes/linux/global/toolbar.css +++ b/toolkit/themes/linux/global/toolbar.css @@ -31,11 +31,21 @@ menubar, toolbar[type="menubar"] { padding: 1px 0px; } + +%ifdef MOZ_AUSTRALIS +menubar:-moz-lwtheme, +toolbar:-moz-lwtheme { + -moz-appearance: none; + color: inherit; +} +%else menubar:-moz-lwtheme, toolbar:-moz-lwtheme { -moz-appearance: none; color: inherit; + border-style: none; } +%endif /* in browser.xul, the menubar is inside a toolbar... */ toolbaritem > menubar { diff --git a/toolkit/themes/osx/global/jar.mn b/toolkit/themes/osx/global/jar.mn index 2b7d19641..9ca73cc6b 100644 --- a/toolkit/themes/osx/global/jar.mn +++ b/toolkit/themes/osx/global/jar.mn @@ -44,7 +44,7 @@ toolkit.jar: skin/classic/global/tabbox.css skin/classic/global/textbox.css skin/classic/global/datetimepicker.css - skin/classic/global/toolbar.css +* skin/classic/global/toolbar.css skin/classic/global/toolbarbutton.css * skin/classic/global/tree.css * skin/classic/global/viewbuttons.css diff --git a/toolkit/themes/osx/global/toolbar.css b/toolkit/themes/osx/global/toolbar.css index 820436f14..f07332d2f 100644 --- a/toolkit/themes/osx/global/toolbar.css +++ b/toolkit/themes/osx/global/toolbar.css @@ -16,12 +16,21 @@ toolbar { -moz-appearance: toolbar; } +%ifdef MOZ_AUSTRALIS menubar:-moz-lwtheme, toolbar:-moz-lwtheme { -moz-appearance: none; background: none; border-color: transparent; } +%else +menubar:-moz-lwtheme, +toolbar:-moz-lwtheme { + -moz-appearance: none; + background: none; + border-style: none; +} +%endif menubar { -moz-appearance: dialog; /* For content menubars, "toolbar" is too dark, so we use "dialog". */ diff --git a/toolkit/themes/windows/global/jar.mn b/toolkit/themes/windows/global/jar.mn index a2cc9e2ea..6f0cf4130 100644 --- a/toolkit/themes/windows/global/jar.mn +++ b/toolkit/themes/windows/global/jar.mn @@ -37,7 +37,7 @@ toolkit.jar: skin/classic/global/printPreview.css skin/classic/global/scrollbox.css skin/classic/global/splitter.css - skin/classic/global/toolbar.css +* skin/classic/global/toolbar.css skin/classic/global/toolbarbutton.css * skin/classic/global/tree.css skin/classic/global/alerts/alert.css (alerts/alert.css) diff --git a/toolkit/themes/windows/global/toolbar.css b/toolkit/themes/windows/global/toolbar.css index dcd8d361f..38c8a617a 100644 --- a/toolkit/themes/windows/global/toolbar.css +++ b/toolkit/themes/windows/global/toolbar.css @@ -37,7 +37,8 @@ toolbar:first-child, menubar { } /* ::::: lightweight theme ::::: */ - + +%ifdef MOZ_AUSTRALIS menubar:-moz-lwtheme, toolbox:-moz-lwtheme, toolbar:-moz-lwtheme { @@ -45,6 +46,15 @@ toolbar:-moz-lwtheme { background: none; border-color: transparent; } +%else +menubar:-moz-lwtheme, +toolbox:-moz-lwtheme, +toolbar:-moz-lwtheme { + -moz-appearance: none; + background: none; + border-style: none; +} +%endif /* ::::: toolbar decorations ::::: */ diff --git a/toolkit/xre/nsAppRunner.cpp b/toolkit/xre/nsAppRunner.cpp index 40f9ead79..59a72c432 100644 --- a/toolkit/xre/nsAppRunner.cpp +++ b/toolkit/xre/nsAppRunner.cpp @@ -4338,11 +4338,6 @@ mozilla::BrowserTabsRemoteAutostart() gBrowserTabsRemoteStatus = status; - mozilla::Telemetry::Accumulate(mozilla::Telemetry::E10S_STATUS, status); - if (prefEnabled) { - mozilla::Telemetry::Accumulate(mozilla::Telemetry::E10S_BLOCKED_FROM_RUNNING, - !gBrowserTabsRemoteAutostart); - } return gBrowserTabsRemoteAutostart; } diff --git a/toolkit/xre/nsXREDirProvider.cpp b/toolkit/xre/nsXREDirProvider.cpp index d904cb83a..265652477 100644 --- a/toolkit/xre/nsXREDirProvider.cpp +++ b/toolkit/xre/nsXREDirProvider.cpp @@ -953,27 +953,6 @@ nsXREDirProvider::DoStartup() else mode = 2; } - mozilla::Telemetry::Accumulate(mozilla::Telemetry::SAFE_MODE_USAGE, mode); - - // Telemetry about number of profiles. - nsCOMPtr<nsIToolkitProfileService> profileService = - do_GetService("@mozilla.org/toolkit/profile-service;1"); - if (profileService) { - nsCOMPtr<nsISimpleEnumerator> profiles; - rv = profileService->GetProfiles(getter_AddRefs(profiles)); - if (NS_WARN_IF(NS_FAILED(rv))) { - return rv; - } - - uint32_t count = 0; - nsCOMPtr<nsISupports> profile; - while (NS_SUCCEEDED(profiles->GetNext(getter_AddRefs(profile)))) { - ++count; - } - - mozilla::Telemetry::Accumulate(mozilla::Telemetry::NUMBER_OF_PROFILES, - count); - } obsSvc->NotifyObservers(nullptr, "profile-initial-state", nullptr); } |