Merge branch 'master' of git://git.netsurf-browser.org/netsurf

This commit is contained in:
Ole Loots 2012-07-09 20:16:27 +02:00
commit 0107dba80d
10 changed files with 670 additions and 630 deletions

View File

@ -26,7 +26,7 @@ ifeq ($(HOST),amiga)
$(eval $(call feature_enabled,WEBP,-DWITH_WEBP,-lwebp,WebP (libwebp))) $(eval $(call feature_enabled,WEBP,-DWITH_WEBP,-lwebp,WebP (libwebp)))
$(eval $(call feature_enabled,VIDEO,-DWITH_VIDEO -I /SDK/local/newlib/include/glib-2.0,-lgstreamer-0.10 -lglib-2.0 -lgobject-2.0 -lgmodule-2.0 -lgthread-2.0 -lintl -lffi,Video (libgstreamer))) $(eval $(call feature_enabled,VIDEO,-DWITH_VIDEO -I /SDK/local/newlib/include/glib-2.0,-lgstreamer-0.10 -lglib-2.0 -lgobject-2.0 -lgmodule-2.0 -lgthread-2.0 -lintl -lffi,Video (libgstreamer)))
$(eval $(call feature_enabled,JS,-DXP_UNIX -DWITH_JS -DJS_VERSION=185,-lstdc++ -lmozjs185,JavaScript)) $(eval $(call feature_enabled,JS,-DXP_UNIX -DWITH_JS -DJS_VERSION=185,-lstdc++ -lmozjs185,JavaScript))
$(eval $(call feature_enabled,MOZJS,-DXP_AMIGA -DWITH_MOZJS -DJS_VERSION=150 -DJSVERSION_LATEST=150 -DJSOPTION_JIT=0 -DJSCLASS_GLOBAL_FLAGS=0,-ljs_150 -lfdlibm,JavaScript)) $(eval $(call feature_enabled,MOZJS,-DXP_AMIGA -DWITH_MOZJS -DJS_VERSION=170 -DJSVERSION_LATEST=170 -DJSOPTION_JIT=0 -DJSCLASS_GLOBAL_FLAGS=0,-ljs -lfdlibm,JavaScript))
$(eval $(call feature_enabled,AMIGA_ICON,-DWITH_AMIGA_ICON,,Amiga icon)) $(eval $(call feature_enabled,AMIGA_ICON,-DWITH_AMIGA_ICON,,Amiga icon))
$(eval $(call feature_enabled,AMIGA_DATATYPES,-DWITH_AMIGA_DATATYPES,,DataTypes)) $(eval $(call feature_enabled,AMIGA_DATATYPES,-DWITH_AMIGA_DATATYPES,,DataTypes))

View File

@ -1400,7 +1400,9 @@ nserror browser_window_callback(hlcache_handle *c,
* window requires a new global compartment object * window requires a new global compartment object
*/ */
assert(bw->loading_content == c); assert(bw->loading_content == c);
if (js_newcompartment(bw->jsctx, bw, c) != NULL) { if (js_newcompartment(bw->jsctx,
bw,
hlcache_handle_get_content(c)) != NULL) {
*(event->data.jscontext) = bw->jsctx; *(event->data.jscontext) = bw->jsctx;
} }
break; break;

View File

@ -133,7 +133,7 @@ bool js_exec(jscontext *ctx, const char *txt, size_t txtlen)
{ {
JSContext *cx = (JSContext *)ctx; JSContext *cx = (JSContext *)ctx;
//LOG(("%p \"%s\"",cx ,txt)); /* LOG(("%p \"%s\"",cx ,txt)); */
if (ctx == NULL) { if (ctx == NULL) {
return false; return false;

View File

@ -86,8 +86,8 @@ JS_NewCompartmentAndGlobalObject(JSContext *cx,
#define JS_StrictPropertyStub JS_PropertyStub #define JS_StrictPropertyStub JS_PropertyStub
#define JSString_to_char(injsstring, outchar, outlen) \ #define JSString_to_char(injsstring, outchar, outlen) \
txt = JS_GetStringBytes(u16_txt); \ outchar = JS_GetStringBytes(injsstring); \
outlen = strlen(txt) outlen = strlen(outchar)
#else /* #if JS_VERSION <= 180 */ #else /* #if JS_VERSION <= 180 */

View File

@ -16,14 +16,14 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <dom/dom.h>
#include "javascript/jsapi.h" #include "javascript/jsapi.h"
#include "utils/config.h"
#include "render/html_internal.h"
#include "utils/log.h" #include "utils/log.h"
static JSFunctionSpec jsfunctions_document[] = {
JS_FS_END
};
static JSClass jsclass_document = static JSClass jsclass_document =
{ {
"document", "document",
@ -40,6 +40,39 @@ static JSClass jsclass_document =
}; };
static JSBool JSAPI_NATIVE(write, JSContext *cx, uintN argc, jsval *vp)
{
JSString* u16_txt;
char *txt;
unsigned long length;
struct html_content *htmlc;
htmlc = JS_GetInstancePrivate(cx, JS_THIS_OBJECT(cx,vp), &jsclass_document, NULL);
if (htmlc == NULL)
return JS_FALSE;
if (!JS_ConvertArguments(cx, argc, JSAPI_ARGV(cx, vp), "S", &u16_txt))
return JS_FALSE;
JSString_to_char(u16_txt, txt, length);
LOG(("content %p parser %p writing %s",htmlc, htmlc->parser_binding, txt));
if (htmlc->parser_binding != NULL) {
dom_hubbub_parser_insert_chunk(htmlc->parser_binding, (uint8_t *)txt, length);
}
JSAPI_SET_RVAL(cx, vp, JSVAL_VOID);
return JS_TRUE;
}
static JSFunctionSpec jsfunctions_document[] = {
JSAPI_FS(write, 1, 0),
JSAPI_FS_END
};
JSObject *jsapi_new_document(JSContext *cx, JSObject *parent, void *doc_priv) JSObject *jsapi_new_document(JSContext *cx, JSObject *parent, void *doc_priv)
{ {
JSObject *doc; JSObject *doc;
@ -56,6 +89,8 @@ JSObject *jsapi_new_document(JSContext *cx, JSObject *parent, void *doc_priv)
if (doc == NULL) { if (doc == NULL) {
return NULL; return NULL;
} }
LOG(("setting content to %p",doc_priv));
/* private pointer to browsing context */ /* private pointer to browsing context */
if (!JS_SetPrivate(cx, doc, doc_priv)) if (!JS_SetPrivate(cx, doc, doc_priv))
return NULL; return NULL;

File diff suppressed because it is too large Load Diff

View File

@ -24,11 +24,11 @@
#include "utils/log.h" #include "utils/log.h"
binding_error binding_create_tree(void *arena, const char *charset, void **ctx) binding_error binding_create_tree(void **ctx, const char *charset, bool enable_script, dom_script script, void *context)
{ {
dom_hubbub_parser *parser = NULL; dom_hubbub_parser *parser = NULL;
parser = dom_hubbub_parser_create(charset, true, NULL, NULL); parser = dom_hubbub_parser_create(charset, true, enable_script, NULL, script, context);
if (parser == NULL) { if (parser == NULL) {
LOG(("Can't create Hubbub Parser\n")); LOG(("Can't create Hubbub Parser\n"));
return BINDING_NOMEM; return BINDING_NOMEM;

View File

@ -20,6 +20,7 @@
#define _NETSURF_RENDER_PARSER_BINDING_H_ #define _NETSURF_RENDER_PARSER_BINDING_H_
#include <dom/dom.h> #include <dom/dom.h>
#include <dom/bindings/hubbub/parser.h>
struct box; struct box;
struct form; struct form;
@ -44,7 +45,7 @@ typedef enum binding_quirks_mode {
BINDING_QUIRKS_MODE_FULL BINDING_QUIRKS_MODE_FULL
} binding_quirks_mode; } binding_quirks_mode;
binding_error binding_create_tree(void *arena, const char *charset, void **ctx); binding_error binding_create_tree(void **ctx, const char *charset, bool enable_script, dom_script script, void *context);
binding_error binding_destroy_tree(void *ctx); binding_error binding_destroy_tree(void *ctx);
binding_error binding_parse_chunk(void *ctx, const uint8_t *data, size_t len); binding_error binding_parse_chunk(void *ctx, const uint8_t *data, size_t len);

View File

@ -103,6 +103,7 @@ my %userinfo; # The information about the current user
my $gecos = $pwent[6]; my $gecos = $pwent[6];
$gecos =~ s/,.+//g; $gecos =~ s/,.+//g;
$gecos =~ s/"/'/g; $gecos =~ s/"/'/g;
$gecos =~ s/\\/\\\\/g;
$userinfo{GECOS} = $gecos; $userinfo{GECOS} = $gecos;
} }

View File

@ -101,7 +101,7 @@ const char *nslog_gettime(void)
timeval_subtract(&tv, &now_tv, &start_tv); timeval_subtract(&tv, &now_tv, &start_tv);
snprintf(buff, sizeof(buff),"(%ld.%ld)", snprintf(buff, sizeof(buff),"(%ld.%06ld)",
(long)tv.tv_sec, (long)tv.tv_usec); (long)tv.tv_sec, (long)tv.tv_usec);
return buff; return buff;