Closed Bug 820601 Opened 12 years ago Closed 12 years ago

mozSocial api for browser tab content

Categories

(Firefox Graveyard :: SocialAPI, defect)

x86
macOS
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
Firefox 24

People

(Reporter: mixedpuppy, Assigned: mixedpuppy)

Details

(Whiteboard: [needs-api-change] )

Attachments

(1 file, 3 obsolete files)

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.
This is useful for debugging a provider in a tab using our dev tools
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)
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)
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+
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 24
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: