hypothesisInstall()
will use the inject.stylesheet()
function passed in to it to inject stylesheets into the page or, if no function was passed in, it'll fallback on the default function defined inline here.
The default method just uses the DOM's appendChild()
method, but this method may fail if the site we're trying to annotate uses the Content Security Policy.
That's why when we're using one of the browser plugins rather than the bookmarklet, we pass in the browser API's method for injecting a stylesheet instead.
This is why the bookmarklet doesn't currently work on GitHub, for example, but the Chrome plugin does.