Uploaded image for project: 'Fluid Infusion'
  1. Fluid Infusion
  2. FLUID-5711

The Infusion core framework doesn't work when run in a Web Worker

    XMLWordPrintable

Details

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • 1.9, 2.0
    • 1.5
    • Framework
    • None
    • All browsers

    Description

      Currently, the core "standalone" Infusion framework can't be run in a Web Worker. This is due to the fact that we've still got a few stray references to the the global "window" variable in the code. In a Worker, there is no window, but the "self" variable is the equivalent global (with some of same functions available).

      My worker includes the following portions of the Infusion core framework:

      • jquery.standalone.js
      • Fluid.js
      • DataBinding.js
      • FluidDebugging.js
      • FluidIoC.js

      Here's a list of the references to "window" that cause failures in a Worker:

      https://github.com/fluid-project/infusion/blob/master/src/framework/core/js/Fluid.js#L45
      https://github.com/fluid-project/infusion/blob/master/src/framework/core/js/jquery.standalone.js#L34-L36

      I also noticed that this function will pass in a Worker when its argument is "self" (which is probably a good thing):

      https://github.com/fluid-project/infusion/blob/master/src/framework/core/js/jquery.standalone.js#L71-L73

      I was able to quickly hack up a fix for this issue while testing. For reference, here's the diff:

      https://gist.github.com/colinbdclark/3fbfa7e82b85cb9915fa

      This, of course, still needs to be worked up into a viable pull request.

      Attachments

        Activity

          People

            Unassigned Unassigned
            colin Colin Clark
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: