Closed Bug 603674 Opened 14 years ago Closed 14 years ago

User-modifiable preference for base URL of snippets service in about:home

Categories

(Firefox :: General, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
Firefox 4.0b8
Tracking Status
blocking2.0 --- final+

People

(Reporter: lorchard, Assigned: mak)

References

Details

(Whiteboard: [about-home])

Attachments

(1 file, 3 obsolete files)

The base URL for the snippets service used by about:home is currently hardcoded to "http://snippets.mozilla.com" It would be better for webdev and QA if this base URL could be modified in about:config. (eg. expected values could include things like "http://localhost:8000" and "http://homesnippets.stage.mozilla.com") Since the current code looks at localStorage['snippets-update-url'], changes to the base URL in about:config would also require a rebuild of the whole URL to replace the localStorage version
taking for now
Assignee: nobody → mak77
For what it's worth, I just figured a workaround for this. I can use a bookmarklet like this on about:home: javascript:void(localStorage['snippets-update-url-orig']=localStorage['snippets-update-url'];localStorage['snippets-update-url']='http://localhost:8000/1/Firefox/4.0b8pre/20101010030401/Darwin_Universal-gcc3/en-US/nightly/Darwin 10.4.0/default/default/') And then something like this to restore the original value: javascript:void(localStorage['snippets-update-url']=localStorage['snippets-update-url-orig']); Of course this is pretty hacky, and can leave the snippets update URL in a bad state, but it could be a workaround if there's not time to implement a more robust about:config based solution
Another problem with the pref stuff is that it could have an unwanted impact on startup. Undeed, right now we just update on each build change (so daily for nightlies, but less often for other releases). We would have to load and update the value on each start, plus add a pref listener. Maybe I could just read the value from the pref on upgrade, to force an upgrade it would be enough to fake a build update clearing browser.startup.homepage_override.buildID value and restarting browser.
Attached patch patch v1.0 (obsolete) (deleted) — Splinter Review
this does the above, updating the url from the pref at each new build. Actually the bookmarklet made me drop completely my faith in security of hardcoding the url. Indeed we should probably add a check somewhere that the url points to a mozilla valid host. What do you think Gavin?
Attachment #482836 - Flags: review?(gavin.sharp)
Attached patch patch v1.1 (obsolete) (deleted) — Splinter Review
how did that period finish there!? bah.
Attachment #482836 - Attachment is obsolete: true
Attachment #482838 - Flags: review?(gavin.sharp)
Attachment #482836 - Flags: review?(gavin.sharp)
(In reply to comment #4) > Indeed we should probably add a check somewhere that the > url points to a mozilla valid host. What do you think Gavin? FWIW, requiring that the URL points to a Mozilla host would keep me from using my laptop (http://localhost:8000/) or my public server demo (http://snippets.decafbad.com/) - which is the reason I filed this in the first place. It would hopefully let us use a Mozilla staging server like http://snippets.stage.mozilla.com/, but I'm not sure what any hardcoded restriction buys overall
Whiteboard: [needs review gavin]
Perhaps we should add code in the startup path that calls AboutHomeUtils.loadSnippetsURL if this pref has a user value, so that changing it just requires a restart, without having to reset the buildID pref too? I don't think we need to put any restrictions on the value.
Attached patch patch v1.2 (obsolete) (deleted) — Splinter Review
this makes so that we update the entry if either there is an override or the pref has a user value. Also replaces some GetService with Services since we already imported Services.jsm in the file. I triple checked each change and will most likely do another pass.
Attachment #482838 - Attachment is obsolete: true
Attachment #485840 - Flags: review?(gavin.sharp)
Attachment #482838 - Flags: review?(gavin.sharp)
I've done another pass checking changes line by line, and created a new profile, everything looks in place.
Comment on attachment 485840 [details] [diff] [review] patch v1.2 Sorry to be mean, but can you move the Services.jsm-related cleanup to a followup (minus the addition of urlFormatter, that part can stay) that we can ignore until post-4.0? I'd really rather not do it now.
Attachment #485840 - Flags: review?(gavin.sharp)
Attached patch patch v1.3 (deleted) — Splinter Review
minimum changes.
Attachment #485840 - Attachment is obsolete: true
Attachment #487894 - Flags: review?(gavin.sharp)
Attachment #487894 - Flags: review?(gavin.sharp) → review+
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 4.0b8
Whiteboard: [needs review gavin]
Whiteboard: [about-home]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: