mozSocial api for browser tab content

RESOLVED FIXED in Firefox 24

Status

()

RESOLVED FIXED
6 years ago
6 years ago

People

(Reporter: mixedpuppy, Assigned: mixedpuppy)

Tracking

Trunk
Firefox 24
x86
Mac OS X
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: [needs-api-change] )

Attachments

(1 attachment, 3 obsolete attachments)

(Assignee)

Description

6 years ago
We should inject the navigator.mozSocial APIs into any content loaded from a provider.  This would allow their normal web pages to interact better with the social provider content.

A secondary use would be to always inject mozSocial for whitelisted providers to help with issues presented by bug 785540.  In this case, most of the APIs would need to verify the provider is activated before doing anything.
(Assignee)

Comment 1

6 years ago
Created attachment 692656 [details]
inject mozSocial on any provider content

This is useful for debugging a provider in a tab using our dev tools
(Assignee)

Comment 2

6 years ago
Gavin, this patch would be incredibly useful for debugging/development purposes as well as easing some interactions between pages in a tab and social content (e.g. not relying on localStorage flags).  Otherwise, the first case (debugging/development) could be handled with a pref to allow the injection on tab content.  Do you have any opinion here?
Flags: needinfo?(gavin.sharp)
I'm not so comfortable with doing this by default, but putting it behind a hidden pref seems reasonable.
Flags: needinfo?(gavin.sharp)
(Assignee)

Comment 4

6 years ago
Created attachment 755659 [details] [diff] [review]
inject mozSocial on any provider content

if social.browser-tabs is true, we'll inject navigator.mozSocial onto provider pages in browser tabs.
Assignee: nobody → mixedpuppy
Attachment #692656 - Attachment is obsolete: true
Attachment #755659 - Flags: review?(felipc)
(Assignee)

Comment 6

6 years ago
Created attachment 755700 [details] [diff] [review]
inject mozSocial on any provider content

fixed patch and feedback.
Attachment #755659 - Attachment is obsolete: true
Attachment #755659 - Flags: review?(felipc)
Attachment #755700 - Flags: review?(felipc)
Comment on attachment 755700 [details] [diff] [review]
inject mozSocial on any provider content

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

I think developers might get in a situation where they flip this pref and forget about it, get things working and don't realize it won't work with the pref off..  But if you think it'll will be more useful than confusing, so be it

::: toolkit/components/social/MozSocialAPI.jsm
@@ +53,5 @@
>                                    .getInterface(Ci.nsIWebNavigation)
>                                    .QueryInterface(Ci.nsIDocShell)
>                                    .chromeEventHandler;
> +    // limit injecting into social panels or same-origin browser tabs if
> +    // social.browser-tabs is enabled

comment needs updating with the new pref name

@@ +57,5 @@
> +    // social.browser-tabs is enabled
> +    let allowTabs = false;
> +    try {
> +      allowTabs = containingBrowser.contentWindow == window &&
> +                    Services.prefs.getBoolPref("social.debug.injectIntoTabs");

align the two lines?

@@ +63,3 @@
>  
>      let origin = containingBrowser.getAttribute("origin");
> +    if (!allowTabs && (!origin || origin != doc.nodePrincipal.origin)) {

attachToWindow already checks the origin
Attachment #755700 - Flags: review?(felipc) → review+
(Assignee)

Comment 8

6 years ago
Created attachment 755718 [details] [diff] [review]
inject mozSocial on any provider content

feedback implemented

https://tbpl.mozilla.org/?tree=Try&rev=7de13933c346
Attachment #755700 - Attachment is obsolete: true
Attachment #755718 - Flags: review+
https://hg.mozilla.org/mozilla-central/rev/a73a0a88d8f9
Status: NEW → RESOLVED
Last Resolved: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 24
You need to log in before you can comment on or make changes to this bug.