Closed Bug 1168084 Opened 9 years ago Closed 9 years ago

View source preferences should be persisted

Categories

(Toolkit :: View Source, defect)

41 Branch
defect
Not set
normal

Tracking

()

VERIFIED FIXED
mozilla41
Tracking Status
firefox41 + fixed

People

(Reporter: alice0775, Assigned: jryans)

References

Details

(Keywords: regression, Whiteboard: [Bugday-20150902])

Attachments

(1 file, 1 obsolete file)

Steps To Reproduce:
1. Open Web page
2. Ctrl+U open View Page Source
3. Right Click and Choose "Wrap Long Line"
4. Ctrl+w close the View Page Source
5. Repeat Step 2

Actual Results:
State of the "Wrap Long Line" is reset

Expected results:

State of the "Wrap Long Line" should be persisted
[Tracking Requested - why for this release]: Regression in view-source functionality

This also affects the Syntax highlighting setting.
Keywords: regression
Summary: State of the "Wrap Long Line" should be kept forever → View source preferences should be persisted
Assignee: nobody → jryans
Status: NEW → ASSIGNED
Attached file MozReview Request: bz://1168084/jryans (obsolete) —
/r/9407 - Bug 1168084 - Persist view source tab options. r=mconley

Pull down this commit:

hg pull -r e18b9a9c3bb3b77cf917cb268fa35bfd267ffbc3 https://reviewboard-hg.mozilla.org/gecko/
Comment on attachment 8610929 [details]
MozReview Request: bz://1168084/jryans

/r/9407 - Bug 1168084 - Persist view source tab options. r=mconley

Pull down this commit:

hg pull -r b21067d7cdc1dd7d60d6c5cab56dc27c4ab9f8ec https://reviewboard-hg.mozilla.org/gecko/
Attachment #8610929 - Flags: review?(mconley)
Adding a tracking flag for Firefox41. Another regression in View Source component.
https://reviewboard.mozilla.org/r/9405/#review8569

This looks good! Just one minor suggestion for the tests.

::: toolkit/components/viewsource/test/browser/browser_viewsourceprefs.js:44
(Diff revision 2)
> +  let prefReady = waitForStoreWrapping(win);

Instead of wrapping the functions like this, you can use Preferences.jsm to observe the pref. That'll also test to make sure that the pref was actually updated.

Example:

```
Cu.import("resource://gre/modules/PromiseUtils.jsm");
Cu.import("resource://gre/modules/Preferences.jsm");

// ...

function waitForStorePref() {
  let deferred = PromiseUtils.defer();
  let observer = () => {
    Preferences.ignore("view_source.wrap_long_lines", observer);
    deferred.resolve();
  };
  
  Preferences.observe("view_source.wrap_long_lines", observer);
  return deferred.promise;
}
```

There are possibly better ways of structuring that - but I think I'd prefer this over patching the viewSourceChrome object.

::: toolkit/components/viewsource/test/browser/browser_viewsourceprefs.js:117
(Diff revision 2)
> +function waitForStoreWrapping(win) {
> +  return new Promise(resolve => {
> +    let storeWrapping = win.viewSourceChrome.storeWrapping;
> +    win.viewSourceChrome.storeWrapping = state => {
> +      storeWrapping(state);
> +      win.viewSourceChrome.storeWrapping = storeWrapping;
> +      resolve();
> +    };
> +  });
> +}
> +
> +function waitForStoreSyntaxHighlighting(win) {
> +  return new Promise(resolve => {
> +    let storeSyntaxHighlighting = win.viewSourceChrome.storeSyntaxHighlighting;
> +    win.viewSourceChrome.storeSyntaxHighlighting = state => {
> +      storeSyntaxHighlighting(state);
> +      win.viewSourceChrome.storeSyntaxHighlighting = storeSyntaxHighlighting;
> +      resolve();
> +    };
> +  });
> +}

See my comment above about using Preferences.jsm to observe that the preference was actually updated.
Comment on attachment 8613710 [details]
MozReview Request: Bug 1168084 - Persist view source tab options. r=mconley

https://reviewboard.mozilla.org/r/9407/#review8597

Looks good! Thanks jryans!
Attachment #8613710 - Flags: review?(mconley) → review+
https://hg.mozilla.org/mozilla-central/rev/8ff42f8c288c
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla41
QA Whiteboard: [good first verify]
I have reproduced this bug in Nightly 41.0a1(Build ID: 20150525030205)(Mozilla/5.0 (Windows NT 6.3; Win64; x64; rv:41.0) Gecko/20100101 Firefox/41.0) with instruction from comment 0

Verified as fixed now on latest nightly Edition 43.0a1 (Build ID: 20150901030226) 

Mozilla/5.0 (Windows NT 6.3; Win64; x64; rv:43.0) Gecko/20100101 Firefox/43.0

[Bugday-20150902]
QA Whiteboard: [good first verify] → [good first verify] [Bugday-20150902]
Whiteboard: [Bugday-20150902]
Verified as fixed on beta 41.0b6 (Build ID: 20150831172306) 

Mozilla/5.0 (Windows NT 6.3; Win64; x64; rv:41.0) Gecko/20100101 Firefox/41.0
Status: RESOLVED → VERIFIED
I have reproduced this bug in Nightly 41.0a1 ( Build ID  20150525030205) 
Mozilla/5.0 (X11; Linux x86_64; rv:41.0) Gecko/20100101 Firefox/41.0


Verified as fixed on beta 41.0b6 (Build ID  20150831172306) 
Mozilla/5.0 (X11; Linux x86_64; rv:41.0) Gecko/20100101 Firefox/41.0

[Bugday-20150902]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: