Skip to content

Conversation

@bypie5
Copy link

@bypie5 bypie5 commented Jan 29, 2024

Addresses an issue brought up here #150 and here #303. To summarize, those issues both mention that Blink was not defined when using loadurl.

This PR addresses the issue by loading blink.js and webio.bundle.js whenever content is loaded using a custom URL. This was achieved by passing the URL of the websocket server to createWindow in main.js. This allowed the required JS files to be loaded whenever the Electron BrowserWindow does a navigation (i.e. when Julia calls loadurl or creates a window with :url defined).

Also, this PR fixes a warning that would fire every time the WebSocket would reconnect or whenever blink.js was reloaded. The warning was being fired from here:

// server.jl
function ws_handler(ws)
  id = try parse(Int, split(ws.request.target, "/", keepempty=false)[end]) catch e @goto fail end
  haskey(pool, id) || @goto fail
  p = pool[id].value
  active(p) && @goto fail

  p.sock = ws
  @async @errs get(handlers(p), "init", identity)(p)
  try
    put!(p.cb, true) # HERE (Warning: ErrorException("internal consistency error detected for Future"))
  catch e
    @warn e
  end

Finally, I saw this #TODO in src/AtomShell/window.jl that might be relevant to these changes:
Screenshot 2024-01-28 at 11 42 21 PM

Is there any way I can address that #TODO in this PR?

Addresses an issue brought up here: JuliaGizmos#150

This MR addresses the lissue by loading `blink.js` and `webio.bundle.js` whenever content is loaded using a custom URL. This was achieved by passing the URL of the websocket server to `createWindow` in main.js. This allowed the required JS files to be loaded whenever the Electron BrowserWindow does a navigation (i.e. when Julia calls `loadurl` or creates a window with :url defined).
Explaining code in did-finish-load handler and in initwindowUrl
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant