Closed Bug 1377559 Opened 7 years ago Closed 7 years ago

Should store value of preference browser.safebrowsing.debug to reuse

Categories

(Toolkit :: Safe Browsing, enhancement, P2)

enhancement

Tracking

()

RESOLVED FIXED
mozilla56
Tracking Status
firefox56 --- fixed

People

(Reporter: tnguyen, Assigned: tnguyen)

References

Details

(Whiteboard: #sbv4-m8)

Attachments

(1 file, 1 obsolete file)

I see in url-classifier code that preference browser.safebrowsing.debug (in log(...))is read a lot of time, should cache it somewhere, listen to value change, and reuse
Priority: -- → P2
Attached patch Cache debug pref (obsolete) — Splinter Review
MozReview-Commit-ID: 1yWe7wB0ARl
Assignee: nobody → tnguyen
Status: NEW → ASSIGNED
Blocks: 1376591
Wip patch, I would like to wait for landing bug 1297614 first
No longer blocks: 1376591
Blocks: 1376591
Whiteboard: #sbv4-m8
Summary: Should cache preference browser.safebrowsing.debug → Should store value of preference browser.safebrowsing.debug to reuse
Attachment #8883240 - Attachment is obsolete: true
Attachment #8884143 - Flags: review?(francois)
Comment on attachment 8884143 [details]
Bug 1377559 - Should store value of preference browser.safebrowsing.debug to reuse

https://reviewboard.mozilla.org/r/155054/#review160370

::: toolkit/components/url-classifier/SafeBrowsing.jsm:13
(Diff revision 1)
>  const Ci = Components.interfaces;
>  const Cu = Components.utils;
>  
>  Cu.import("resource://gre/modules/Services.jsm");
>  
> +let loggingEnabled = false;

Let's add a constant here, just like in listmanager.js

::: toolkit/components/url-classifier/content/listmanager.js:23
(Diff revision 1)
>  // Lower and upper limits on the server-provided polling frequency
>  const minDelayMs = 5 * 60 * 1000;
>  const maxDelayMs = 24 * 60 * 60 * 1000;
>  const defaultUpdateIntervalMs = 30 * 60 * 1000;
>  
> +const PREF_LOGGING_ENABLED = "browser.safebrowsing.debug";

The `loggingEnabled` variable makes sense to me, but I think the constant should be `PREF_DEBUG_ENABLED` to avoid confusion.

::: toolkit/components/url-classifier/nsUrlClassifierHashCompleter.js:18
(Diff revision 1)
>  const COMPLETE_LENGTH = 32;
>  const PARTIAL_LENGTH = 4;
>  
>  // Upper limit on the server response minimumWaitDuration
>  const MIN_WAIT_DURATION_MAX_VALUE = 24 * 60 * 60 * 1000;
> +const PREF_LOGGING_ENABLED = "browser.safebrowsing.debug";

`PREF_DEBUG_ENABLED`
Attachment #8884143 - Flags: review?(francois) → review-
Comment on attachment 8884143 [details]
Bug 1377559 - Should store value of preference browser.safebrowsing.debug to reuse

https://reviewboard.mozilla.org/r/155054/#review160606

Thanks you for your review
Comment on attachment 8884143 [details]
Bug 1377559 - Should store value of preference browser.safebrowsing.debug to reuse

https://reviewboard.mozilla.org/r/155054/#review160812

::: toolkit/components/url-classifier/SafeBrowsing.jsm:196
(Diff revision 2)
>      // skip nextupdatetime and lastupdatetime
>      if (aData.indexOf("lastupdatetime") >= 0 || aData.indexOf("nextupdatetime") >= 0) {
>        return;
>      }
> +
> +    if (aData == PREF_DEBUG_ENABLED") {

This stray `"` is causing a syntax error.
Attachment #8884143 - Flags: review?(francois) → review-
Comment on attachment 8884143 [details]
Bug 1377559 - Should store value of preference browser.safebrowsing.debug to reuse

https://reviewboard.mozilla.org/r/155054/#review161366
Attachment #8884143 - Flags: review?(francois) → review+
Pushed by cbook@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/f95be8a71102
Should store value of preference browser.safebrowsing.debug to reuse r=francois
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/f95be8a71102
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla56
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: