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

IE11 Gives Security Error for new FA2 Algorithm #314

Closed
apitts opened this issue Jun 20, 2014 · 20 comments
Closed

IE11 Gives Security Error for new FA2 Algorithm #314

apitts opened this issue Jun 20, 2014 · 20 comments

Comments

@apitts
Copy link
Contributor

apitts commented Jun 20, 2014

I'm getting a security error in the console and the layout algorithm doesn't work in Internet Explorer 11. I believe it may be this issue associated with webworkers in IE10 and IE11: http://stackoverflow.com/questions/10343913/how-to-create-a-web-worker-from-a-string

Since I'm on Linux though I run IE11 in a VM and it's a bit difficult for me to debug properly.

@Yomguithereal
Copy link
Collaborator

Hello @apitts

This is indeed an annoying problem. According to your post, the issue is the blobworker step in IE 10+. Two solutions exist and are the following:

  1. Create a 'fake worker' that will receive its proper code and running it through eval.
  2. Use the worker in a separated file and detect IE 10+ in sigma to call on this separated file to launch the worker.

Did you think of anything else?

I am having a hard time correcting this one since I don't currently have any IE 10+ to test on.

@apitts
Copy link
Contributor Author

apitts commented Jun 20, 2014

I am afraid your knowledge is the same as mine on the issue. And I am with
you on the IE difficulties. The way I do it is downloading the free image
that Microsoft provides for testing and use it on virtual box. I really
wish I could help more as it's obviously an important issue but I don't
have any further ideas at the moment.
On Jun 20, 2014 7:39 PM, "Guillaume Plique" notifications@github.com
wrote:

Hello @apitts https://github.com/apitts

This is indeed an annoying problem. According to your post, the issue is
the blobworker step in IE 10+. Two solutions exist and are the following:

  1. Create a 'fake worker' that will receive its proper code and
    running it through eval.
  2. Use the worker in a separated file and detect IE 10+ in sigma to
    call on this separated file to launch the worker.

Did you find anything else?

I am having a hard time correcting this one since I don't currently have
any IE 10+ to test on.


Reply to this email directly or view it on GitHub
#314 (comment).

@Yomguithereal
Copy link
Collaborator

For the time being, if you need to have FA2 running on IE10+ quick, I advise you to use solution n°2 by taking this file and build a custom version of sigma changing things around here.

@apitts
Copy link
Contributor Author

apitts commented Jun 20, 2014

Thanks! I will try it out over the weekend.
On Jun 20, 2014 7:53 PM, "Guillaume Plique" notifications@github.com
wrote:

For the time being, if you need to have FA2 working on IE10+ quick, I
advise you to use solution n°2 by taking this file
https://github.com/jacomyal/sigma.js/blob/master/plugins/sigma.layout.forceAtlas2/worker.js
and build a custom version of sigma changing things around here
https://github.com/jacomyal/sigma.js/blob/master/plugins/sigma.layout.forceAtlas2/worker.js
.


Reply to this email directly or view it on GitHub
#314 (comment).

@apitts
Copy link
Contributor Author

apitts commented Jun 22, 2014

Potentially useful precedent here: https://github.com/adambom/parallel.js

@apitts
Copy link
Contributor Author

apitts commented Jun 22, 2014

@Yomguithereal I'm afraid I've had no luck trying to come up with a solution. Am new to webworkers and tried a few things but not exactly sure what to 'change around' in supervisor.js.

@Yomguithereal
Copy link
Collaborator

Hello @apitts

I therefore propose you two solutions:

  • You completely shunt the worker for IE and sigma will switch to the non-worker version (you won't have parallelization then and you should observe a perf drop).

On supervisor.js

// I let you find a test for IE
var webWorkers = !IE && 'Worker' in window;
  • You switch to a non-blob worker by including the worker.js file in your project and launching it thusly in your supervisor:
if (webWorkers) {
  // var blob = this.makeBlob(workerFn);

  // Write your own worker.js url here
  this.worker = new Worker('path/to/worker.js');

  // Post Message Polyfill
  this.worker.postMessage =
    this.worker.webkitPostMessage || this.worker.postMessage;
 }

@patrickmarabeas
Copy link
Contributor

1 - Breaks IE: Object doesn't support this action - Line: 602 of worker.js var e = new Event('newCoords');

2 - Breaks all browsers: Uncaught sigma is not declared
This is the code being used:

  if (webWorkers) {
        //var blob = this.makeBlob(workerFn);
        //this.worker = new Worker(URL.createObjectURL(blob));
        this.worker = new Worker('../plugins/sigma.layout.forceAtlas2/worker.js');

@apitts
Copy link
Contributor Author

apitts commented Jul 9, 2014

@Yomguithereal Would really appreciate any further thoughts you may have on this? Unfortunately Internet Explorer still has significant browser share and I haven't been able to find a solution to the webworkers issue so Force Atlas 2 is not currently working in IE.

@Yomguithereal
Copy link
Collaborator

Hello @apitts and @patrickmarabeas.

I have updated FA2 so it is possible: A) to disable the webworker and B) to specify a path from where to serve an external worker file (the worker file can be used separately now and won't break anymore normally).

However, I cannot test in IE for the time being so I would like to know if you could try something and tell me if it does or does not work:

Have the worker file and start FA2 with workerUrl option set to the path of your worker file.

<script src="sigma.layout.forceAtlas2/supervisor.js"></script>
s.startForceAtlas2({workerUrl: 'sigma.layout.forceAtlas2/worker.js'});

The non-worker version however should not run in IE because of the lack of custom events in this browser.

@apitts
Copy link
Contributor Author

apitts commented Jul 18, 2014

Thanks very much @Yomguithereal! I will test as soon as possible and get back to you.

@apitts
Copy link
Contributor Author

apitts commented Jul 20, 2014

@Yomguithereal I just tried it out. What I did was clone the current repo and in the force.html example file I just changed:

s.startForceAtlas2();

to

 s.startForceAtlas2({workerUrl: '../plugins/sigma.layout.forceAtlas2/worker.js'});

The script line is already included in the example.

I then tried the force.html example in a VM running Windows 7 and IE11. I'm afraid I get an error - DataCloneError at line 186 column 7 of supervisor.js. This line is:

this.worker.postMessage(content, buffers);

It would seem that the message postMessage is sending is unsupported by IE11: http://msdn.microsoft.com/en-us/library/ie/jj160614(v=vs.85).aspx

Let me know though if you want me to try anything else.

@apitts
Copy link
Contributor Author

apitts commented Jul 20, 2014

@deonclem
Copy link

Hello @apitts , I'm running into the same problem as you (first Security Error and now DataCloneError), have you managed to find a workaround ? This is really bugging me.

@apitts
Copy link
Contributor Author

apitts commented Aug 28, 2014

Unfortunately not @deonclem. It's a really important issue for me as well so if you have any insights, please do share them.

@deonclem
Copy link

@apitts

Ok I might have found something, it's pretty much a hack unfortunately. But I've managed to make it work on IE11 here.

Implying you've done all the above, you can change these lines :

if (this.shouldUseWorker)
  this.worker.postMessage(content, buffers);
else
  _root.postMessage(content, '*');

in the supervisor and

sendNewCoords = function() {
    self.postMessage({
        nodes: W.nodeMatrix.buffer,
        iterations: W.iterations
      },
      [W.nodeMatrix.buffer]
    );
  };

in the worker, into :

if (this.shouldUseWorker)
  this.worker.postMessage(content);
else
  _root.postMessage(content, '*');

and

sendNewCoords = function() {
    self.postMessage({
        nodes: W.nodeMatrix.buffer,
        iterations: W.iterations
      }
    );
  };

This worked for me, tell me if it does for you.

@apitts
Copy link
Contributor Author

apitts commented Sep 16, 2014

@deonclem thanks very much for the above! I have also made those changes to the code and can confirm that after the changes ForceAtlas2 is working in Internet Explorer (I have only tested with IE11 at this point).

Just a couple of thoughts - and these may be for @Yomguithereal.

  1. Do you think a pull request is appropriate? The way I have made the changes is to include this condition in both the worker.js and supervisor.js files:
this.isIE = navigator.userAgent.indexOf('MSIE') !== -1 || navigator.appVersion.indexOf('Trident/') > 0;

I think it's a bit of a hack / messy. But I'm no expert on webworkers and so am assuming that the buffers are there for a reason (perhaps to improve performance?) and so did not want to remove them for non-IE browsers.
2. Might be appropriate to edit the Force Atlas grunt file so that the build folder includes the separated worker.js file as well as the regular minified Force Atlas plugin? Otherwise I think we need to copy and paste the worker.js file into the folder after every build.

@jacomyal
Copy link
Owner

jacomyal commented Oct 9, 2014

Hi @apitts,

I just tried to reproduce the initial bug, and I had the SecurityError on my IE11 VM (I guess the same as yours).

But I also tried this same example, with the WebWorker enabled, on IE11 on Windows 7 and Windows 8.1, and it ran perfectly on both. There is an issue when I disable the WebWorker, due to the fact that IE11 does not support custom events, but it works at least with the WebWorker.

So, I am wondering if this SecurityError wouldn't be actually occuring only on Microsoft's IE11 VM. Does anyone still has this error today in "real-life" IE11?

@sheymann
Copy link
Contributor

@jacomyal yes I have this error running force.html on IE11.0.9600.17278 Windows 8, latest updates.

@stale
Copy link

stale bot commented Oct 9, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Oct 9, 2021
@stale stale bot closed this as completed Oct 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants