Closed Bug 1134315 Opened 9 years ago Closed 9 years ago

directory activation uses directory origin in panel

Categories

(Firefox Graveyard :: SocialAPI, defect)

38 Branch
x86
macOS
defect
Not set
normal

Tracking

(firefox38 fixed)

RESOLVED FIXED
Firefox 38
Tracking Status
firefox38 --- fixed

People

(Reporter: mixedpuppy, Assigned: mixedpuppy)

Details

Attachments

(2 files, 1 obsolete file)

When activating from the activations directory, the panel says "would you like to activate services from activations.cdn.mozilla.net".  If you're activating (for example) pocket, it should say "would you like to activate services from getpocket.com".
Attached patch 1134315 (obsolete) — Splinter Review
Assignee: nobody → mixedpuppy
Attachment #8566138 - Flags: review?(jaws)
So what happens to "internal" then?
Flags: needinfo?(mixedpuppy)
Comment on attachment 8566138 [details] [diff] [review]
1134315

Review of attachment 8566138 [details] [diff] [review]:
-----------------------------------------------------------------

What are the possibilities for data.installType? If it is just "internal" or "foreign" then this is no behavior change.
There are 3 possible results, directory, internal and foreign.  directory and internal should use the origin in the manifest, foreign should always use origin of the activation.
Flags: needinfo?(mixedpuppy)
Comment on attachment 8566138 [details] [diff] [review]
1134315

Review of attachment 8566138 [details] [diff] [review]:
-----------------------------------------------------------------

::: toolkit/components/social/SocialService.jsm
@@ +550,5 @@
>      let browserBundle = Services.strings.createBundle("chrome://browser/locale/browser.properties");
>  
> +    // foreign activation uses the activation url for origin, otherwise use the manifest origin
> +    let requestingURI =  Services.io.newURI(data.installType == "foreign" ?
> +                                            data.url : data.manifest.origin, null, null);

Can you please refactor this to be more clear (at the cost of being extra verbose)?

let url = data.installType == "foreign" ?
            data.url :
            data.installType == "directory" ||
            data.installType == "internal" ?
              data.manifest.origin;
let requestingURI = Services.io.newURI(url, null, null);

Also, it would be nice if you updated the code at line 163 and 165 to use double-quotes instead of single-quotes.
Attachment #8566138 - Flags: review?(jaws) → review+
Attached patch 1134315.txtSplinter Review
carry forward r+

https://hg.mozilla.org/integration/fx-team/rev/1fc897448cad
Attachment #8566138 - Attachment is obsolete: true
Attachment #8566211 - Flags: review+
https://hg.mozilla.org/mozilla-central/rev/1fc897448cad
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 38
(In reply to Jared Wein [:jaws] (please needinfo? me) from comment #5)
> let url = data.installType == "foreign" ?
>             data.url :
>             data.installType == "directory" ||
>             data.installType == "internal" ?
>               data.manifest.origin;

I didn't realize until Gavin mentioned this change that the second case of the second ternary operator was missing from my recommendation. I see that the code that landed added in an `undefined` result for this case, which probably isn't something that we want passed to newURI.

Shane, would you be OK with changing this to an if/else-if/else and in the else calling Cu.reportError() or some other type of logging and throwing?
Flags: needinfo?(mixedpuppy)
Attached patch 1134315Splinter Review
Flags: needinfo?(mixedpuppy)
Attachment #8566642 - Flags: review?(jaws)
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Comment on attachment 8566642 [details] [diff] [review]
1134315

Review of attachment 8566642 [details] [diff] [review]:
-----------------------------------------------------------------

This is better. Thanks!
Attachment #8566642 - Flags: review?(jaws) → review+
AFAICT this landed on MC
https://hg.mozilla.org/mozilla-central/rev/3b28be32ebc7
https://hg.mozilla.org/mozilla-central/rev/cee52e6c3662
Status: REOPENED → RESOLVED
Closed: 9 years ago9 years ago
Resolution: --- → FIXED
Mistakenly filed against Firefox 38 and should be instead 38 Branch. Sorry for the spam. dkl
Version: Firefox 38 → 38 Branch
Product: Firefox → Firefox Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: