Enable Web Worker again in Chrome extension
Previously, Web Workers were not created because of a security policy which does not respect relaxed privileges.
This commit is contained in:
parent
88767e1861
commit
57e6238a6e
3 changed files with 146 additions and 2 deletions
|
@ -60,9 +60,17 @@ function replaceDocumentWithViewer(url) {
|
|||
|
||||
// Remove all <script> elements (added back later).
|
||||
// I assumed that no inline script tags exist.
|
||||
var scripts = [];
|
||||
var scripts = [], script;
|
||||
|
||||
// new Worker('chrome-extension://..../pdf.js') fails, despite having
|
||||
// the correct permissions. Fix it:
|
||||
script = document.createElement('script');
|
||||
script.onload = loadNextScript;
|
||||
script.src = chrome.extension.getURL('patch-worker.js');
|
||||
scripts.push(script);
|
||||
|
||||
while (x.response.scripts.length) {
|
||||
var script = x.response.scripts[0];
|
||||
script = x.response.scripts[0];
|
||||
var newScript = document.createElement('script');
|
||||
newScript.onload = loadNextScript;
|
||||
newScript.src = script.src;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue