Skip to content

Commit

Permalink
Trick to open blob:… URIs
Browse files Browse the repository at this point in the history
  • Loading branch information
Infocatcher committed Apr 16, 2018
1 parent d2306de commit 0a0d5bb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 2 additions & 0 deletions background.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,8 @@ function updateMenus() {

function onMessageFromContent(msg, sender, sendResponse) {
if(msg.action == "openURI") {
if(msg.uri instanceof Blob) // Should be converted here to prevent security errors
msg.uri = URL.createObjectURL(msg.uri);
if(msg.loadIn == 1)
openURIInWindow(sender.tab, msg);
else
Expand Down
4 changes: 1 addition & 3 deletions content.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,10 +184,8 @@ function openURIItem(e, trg, it, inBG, loadIn) {
&& "URL" in window
&& "createObjectURL" in URL
) {
// Note: not allowed at least for now
// Security Error: Content at moz-extension://.../ may not load data from blob:...
it.toBlob(function(blob) {
openURIIn(URL.createObjectURL(blob), inBG, loadIn);
openURIIn(blob, inBG, loadIn);
});
return;
}
Expand Down

0 comments on commit 0a0d5bb

Please sign in to comment.