mirror of
https://github.com/netsurf-browser/netsurf
synced 2024-12-22 20:16:54 +03:00
add jsstring to jsval conversion macro that copes with null jsstrings
This commit is contained in:
parent
e0f17a8d35
commit
85c973f986
@ -94,6 +94,8 @@ JS_NewCompartmentAndGlobalObject(JSContext *cx,
|
||||
outchar = JS_GetStringBytes(injsstring); \
|
||||
outlen = strlen(outchar)
|
||||
|
||||
/* string type cast */
|
||||
#define JSAPI_STRING_TO_JSVAL(str) ((str == NULL)?JSVAL_NULL:STRING_TO_JSVAL(str))
|
||||
|
||||
#else /* #if JS_VERSION <= 180 */
|
||||
|
||||
@ -152,6 +154,8 @@ JS_NewCompartmentAndGlobalObject(JSContext *cx,
|
||||
JS_EncodeStringToBuffer(injsstring, outchar, outlen); \
|
||||
outchar[outlen] = '\0'
|
||||
|
||||
/* string type cast */
|
||||
#define JSAPI_STRING_TO_JSVAL(str) ((str == NULL)?JSVAL_NULL:STRING_TO_JSVAL(str))
|
||||
|
||||
#endif
|
||||
|
||||
|
13
test/js/dom-location.html
Normal file
13
test/js/dom-location.html
Normal file
@ -0,0 +1,13 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Assign window.lately</title>
|
||||
<link rel="stylesheet" type="text/css" href="tst.css">
|
||||
</head>
|
||||
<body>
|
||||
<h1>Assign window.lately</h1>
|
||||
<p>location: <script>document.write(location);</script>
|
||||
<p>location.protocol: <script>document.write(location.protocol);</script>
|
||||
<p>equivalence <script>document.write(location.protocol === 'http:');</script>
|
||||
<p>assignement<script>window.lately = (location.protocol === 'http:');</script>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue
Block a user