ClojureScript

Documentation says CLJS can open connections to the REPL server from a "file://" source, and you can't

Details

  • Type: Defect Defect
  • Status: Closed Closed
  • Priority: Trivial Trivial
  • Resolution: Completed
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: None
  • Environment:
    ClojureScript 0.0-1450

Description

At https://github.com/clojure/clojurescript/wiki/The-REPL-and-Evaluation-Environments there is the following paragraph:

"This is a problem for the browser-connected REPL because FireFox and Chrome both view opening a file from the file system and connecting to localhost:9000 as different domains.
(...)
Fortunately, Google has also run into this problem and has created something called a CrossPageChannel. Without going into the details, this allows an iframe served from one domain (the REPL) to communicate with the parent page which was served from another domain (the application server)."

From what I tested, you CANT connect to the REPL server at "http://localhost:9000/repl" if you initially loaded the page using the "file://" protocol. But you can if you loaded it from the same hostname on another port using "http://". The documentation is wrong, and also it needs to be clarified on what you really can change from the initial domain, like the port, without broking the REPL connection (or link to a CrossPageChannel documentation page with the details on what same-origin policy checks it can overcome).

Activity

Hide
David Nolen added a comment -

Are you unable to edit the wiki?

Show
David Nolen added a comment - Are you unable to edit the wiki?
Hide
Nahuel Greco added a comment -

I didn't know the wiki had public write permissions. Also I don't know the exact CrossPageChannel limitations.

Show
Nahuel Greco added a comment - I didn't know the wiki had public write permissions. Also I don't know the exact CrossPageChannel limitations.
Hide
David Nolen added a comment - - edited

The limitation is that it won't work with file://. We now provide a simple webserver that will serve the files present in the directory where you started browser REPL. If you goto http://localhost:9000/ we will serve index.html if it is present.

Show
David Nolen added a comment - - edited The limitation is that it won't work with file://. We now provide a simple webserver that will serve the files present in the directory where you started browser REPL. If you goto http://localhost:9000/ we will serve index.html if it is present.
Hide
Nahuel Greco added a comment -

So CrossPageChannel overcomes the "same origin policy" for different ports, but not for different protocols. Thanks for the clarification.

Show
Nahuel Greco added a comment - So CrossPageChannel overcomes the "same origin policy" for different ports, but not for different protocols. Thanks for the clarification.
Hide
David Nolen added a comment -

No problem, closing this one.

Show
David Nolen added a comment - No problem, closing this one.

People

Vote (0)
Watch (2)

Dates

  • Created:
    Updated:
    Resolved: