Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add about:studies #750

Closed
Osmose opened this issue May 9, 2017 · 7 comments
Closed

Add about:studies #750

Osmose opened this issue May 9, 2017 · 7 comments
Assignees

Comments

@Osmose
Copy link
Contributor

Osmose commented May 9, 2017

Users should be able to visit about:experiments to see a listing of the experiments that they have participated in. An outdated visual mockup based off the about:addons listing is available here.

To simplify things, this issue only covers adding a blank page at that URL. Subsequent issues will cover the content.

@MattGrimes
Copy link

Any chance this could be about:studies instead of experiments? We try not to use experiments whenever possible because it has negative connotations.

@Osmose
Copy link
Contributor Author

Osmose commented May 11, 2017

Works for me. @telliot does that work for Pioneer as well?

@Osmose
Copy link
Contributor Author

Osmose commented Jul 12, 2017

@andymikulski's kicking butt on the admin side, so I'll be taking this on in his stead

@Osmose Osmose self-assigned this Jul 12, 2017
@Osmose
Copy link
Contributor Author

Osmose commented Jul 13, 2017

@gijsk I have a wip commit implementing about:studies based on your feedback via email and in the PR, but I'm having trouble figuring out how to test that I'm doing things correctly. My about page shows up, but I dunno how to test whether it has the right restrictions from being in the content process. Any guidance on how to test that patch, or if anything is missing?

Also, although out of scope for this particular issue, how would I get data from the parent process to the child process to get a list of studies / request that a study be disabled? Would I just use the child process message manager in the JS in the HTML page to send and receive events, and the parent process manager in the main add-on code?

@Osmose
Copy link
Contributor Author

Osmose commented Jul 13, 2017

Whoops, forgot to link to the commit: Osmose@20e2b23

@Osmose
Copy link
Contributor Author

Osmose commented Jul 13, 2017

Also, although out of scope for this particular issue, how would I get data from the parent process to the child process to get a list of studies / request that a study be disabled? Would I just use the child process message manager in the JS in the HTML page to send and receive events, and the parent process manager in the main add-on code?

Update: I have a simple listing that gets a list of studies from the child process message manager, but I'm stuck on how the parent process will know to send the list of studies (outside of whenever the list is updated). Should it listen for an event from the child process? Should I be using broadcastAsyncMessage, even though the docs say to avoid it?

@gijsk
Copy link
Contributor

gijsk commented Jul 17, 2017

The simplest way I know of checking what's happening manually is to open the page as the selected tab and, with the browser console, check gBrowser.selectedBrowser.contentPrincipal. If that has isSystemPrincipal set to true, something's not working right. I think in principle, in this case, it should be a null principal. It looks like for this to happen for your page, you'll want to pass Ci.nsIAboutModule.URI_SAFE_FOR_UNTRUSTED_CONTENT as well as the ALLOW_SCRIPT flag.

This will stop you from running chrome-privileged script directly in the page. If you need to communicate with the page from a listener, you would do that from the content process script (shield-content-process.js). See e.g. this code for an example:

https://dxr.mozilla.org/mozilla-central/source/browser/base/content/content.js#324

The TL;DR is that your content page can dispatch a new CustomEvent("AboutStudiesLoaded") event on its window/document, and you can listen for this in the content process script. From there you can send a message to the parent process to get the list of studies. It can then send a message back using the target property of the message it received, so you wouldn't need to broadcast.

When you receive a message back from the parent, you check that the content page is still about:studies (see the code linked above) and then you can either pass the data via another custom event, or manipulate the page DOM directly from your process script. If you go the custom event route (which might be easier if you use react here) then I expect you'll want to use Cu.cloneInto to make the plain JS objects readable for the page, much like we do for the SHIELD sandbox.

Does that make sense? :-)

Osmose pushed a commit to Osmose/normandy that referenced this issue Jul 20, 2017
Osmose pushed a commit to Osmose/normandy that referenced this issue Jul 21, 2017
Osmose pushed a commit to Osmose/normandy that referenced this issue Jul 22, 2017
Osmose pushed a commit to Osmose/normandy that referenced this issue Jul 25, 2017
Osmose pushed a commit to Osmose/normandy that referenced this issue Jul 26, 2017
@Osmose Osmose closed this as completed in 53a1584 Jul 28, 2017
@mythmon mythmon added this to the opt-out-studies milestone Jan 30, 2018
@mythmon mythmon added this to Completed in Opt Out Studies Feb 5, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Opt Out Studies
  
Completed
Development

No branches or pull requests

5 participants