Skip to content

Commit 9453024

Browse files
authored
Merge pull request #813 from kit-ty-kate/ocaml-5.3
Add support for OCaml 5.3
2 parents 47a8715 + 913cbd4 commit 9453024

File tree

12 files changed

+70
-68
lines changed

12 files changed

+70
-68
lines changed

.github/workflows/workflow.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ jobs:
1818
- macos-latest
1919
- ubuntu-latest
2020
ocaml-compiler:
21-
- "4.14"
22-
- "5.2"
21+
- 5
22+
- 4
2323

2424
runs-on: ${{ matrix.os }}
2525

@@ -46,7 +46,7 @@ jobs:
4646
- name: Set-up OCaml
4747
uses: ocaml/setup-ocaml@v3
4848
with:
49-
ocaml-compiler: "4.14"
49+
ocaml-compiler: 4
5050
dune-cache: true
5151

5252
- uses: ocaml/setup-ocaml/lint-fmt@v3

dune-project

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,17 @@ The client-side code is compiled to JS using Ocsigen Js_of_ocaml or to Wasm usin
2222
(homepage https://ocsigen.org/eliom/)
2323
(source (github ocsigen/eliom))
2424
(depends
25-
(ocaml (and (>= 4.12) (< 5.3)))
25+
(ocaml (>= 4.12))
2626
ocamlfind
2727
ppx_deriving
2828
(ppxlib (>= 0.15))
29-
(js_of_ocaml-compiler (and (>= 5.5) (< 6.0)))
30-
(js_of_ocaml (>= 5.5))
31-
(js_of_ocaml-lwt (>= 5.5))
29+
(js_of_ocaml-compiler (>= 6.0))
30+
(js_of_ocaml (>= 6.0))
31+
(js_of_ocaml-lwt (>= 6.0))
3232
(js_of_ocaml-ocamlbuild :build)
33-
(js_of_ocaml-ppx (>= 5.5))
34-
(js_of_ocaml-ppx_deriving_json (>= 5.5))
35-
(js_of_ocaml-tyxml (>= 5.5))
33+
(js_of_ocaml-ppx (>= 6.0))
34+
(js_of_ocaml-ppx_deriving_json (>= 6.0))
35+
(js_of_ocaml-tyxml (>= 6.0))
3636
lwt_log
3737
(tyxml (and (>= 4.6) (< 4.7)))
3838
(ocsigenserver (and (>= 6.0) (< 7.0)))

eliom.opam

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,17 @@ homepage: "https://ocsigen.org/eliom/"
1818
bug-reports: "https://github.com/ocsigen/eliom/issues"
1919
depends: [
2020
"dune" {>= "3.18"}
21-
"ocaml" {>= "4.12" & < "5.3"}
21+
"ocaml" {>= "4.12"}
2222
"ocamlfind"
2323
"ppx_deriving"
2424
"ppxlib" {>= "0.15"}
25-
"js_of_ocaml-compiler" {>= "5.5" & < "6.0"}
26-
"js_of_ocaml" {>= "5.5"}
27-
"js_of_ocaml-lwt" {>= "5.5"}
25+
"js_of_ocaml-compiler" {>= "6.0"}
26+
"js_of_ocaml" {>= "6.0"}
27+
"js_of_ocaml-lwt" {>= "6.0"}
2828
"js_of_ocaml-ocamlbuild" {build}
29-
"js_of_ocaml-ppx" {>= "5.5"}
30-
"js_of_ocaml-ppx_deriving_json" {>= "5.5"}
31-
"js_of_ocaml-tyxml" {>= "5.5"}
29+
"js_of_ocaml-ppx" {>= "6.0"}
30+
"js_of_ocaml-ppx_deriving_json" {>= "6.0"}
31+
"js_of_ocaml-tyxml" {>= "6.0"}
3232
"lwt_log"
3333
"tyxml" {>= "4.6" & < "4.7"}
3434
"ocsigenserver" {>= "6.0" & < "7.0"}

src/lib/client/eliommod_dom.ml

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ let fast_select_request_nodes root =
104104

105105
let fast_select_nodes root =
106106
if !Eliom_config.debug_timings
107-
then Firebug.console ## (time (Js.string "fast_select_nodes"));
107+
then Console.console ## (time (Js.string "fast_select_nodes"));
108108
let a_nodeList : Dom_html.element Dom.nodeList Js.t =
109109
root
110110
## (querySelectorAll
@@ -137,7 +137,7 @@ let fast_select_nodes root =
137137
(Js.string ("." ^ Eliom_runtime.RawXML.ce_registered_attr_class)))
138138
in
139139
if !Eliom_config.debug_timings
140-
then Firebug.console ## (timeEnd (Js.string "fast_select_nodes"));
140+
then Console.console ## (timeEnd (Js.string "fast_select_nodes"));
141141
( a_nodeList
142142
, form_nodeList
143143
, process_node_nodeList
@@ -581,13 +581,13 @@ let rec rewrite_css ~max (media, href, css) =
581581
| None -> Lwt.return_nil
582582
| Some css ->
583583
if !Eliom_config.debug_timings
584-
then Firebug.console ## (time (Js.string ("rewrite_CSS: " ^ href)));
584+
then Console.console ## (time (Js.string ("rewrite_CSS: " ^ href)));
585585
let* imports, css =
586586
rewrite_css_import ~max ~prefix:(basedir href) ~media css 0
587587
in
588588
if !Eliom_config.debug_timings
589589
then
590-
Firebug.console ## (timeEnd (Js.string ("rewrite_CSS: " ^ href)));
590+
Console.console ## (timeEnd (Js.string ("rewrite_CSS: " ^ href)));
591591
Lwt.return (imports @ [media, css]))
592592
(fun _ -> Lwt.return [media, Printf.sprintf "@import url(%s);" href])
593593

@@ -663,7 +663,7 @@ let build_style (e, css) =
663663

664664
let preload_css (doc : Dom_html.element Js.t) =
665665
if !Eliom_config.debug_timings
666-
then Firebug.console ## (time (Js.string "preload_css (fetch+rewrite)"));
666+
then Console.console ## (time (Js.string "preload_css (fetch+rewrite)"));
667667
let* css = Lwt_list.map_p build_style (fetch_linked_css (get_head doc)) in
668668
let css = List.concat css in
669669
List.iter
@@ -675,7 +675,7 @@ let preload_css (doc : Dom_html.element Js.t) =
675675
Lwt_log.ign_info ~section "Unique CSS skipped...")
676676
css;
677677
if !Eliom_config.debug_timings
678-
then Firebug.console ## (timeEnd (Js.string "preload_css (fetch+rewrite)"));
678+
then Console.console ## (timeEnd (Js.string "preload_css (fetch+rewrite)"));
679679
Lwt.return_unit
680680

681681
(** Window scrolling *)
@@ -687,18 +687,18 @@ let preload_css (doc : Dom_html.element Js.t) =
687687
[@@@warning "-39"]
688688

689689
type position =
690-
{html_top : int; html_left : int; body_top : int; body_left : int}
690+
{html_top : float; html_left : float; body_top : float; body_left : float}
691691
[@@deriving json]
692692

693693
[@@@warning "+39"]
694694

695-
let top_position = {html_top = 0; html_left = 0; body_top = 0; body_left = 0}
695+
let top_position = {html_top = 0.; html_left = 0.; body_top = 0.; body_left = 0.}
696696

697697
let createDocumentScroll () =
698-
{ html_top = Dom_html.document##.documentElement##.scrollTop
699-
; html_left = Dom_html.document##.documentElement##.scrollLeft
700-
; body_top = Dom_html.document##.body##.scrollTop
701-
; body_left = Dom_html.document##.body##.scrollLeft }
698+
{ html_top = Js.to_float Dom_html.document##.documentElement##.scrollTop
699+
; html_left = Js.to_float Dom_html.document##.documentElement##.scrollLeft
700+
; body_top = Js.to_float Dom_html.document##.body##.scrollTop
701+
; body_left = Js.to_float Dom_html.document##.body##.scrollLeft }
702702

703703
(* With firefox, the scroll position is restored before to fire the
704704
popstate event. We maintain our own position. *)
@@ -719,10 +719,10 @@ let _ =
719719
let getDocumentScroll () = !current_position
720720

721721
let setDocumentScroll pos =
722-
Dom_html.document##.documentElement##.scrollTop := pos.html_top;
723-
Dom_html.document##.documentElement##.scrollLeft := pos.html_left;
724-
Dom_html.document##.body##.scrollTop := pos.body_top;
725-
Dom_html.document##.body##.scrollLeft := pos.body_left;
722+
Dom_html.document##.documentElement##.scrollTop := Js.float pos.html_top;
723+
Dom_html.document##.documentElement##.scrollLeft := Js.float pos.html_left;
724+
Dom_html.document##.body##.scrollTop := Js.float pos.body_top;
725+
Dom_html.document##.body##.scrollLeft := Js.float pos.body_left;
726726
current_position := pos
727727

728728
(* UGLY HACK for Opera bug: Opera seem does not always take into

src/lib/client/eliommod_dom.mli

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ val iter_attrList :
8686
(** Window scrolling. *)
8787

8888
type position =
89-
{html_top : int; html_left : int; body_top : int; body_left : int}
89+
{html_top : float; html_left : float; body_top : float; body_left : float}
9090
[@@deriving json]
9191

9292
val top_position : position

src/lib/eliom_client.client.ml

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ let check_global_data global_data =
107107
| [] -> ()
108108
| l ->
109109
Printf.ksprintf
110-
(fun s -> Firebug.console ## (error (Js.string s)))
110+
(fun s -> Console.console ## (error (Js.string s)))
111111
"Code generating the following client values is not linked on the client:\n%s"
112112
(String.concat "\n"
113113
(List.rev_map
@@ -128,7 +128,7 @@ let check_global_data global_data =
128128
| [] -> ()
129129
| l ->
130130
Printf.ksprintf
131-
(fun s -> Firebug.console ## (error (Js.string s)))
131+
(fun s -> Console.console ## (error (Js.string s)))
132132
"Code containing the following injections is not linked on the client:\n%s"
133133
(String.concat "\n"
134134
(List.rev_map
@@ -260,12 +260,12 @@ let relink_request_node (node : Dom_html.element Js.t) =
260260
let relink_request_nodes root =
261261
Lwt_log.ign_debug ~section "Relink request nodes";
262262
if !Eliom_config.debug_timings
263-
then Firebug.console ## (time (Js.string "relink_request_nodes"));
263+
then Console.console ## (time (Js.string "relink_request_nodes"));
264264
Eliommod_dom.iter_nodeList
265265
(Eliommod_dom.select_request_nodes root)
266266
relink_request_node;
267267
if !Eliom_config.debug_timings
268-
then Firebug.console ## (timeEnd (Js.string "relink_request_nodes"))
268+
then Console.console ## (timeEnd (Js.string "relink_request_nodes"))
269269

270270
(* Relinks a-elements, form-elements, and process nodes. The list of
271271
closure nodes is returned for application on [relink_closure_node]
@@ -405,12 +405,12 @@ let load_data_script page =
405405
in
406406
let script = data_script##.text in
407407
if !Eliom_config.debug_timings
408-
then Firebug.console ## (time (Js.string "load_data_script"));
408+
then Console.console ## (time (Js.string "load_data_script"));
409409
ignore (Js.Unsafe.eval_string (Js.to_string script));
410410
Eliom_process.reset_request_template ();
411411
Eliom_process.reset_request_cookies ();
412412
if !Eliom_config.debug_timings
413-
then Firebug.console ## (timeEnd (Js.string "load_data_script"))
413+
then Console.console ## (timeEnd (Js.string "load_data_script"))
414414

415415
(* == Scroll the current page such that the top of element with the id
416416
[fragment] is aligned with the window's top. If the optional
@@ -1004,7 +1004,7 @@ let init () =
10041004
Eliom_client_core.set_initial_load ();
10051005
Lwt.async (fun () ->
10061006
if !Eliom_config.debug_timings
1007-
then Firebug.console ## (time (Js.string "onload"));
1007+
then Console.console ## (time (Js.string "onload"));
10081008
let* () =
10091009
Eliom_request_info.set_session_info
10101010
~uri:
@@ -1043,7 +1043,7 @@ let init () =
10431043
Lwt_mutex.unlock Eliom_client_core.load_mutex;
10441044
run_callbacks load_callbacks;
10451045
if !Eliom_config.debug_timings
1046-
then Firebug.console ## (timeEnd (Js.string "onload"));
1046+
then Console.console ## (timeEnd (Js.string "onload"));
10471047
Lwt.return_unit);
10481048
Js._false
10491049
in
@@ -1459,7 +1459,7 @@ let set_uri ~replace ?fragment uri =
14591459

14601460
let replace_page ~do_insert_base new_page =
14611461
if !Eliom_config.debug_timings
1462-
then Firebug.console ## (time (Js.string "replace_page"));
1462+
then Console.console ## (time (Js.string "replace_page"));
14631463
if !only_replace_body
14641464
then
14651465
let new_body = new_page ##. childNodes ## (item 1) in
@@ -1475,7 +1475,7 @@ let replace_page ~do_insert_base new_page =
14751475
Dom.replaceChild Dom_html.document new_page
14761476
Dom_html.document##.documentElement);
14771477
if !Eliom_config.debug_timings
1478-
then Firebug.console ## (timeEnd (Js.string "replace_page"))
1478+
then Console.console ## (timeEnd (Js.string "replace_page"))
14791479

14801480
(* Function to be called for client side services: *)
14811481
let set_content_local ?offset ?fragment new_page =
@@ -1484,7 +1484,7 @@ let set_content_local ?offset ?fragment new_page =
14841484
let recover () =
14851485
if !locked then Lwt_mutex.unlock Eliom_client_core.load_mutex;
14861486
if !Eliom_config.debug_timings
1487-
then Firebug.console ## (timeEnd (Js.string "set_content_local"))
1487+
then Console.console ## (timeEnd (Js.string "set_content_local"))
14881488
and really_set () =
14891489
(* Inline CSS in the header to avoid the "flashing effect".
14901490
Otherwise, the browser start to display the page before
@@ -1510,7 +1510,7 @@ let set_content_local ?offset ?fragment new_page =
15101510
scroll_to_fragment ?offset fragment;
15111511
advance_page ();
15121512
if !Eliom_config.debug_timings
1513-
then Firebug.console ## (timeEnd (Js.string "set_content_local"));
1513+
then Console.console ## (timeEnd (Js.string "set_content_local"));
15141514
Lwt.return_unit
15151515
in
15161516
let cancel () = recover (); Lwt.return_unit in
@@ -1519,7 +1519,7 @@ let set_content_local ?offset ?fragment new_page =
15191519
let* () = Lwt_mutex.lock Eliom_client_core.load_mutex in
15201520
Eliom_client_core.set_loading_phase ();
15211521
if !Eliom_config.debug_timings
1522-
then Firebug.console ## (time (Js.string "set_content_local"));
1522+
then Console.console ## (time (Js.string "set_content_local"));
15231523
run_onunload_wrapper really_set cancel)
15241524
(fun exn ->
15251525
recover ();
@@ -1619,19 +1619,19 @@ let set_content ~replace ~uri ?offset ?fragment content =
16191619
scroll_to_fragment ?offset fragment;
16201620
advance_page ();
16211621
if !Eliom_config.debug_timings
1622-
then Firebug.console ## (timeEnd (Js.string "set_content"));
1622+
then Console.console ## (timeEnd (Js.string "set_content"));
16231623
Lwt.return_unit
16241624
and recover () =
16251625
if !locked then Lwt_mutex.unlock Eliom_client_core.load_mutex;
16261626
if !Eliom_config.debug_timings
1627-
then Firebug.console ## (timeEnd (Js.string "set_content"))
1627+
then Console.console ## (timeEnd (Js.string "set_content"))
16281628
in
16291629
Lwt.catch
16301630
(fun () ->
16311631
let* () = Lwt_mutex.lock Eliom_client_core.load_mutex in
16321632
Eliom_client_core.set_loading_phase ();
16331633
if !Eliom_config.debug_timings
1634-
then Firebug.console ## (time (Js.string "set_content"));
1634+
then Console.console ## (time (Js.string "set_content"));
16351635
let g () = recover (); Lwt.return_unit in
16361636
run_onunload_wrapper really_set g)
16371637
(fun exn ->

src/lib/eliom_content.client.mli

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -758,7 +758,7 @@ module Html : sig
758758
val minHeightPx : 'a elt -> int
759759
val minWidth : 'a elt -> string
760760
val minWidthPx : 'a elt -> int
761-
val opacity : 'a elt -> string option
761+
val opacity : 'a elt -> string
762762
val outline : 'a elt -> string
763763
val outlineColor : 'a elt -> string
764764
val outlineOffset : 'a elt -> string

src/lib/eliom_content_.client.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -963,7 +963,7 @@ module Html = struct
963963

964964
let opacity elt =
965965
let elt = get_unique_elt "Css.opacity" elt in
966-
Option.map Js.to_bytestring (Js.Optdef.to_option elt##.style##.opacity)
966+
Js.to_bytestring elt##.style##.opacity
967967

968968
let outline elt =
969969
let elt = get_unique_elt "Css.outline" elt in
@@ -1406,7 +1406,7 @@ module Html = struct
14061406

14071407
let opacity elt v =
14081408
let elt = get_unique_elt "SetCss.opacity" elt in
1409-
elt##.style##.opacity := Js.def (Js.bytestring v)
1409+
elt##.style##.opacity := Js.bytestring v
14101410

14111411
let outline elt v =
14121412
let elt = get_unique_elt "SetCss.outline" elt in

src/lib/eliom_lib.client.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ let _ =
9595
Lwt_log.default := Lwt_log.console;
9696
Lwt.async_exception_hook :=
9797
fun exn ->
98-
Firebug.console##error_3 (Js.string "Lwt.async:")
98+
Console.console##error_3 (Js.string "Lwt.async:")
9999
(Js.string (Printexc.to_string exn))
100100
exn
101101

src/lib/eliom_request.client.ml

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -222,18 +222,7 @@ let send ?with_credentials ?(expecting_process_page = false) ?cookies_info
222222
let headers =
223223
if expecting_process_page
224224
then
225-
let content_type =
226-
if Dom_html.onIE
227-
&& not
228-
(Js.Optdef.test
229-
(Js.Unsafe.coerce Dom_html.document)##.adoptNode)
230-
then
231-
(* ie < 9 does not know xhtml+xml content type, but ie 9
232-
can use it and need it to use adoptNode *)
233-
"application/xml"
234-
else "application/xhtml+xml"
235-
in
236-
("Accept", content_type)
225+
("Accept", "application/xhtml+xml")
237226
:: ( Eliom_common.expecting_process_page_name
238227
, encode_header_value ~typ:[%json: bool] true )
239228
:: headers

0 commit comments

Comments
 (0)