<< Back to previous view

[CLJS-1206] Images in HTML don't show up when served from localhost:9000 Created: 15/Apr/15  Updated: 20/May/15  Resolved: 20/May/15

Status: Closed
Project: ClojureScript
Component/s: None
Affects Version/s: 0.0-3196
Fix Version/s: None

Type: Defect Priority: Minor
Reporter: J David Eisenberg Assignee: Unassigned
Resolution: Completed Votes: 0
Labels: brepl, bug
Environment:

Fedora core 21, java version "1.8.0_40" Java(TM) SE Runtime Environment (build 1.8.0_40-b26) Java HotSpot(TM) 64-Bit Server VM (build 25.40-b25, mixed mode)


Attachments: Text File cljs_1206.patch     Text File cljs_1206_v2.patch     File imgtest_files.tgz    
Patch: Code

 Description   

In a project built from latest version of mies (from github), put an img element in the index.html page. When running scripts/brepl and loading http://localhost:9000, the image does not appear and the console gives a 404 error (see screenshot in attached tarball). The image shows up fine when loading the index.html as a plain file:/// in the browser, so the image definitely does exist in the correct directory.

I think the problem is in file src/clj/cljs/repl/browser.clj, the code starting server/dispatch-on; it lacks options for paths ending in .jpg and .png

I've included a diff -u file in the tarball as well with a possible patch. The patch also adds .svg as a valid type of file to serve, which was the particular thing I needed when I first saw this problem.



 Comments   
Comment by David Nolen [ 15/Apr/15 8:47 AM ]

Please attach patches directly, thanks!

Comment by J David Eisenberg [ 15/Apr/15 10:12 AM ]

Not sure what the format for a patch is, nor where it should be attached. (Add another attachment with the diff file?) Also, I think I see why the image doesn't appear -somewhere in the input or output process, the binary data is being converted to UTF-8.

Comment by Francis Avila [ 15/Apr/15 10:47 AM ]

Patch instructions. Add patch file as independent attachment to this ticket.

Before your code can be accepted you must sign a contributor's agreement.

Comment by J David Eisenberg [ 15/Apr/15 7:04 PM ]

Patch that allows server to correctly serve PNG, JPG, and SVG files. Patch uses maps to store data about MIME types and encoding, so other file extensions and types can be added easily if necessary.

Comment by Sander Dijkhuis [ 05/May/15 1:50 AM ]

Related / same issue:
http://dev.clojure.org/jira/browse/CLJS-1124

Comment by David Nolen [ 14/May/15 9:35 PM ]

fixed https://github.com/clojure/clojurescript/commit/ed5a2c928c1bcde624dbe671140e9516de54dd24

Comment by kovas boguta [ 20/May/15 2:50 PM ]

New patch.

Comment by David Nolen [ 20/May/15 3:01 PM ]

fixed https://github.com/clojure/clojurescript/commit/fee5527284c9803f2865c1c428bbd5055b52af97

Comment by J David Eisenberg [ 20/May/15 3:47 PM ]

Why no love for SVG? It's part of HTML5, and is used to a fair extent in the "real world."

Comment by David Nolen [ 20/May/15 4:24 PM ]

We just have to draw the line somewhere. browser REPL is not a replacement for a real web server.





[CLJS-1279] Node.js REPL does not flush process out and err immediately Created: 20/May/15  Updated: 20/May/15  Resolved: 20/May/15

Status: Closed
Project: ClojureScript
Component/s: None
Affects Version/s: 0.0-3269
Fix Version/s: Next

Type: Defect Priority: Major
Reporter: David Nolen Assignee: Unassigned
Resolution: Completed Votes: 0
Labels: None


 Comments   
Comment by David Nolen [ 20/May/15 2:49 PM ]

fixed https://github.com/clojure/clojurescript/commit/03529c47f9c38f3923a827166699f511f5ec0356





[CLJS-1262] Write to compiler out before :merge-opts Created: 10/May/15  Updated: 19/May/15  Resolved: 19/May/15

Status: Closed
Project: ClojureScript
Component/s: None
Affects Version/s: 0.0-3255
Fix Version/s: None

Type: Defect Priority: Minor
Reporter: Mike Fikes Assignee: Unassigned
Resolution: Completed Votes: 0
Labels: None


 Description   

cljs.repl/repl* supports a :merge-opts, allowing derived REPLs, for example to specify :output-dir as a result of -setup.

A recent change in with_core_cljs appears to cause output to be (prematurely) written to the default :output-dir of "out": The call to -setup is wrapped with this macro.

This did not appear to occur with previous releases (I checked the last release of ClojureScript that was still on Clojure 1.6.0, but I haven't bisected to pinpoint the change.)

I haven't yet produced a minimal reproduction. (I will try to do so with QuickStart and add a comment).

I produced this with Ambly by manually creating an empty "out", and chmod a-w on it so that it can't be written in, and then when starting Ambly, I get a trace provoking the problem, showing where the write occurs:

$ script/repl
Exception in thread "main" java.io.FileNotFoundException: out/cljs/core.cljs.cache.edn (No such file or directory), compiling:(/private/var/folders/pd/w1724j050nd445hpm7mwlxs80000gn/T/form-init5299557692903408511.clj:1:125)
	at clojure.lang.Compiler.load(Compiler.java:7249)
	at clojure.lang.Compiler.loadFile(Compiler.java:7175)
	at clojure.main$load_script.invoke(main.clj:275)
	at clojure.main$init_opt.invoke(main.clj:280)
	at clojure.main$initialize.invoke(main.clj:308)
	at clojure.main$null_opt.invoke(main.clj:343)
	at clojure.main$main.doInvoke(main.clj:421)
	at clojure.lang.RestFn.invoke(RestFn.java:421)
	at clojure.lang.Var.invoke(Var.java:383)
	at clojure.lang.AFn.applyToHelper(AFn.java:156)
	at clojure.lang.Var.applyTo(Var.java:700)
	at clojure.main.main(main.java:37)
Caused by: java.io.FileNotFoundException: out/cljs/core.cljs.cache.edn (No such file or directory)
	at java.io.FileOutputStream.open0(Native Method)
	at java.io.FileOutputStream.open(FileOutputStream.java:270)
	at java.io.FileOutputStream.<init>(FileOutputStream.java:213)
	at clojure.java.io$fn__9185.invoke(io.clj:230)
	at clojure.java.io$fn__9122$G__9091__9129.invoke(io.clj:69)
	at clojure.java.io$fn__9159.invoke(io.clj:166)
	at clojure.java.io$fn__9135$G__9087__9142.invoke(io.clj:69)
	at clojure.java.io$writer.doInvoke(io.clj:119)
	at clojure.lang.RestFn.invoke(RestFn.java:410)
	at clojure.lang.AFn.applyToHelper(AFn.java:154)
	at clojure.lang.RestFn.applyTo(RestFn.java:132)
	at clojure.core$apply.invoke(core.clj:630)
	at clojure.core$spit.doInvoke(core.clj:6662)
	at clojure.lang.RestFn.invoke(RestFn.java:425)
	at cljs.analyzer$write_analysis_cache.invoke(analyzer.cljc:2186)
	at cljs.analyzer$analyze_file.invoke(analyzer.cljc:2237)
	at cljs.compiler$with_core_cljs.invoke(compiler.cljc:967)
	at cljs.repl$repl_STAR_.invoke(repl.cljc:779)
	at cljs.repl$repl.doInvoke(repl.cljc:929)
	at clojure.lang.RestFn.invoke(RestFn.java:410)
	at user$eval4493.invoke(form-init5299557692903408511.clj:3)
	at clojure.lang.Compiler.eval(Compiler.java:6792)
	at clojure.lang.Compiler.eval(Compiler.java:6755)
	at clojure.core$eval.invoke(core.clj:3079)
	at clojure.main$eval_opt.invoke(main.clj:289)
	at clojure.main$initialize.invoke(main.clj:308)
	at clojure.main$null_opt.invoke(main.clj:343)
	at clojure.main$main.doInvoke(main.clj:421)
	at clojure.lang.RestFn.invoke(RestFn.java:421)
	at clojure.lang.Var.invoke(Var.java:383)
	at clojure.lang.AFn.applyToHelper(AFn.java:156)
	at clojure.lang.Var.applyTo(Var.java:700)
	at clojure.main.main(main.java:37)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:497)
	at clojure.lang.Reflector.invokeMatchingMethod(Reflector.java:93)
	at clojure.lang.Reflector.invokeStaticMethod(Reflector.java:207)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:497)
	at clojure.lang.Reflector.invokeMatchingMethod(Reflector.java:93)
	at clojure.lang.Reflector.invokeStaticMethod(Reflector.java:207)
	at user$eval5.invoke(form-init5299557692903408511.clj:1)
	at clojure.lang.Compiler.eval(Compiler.java:6792)
	at clojure.lang.Compiler.eval(Compiler.java:6782)
	at clojure.lang.Compiler.load(Compiler.java:7237)
	... 11 more


 Comments   
Comment by Mike Fikes [ 10/May/15 9:54 AM ]

Reproduction with lein:

project.clj:

(defproject foo "0.1.0"
  :dependencies [[org.clojure/clojure "1.7.0-beta2"]
                 [org.clojure/clojurescript "0.0-3255"]])

Make out not writable. (chmod a-w out). Or, alternatively, just look for the presence of out on filesystem alongside abc.

In any case, if you don't make out not writable, then this minimal repo will subsequently fail with an unrelated java.lang.IllegalArgumentException: No matching clause: as it is simply trying to exhibit the problem with out.

lein repl

Then execute these forms:

(require 'cljs.repl)

(defrecord FooEnv []
    cljs.repl/IJavaScriptEnv
  (-setup [repl-env opts]
    {:merge-opts {:output-dir "abc"}})
  (-evaluate [_ _ _ _])
  (-load [_ _ _])
  (-tear-down [_]))

(defn repl-env 
  [& {:as options}]
  (FooEnv.))

(cljs.repl/repl (repl-env))

With this older version, the out directory is not created:

(defproject foo "0.1.0"
  :dependencies [[org.clojure/clojure "1.7.0-beta1"]
                 [org.clojure/clojurescript "0.0-3196"]])
Comment by David Nolen [ 10/May/15 10:17 AM ]

Right the problem is that with-core-cljs calls analyze-file which will attempt to write the analysis cache. It's just a matter of considering the best way to avoid this.

Comment by Mike Fikes [ 18/May/15 9:27 PM ]

No longer occurs with 0.0-3269 and was fixed with this commit: https://github.com/clojure/clojurescript/commit/07bb585b181c02b3c33c7d88c46ddb888279b07f





[CLJS-1229] Simplify Closure CommonJS & ES 2015 Module support Created: 30/Apr/15  Updated: 18/May/15  Resolved: 18/May/15

Status: Closed
Project: ClojureScript
Component/s: None
Affects Version/s: None
Fix Version/s: GSoC

Type: Task Priority: Major
Reporter: David Nolen Assignee: Maria Neise
Resolution: Completed Votes: 1
Labels: None


 Description   

Google Closure Compiler's ProcessCommonJSModules constructors are currently private. ES6ModuleLoader is a package private class with private constructors. All of these things must be made public if we are going to use them as individual passes on files. The current state of this functionality in Closure Compiler assumes being driven from the command line to produce a final build. In our case we want to use them as part of incremental compilation.



 Comments   
Comment by Maria Neise [ 18/May/15 2:44 PM ]

This has been fixed with https://github.com/google/closure-compiler/pull/952. In addition to making ProcessCommonJSModules and ES6ModuleLoader public, we also made ProcessEs6Modules public.





[CLJS-1275] lein test configuration is broken Created: 18/May/15  Updated: 18/May/15  Resolved: 18/May/15

Status: Closed
Project: ClojureScript
Component/s: None
Affects Version/s: 0.0-3269
Fix Version/s: None

Type: Defect Priority: Major
Reporter: Sebastian Bensusan Assignee: Unassigned
Resolution: Completed Votes: 0
Labels: None

Attachments: Text File cljs_1275.patch    

 Description   

When running lein test on a fresh copy of master it fails to find the tests. The :test-paths in project.clj is pointing to an old location.



 Comments   
Comment by Sebastian Bensusan [ 18/May/15 7:35 AM ]

This patch redirects :test-paths to the current directory of the tests: src/test/clojure.

Comment by David Nolen [ 18/May/15 8:39 AM ]

fixed https://github.com/clojure/clojurescript/commit/08398b25400b363ca22db885b7ed2460c92bd5fa





[CLJS-1273] clojure.lang.Symbol cannot be cast to clojure.lang.Namespace on macro expansion Created: 17/May/15  Updated: 17/May/15  Resolved: 17/May/15

Status: Closed
Project: ClojureScript
Component/s: None
Affects Version/s: 0.0-3211
Fix Version/s: None

Type: Defect Priority: Major
Reporter: lvh Assignee: Unassigned
Resolution: Not Reproducible Votes: 0
Labels: None


 Description   

Following macro & macro call:

{{
(defmacro defroutes
[routes]
(let [route-defs (for [{:keys [path view]} routes]
`(secretary/defroute ~path []
(session/put! :current-page ~view)))]
`(do (def ~'routes ~routes) ~@route-defs)))

(defroutes
[{:name "Home"
:path "/"
:view #'home-page}
{:name "Foo bar"
:path "/foo-bar"
:view #'foo-bar-page}
{:name "Baz quux"
:path "/baz-quux"
:view #'baz-quux-page}])
}}

... results in following compile-time exception:

{{
clojure.lang.ExceptionInfo : failed compiling file:src/cljs/shrieker/core.cljs
clojure.lang.ExceptionInfo : clojure.lang.Symbol cannot be cast to clojure.lang.Namespace
java.lang.ClassCastException : clojure.lang.Symbol cannot be cast to clojure.lang.Namespace
Error on file /Users/lvh/Projects/rackspace/shrieker/src/cljs/shrieker/core.cljs, line 106, column 60
}}

I believe this to be a bug, because replacing that macro call with its expansion works fine:

{{
(do
(def routes
[{:name "Home"
:path "/"
:view #'home-page}
{:name "Foo bar"
:path "/foo-bar"
:view #'foo-bar-page}
{:name "baz quux"
:path "/baz-quux"
:view #'baz-quux-page}])
(secretary/defroute "/" []
(session/put! :current-page #'home-page))
(secretary/defroute "/foo-bar" []
(session/put! :current-page #'foo-bar-page))
(secretary/defroute "/endpoint-quux" []
(session/put! :current-page #'baz-quux-page)))
}}

I was unable to repeat the experiment on more recent Clojurescripts, as some of my dependencies don't quite agree with it.



 Comments   
Comment by lvh [ 17/May/15 7:14 PM ]

JIRA doesn't appear to like my markup. Sorry about that

Comment by David Nolen [ 17/May/15 10:59 PM ]

You need to verify that this affects a released version of ClojureScript in a reproducible way (minimal case). Thanks.





[CLJS-1272] :include-macros description inaccurate in require Created: 17/May/15  Updated: 17/May/15  Resolved: 17/May/15

Status: Closed
Project: ClojureScript
Component/s: None
Affects Version/s: 0.0-3269
Fix Version/s: None

Type: Defect Priority: Minor
Reporter: Mike Fikes Assignee: Unassigned
Resolution: Completed Votes: 0
Labels: docstring

Attachments: Text File CLJS-1272.patch    

 Description   

The description for :include-macros in the docstring for require indicates

:include-macros takes a list of macro symbols to refer from the namespace.

when really the spec only takes true as an argument, where the semantics are "causes macros to be required"



 Comments   
Comment by David Nolen [ 17/May/15 6:46 PM ]

fixed https://github.com/clojure/clojurescript/commit/721ba892892d7aa000460c45a6eb1afecd33eff5





[CLJS-1270] Docstring for delay not printed by cljs.repl/doc Created: 16/May/15  Updated: 17/May/15  Resolved: 17/May/15

Status: Closed
Project: ClojureScript
Component/s: None
Affects Version/s: 0.0-3269
Fix Version/s: None

Type: Defect Priority: Minor
Reporter: Mike Fikes Assignee: Unassigned
Resolution: Completed Votes: 0
Labels: None

Attachments: Text File CLJS-1270.patch    

 Description   
cljs.user=> (doc delay)
-------------------------
cljs.core/delay
([& body])
Macro
  nil

nil
cljs.user=> (source delay)
(defmacro delay [& body]
  "Takes a body of expressions and yields a Delay object that will
  invoke the body only the first time it is forced (with force or deref/@), and
  will cache the result and return it on all subsequent force
  calls."
  `(new cljs.core/Delay (fn [] ~@body) nil))
nil


 Comments   
Comment by Mike Fikes [ 16/May/15 8:12 PM ]

Attached CLJS-1270.patch

Comment by David Nolen [ 17/May/15 10:28 AM ]

fixed https://github.com/clojure/clojurescript/commit/264eb2b5153d6d1c3b6fcf0a42aad31956297cc5





[CLJS-1269] realized? docstring refers to promise and future Created: 16/May/15  Updated: 17/May/15  Resolved: 17/May/15

Status: Closed
Project: ClojureScript
Component/s: None
Affects Version/s: 0.0-3269
Fix Version/s: None

Type: Defect Priority: Trivial
Reporter: Mike Fikes Assignee: Unassigned
Resolution: Completed Votes: 0
Labels: docstring

Attachments: Text File CLJS-1269.patch    

 Description   

The docstring for realized? refers to nonexistent promise and future.

Likely copied over verbatim from Clojure:

cljs.user=> (doc realized?)
-------------------------
cljs.core/realized?
([d])
  Returns true if a value has been produced for a promise, delay, future or lazy sequence.

nil


 Comments   
Comment by Mike Fikes [ 16/May/15 7:57 PM ]

Added CLJS-1269.patch

Comment by David Nolen [ 17/May/15 10:27 AM ]

fixed https://github.com/clojure/clojurescript/commit/27ad78bb3f7fdfe64b4041bf60532489c2847105





Generated at Fri May 22 17:28:35 CDT 2015 using JIRA 4.4#649-r158309.