Skip to content

Instantly share code, notes, and snippets.

@brendandahl
Created May 2, 2012 19:01
Show Gist options
  • Save brendandahl/2579276 to your computer and use it in GitHub Desktop.
Save brendandahl/2579276 to your computer and use it in GitHub Desktop.
Change Channel Owner
// Keep the URL the same so the browser sees it as the same.
channel.originalURI = aRequest.URI;
channel.asyncOpen(proxy, aContext);
var securityManager = Cc["@mozilla.org/scriptsecuritymanager;1"].getService(Ci.nsIScriptSecurityManager);
log('got secruity manager!');
var uri = ioService.newURI('resource://pdf.js/web/viewer.html', null, null);
var principal = securityManager.getCodebasePrincipal(uri);
log('created principal!');
channel.owner = principal;
log('hey we changed the owner!');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment