netsurf: branch tlsa/monkey-driver created. release/3.8-41-g7eacd9a
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/7eacd9a626ef0ac690868...
...commit http://git.netsurf-browser.org/netsurf.git/commit/7eacd9a626ef0ac690868af...
...tree http://git.netsurf-browser.org/netsurf.git/tree/7eacd9a626ef0ac690868af07...
The branch, tlsa/monkey-driver has been created
at 7eacd9a626ef0ac690868af07dcbb7ed05792aa9 (commit)
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=7eacd9a626ef0ac6908...
commit 7eacd9a626ef0ac690868af07dcbb7ed05792aa9
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <tlsa(a)netsurf-browser.org>
Monkey driver: Initial loader for monkey test plans.
diff --git a/test/monkey-driver.py b/test/monkey-driver.py
new file mode 100755
index 0000000..25c6422
--- /dev/null
+++ b/test/monkey-driver.py
@@ -0,0 +1,119 @@
+#!/usr/bin/python3
+
+import sys, getopt, yaml
+
+def print_usage():
+ print('Usage:')
+ print(' ' + sys.argv[0] + ' -m <path to monkey> -t <path to test>')
+
+def parse_argv(argv):
+ path_monkey = ''
+ path_test = ''
+ try:
+ opts, args = getopt.getopt(argv,"hm:t:",["monkey=","test="])
+ except getopt.GetoptError:
+ print_usage()
+ sys.exit(2)
+ for opt, arg in opts:
+ if opt == '-h':
+ print_usage()
+ sys.exit()
+ elif opt in ("-m", "--monkey"):
+ path_monkey = arg
+ elif opt in ("-t", "--test"):
+ path_test = arg
+
+ if path_monkey == '':
+ print_usage()
+ sys.exit()
+ if path_test == '':
+ print_usage()
+ sys.exit()
+
+ return path_monkey, path_test
+
+def load_test_plan(path):
+ plan = []
+ with open(path, 'r') as stream:
+ try:
+ plan = (yaml.load(stream))
+ except:
+ print (exc)
+ return plan
+
+def get_indent(ctx):
+ return ' ' * ctx["depth"];
+
+def print_test_plan_info(ctx, plan):
+ print('Running test: [' + plan["group"] + '] ' + plan["title"])
+
+def run_test_step_action_launch(ctx, step):
+ print(get_indent(ctx) + "Action: " + step["action"])
+
+def run_test_step_action_window_new(ctx, step):
+ print(get_indent(ctx) + "Action: " + step["action"])
+
+def run_test_step_action_window_close(ctx, step):
+ print(get_indent(ctx) + "Action: " + step["action"])
+
+def run_test_step_action_navigate(ctx, step):
+ print(get_indent(ctx) + "Action: " + step["action"])
+
+def run_test_step_action_sleep_ms(ctx, step):
+ print(get_indent(ctx) + "Action: " + step["action"])
+
+def run_test_step_action_block(ctx, step):
+ print(get_indent(ctx) + "Action: " + step["action"])
+
+def run_test_step_action_repeat(ctx, step):
+ print(get_indent(ctx) + "Action: " + step["action"])
+ ctx["depth"] += 1
+ for step in step["steps"]:
+ run_test_step(ctx, step)
+ ctx["depth"] -= 1
+
+def run_test_step_action_timer_start(ctx, step):
+ print(get_indent(ctx) + "Action: " + step["action"])
+
+def run_test_step_action_timer_stop(ctx, step):
+ print(get_indent(ctx) + "Action: " + step["action"])
+
+def run_test_step_action_timer_check(ctx, step):
+ print(get_indent(ctx) + "Action: " + step["action"])
+
+def run_test_step_action_quit(ctx, step):
+ print(get_indent(ctx) + "Action: " + step["action"])
+
+step_handlers = {
+ "launch": run_test_step_action_launch,
+ "window-new": run_test_step_action_window_new,
+ "window-close": run_test_step_action_window_close,
+ "navigate": run_test_step_action_navigate,
+ "sleep-ms": run_test_step_action_sleep_ms,
+ "block": run_test_step_action_block,
+ "repeat": run_test_step_action_repeat,
+ "timer-start": run_test_step_action_timer_start,
+ "timer-stop": run_test_step_action_timer_stop,
+ "timer-check": run_test_step_action_timer_check,
+ "quit": run_test_step_action_quit,
+}
+
+def run_test_step(ctx, step):
+ step_handlers[step["action"]](ctx, step)
+
+def walk_test_plan(ctx, plan):
+ ctx["depth"] = 0
+ for step in plan["steps"]:
+ run_test_step(ctx, step)
+
+
+def main(argv):
+ ctx = {}
+ path_monkey, path_test = parse_argv(argv)
+ plan = load_test_plan(path_test)
+ print_test_plan_info(ctx, plan)
+ walk_test_plan(ctx, plan)
+
+# Some python weirdness to get to main().
+if __name__ == "__main__":
+ main(sys.argv[1:])
\ No newline at end of file
diff --git a/test/monkey-tests/cache-test.yaml b/test/monkey-tests/cache-test.yaml
new file mode 100644
index 0000000..d8c4571
--- /dev/null
+++ b/test/monkey-tests/cache-test.yaml
@@ -0,0 +1,35 @@
+title: cache test
+group: performance
+steps:
+- action: launch
+ language: en
+- action: timer-start
+ tag: timer1
+- action: window-new
+ tag: win1
+- action: navigate
+ window: win1
+ url: http://www.bbc.co.uk/news
+- action: block
+ conditions:
+ - window: win1
+ status: complete
+- action: timer-stop
+ timer: timer1
+- action: timer-start
+ tag: timer2
+- action: window-new
+ tag: win2
+- action: navigate
+ window: win2
+ url: http://www.bbc.co.uk/news
+- action: block
+ conditions:
+ - window: win2
+ status: complete
+- action: timer-stop
+ timer: timer2
+- action: timer-check
+ condition: timer2 < timer1
+- action: quit
+
diff --git a/test/monkey-tests/quit-mid-fetch.yaml b/test/monkey-tests/quit-mid-fetch.yaml
new file mode 100644
index 0000000..b033f67
--- /dev/null
+++ b/test/monkey-tests/quit-mid-fetch.yaml
@@ -0,0 +1,22 @@
+title: quitting mid-fetch
+group: cleanup
+steps:
+- action: repeat
+ min: 0
+ step: 50
+ name: sleepytimer
+ steps:
+ - action: launch
+ - action: window-new
+ tag: win1
+ - action: navigate
+ window: win1
+ url: http://www.bbc.co.uk/news
+ - action: sleep-ms
+ time: sleepytimer
+ conditions:
+ - window: win1
+ status: complete
+ breaks: sleepytimer
+ - action: quit
+
-----------------------------------------------------------------------
--
NetSurf Browser
4 years, 2 months
netsurf: branch master updated. release/3.8-40-g6fcb0d4
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/6fcb0d498f8f5c39a94a8...
...commit http://git.netsurf-browser.org/netsurf.git/commit/6fcb0d498f8f5c39a94a8d0...
...tree http://git.netsurf-browser.org/netsurf.git/tree/6fcb0d498f8f5c39a94a8d0c7...
The branch, master has been updated
via 6fcb0d498f8f5c39a94a8d0c79e425b480c272bc (commit)
via 77814588a8177735d8552fd3f11a97c0e8250f01 (commit)
from 6ff3238825f21e0abec37b1d485318648d824cab (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=6fcb0d498f8f5c39a94...
commit 6fcb0d498f8f5c39a94a8d0c79e425b480c272bc
Author: Daniel Silverstone <dsilvers(a)digital-scurf.org>
Commit: Daniel Silverstone <dsilvers(a)digital-scurf.org>
Update farmer a little ready for later
diff --git a/frontends/monkey/farmer.py b/frontends/monkey/farmer.py
index c79b530..80bc8e6 100644
--- a/frontends/monkey/farmer.py
+++ b/frontends/monkey/farmer.py
@@ -56,6 +56,7 @@ class MonkeyFarmer(asyncore.dispatcher):
self.deadmonkey = False
self.online = online
self.quiet = quiet
+ self.discussion = []
def handle_connect(self):
pass
@@ -82,6 +83,7 @@ class MonkeyFarmer(asyncore.dispatcher):
cmd = (" ".join(args))
if not self.quiet:
print(">>> {}".format(cmd))
+ self.discussion.append((">",cmd))
cmd = cmd + "\n"
self.buffer += cmd.encode('utf-8')
@@ -89,6 +91,7 @@ class MonkeyFarmer(asyncore.dispatcher):
line = line.decode('utf-8')
if not self.quiet:
print("<<< {}".format(line))
+ self.discussion.append(("<", line))
self.online(line)
def schedule_event(self, event, secs=None, when=None):
@@ -128,6 +131,11 @@ class Browser:
self.farmer = MonkeyFarmer(online=self.on_monkey_line, quiet=quiet)
self.windows = {}
self.current_draw_target = None
+ self.started = False
+ self.stopped = False
+ self.launchurl = None
+ while not self.started:
+ self.farmer.loop(once=True)
def pass_options(self, *opts):
if len(opts) > 0:
@@ -145,9 +153,18 @@ class Browser:
def quit_and_wait(self):
self.quit()
self.farmer.loop()
+ return self.stopped
def handle_GENERIC(self, what, *args):
- pass
+ if what == 'STARTED':
+ self.started = True
+ elif what == 'FINISHED':
+ self.stopped = True
+ elif what == 'LAUNCH':
+ self.launchurl = args[1]
+ else:
+ # TODO: Nothing for now?
+ pass
def handle_WINDOW(self, action, _win, winid, *args):
if action == "NEW":
@@ -210,6 +227,7 @@ class BrowserWindow:
else:
self.browser.farmer.tell_monkey("WINDOW GO %s %s %s" % (
self.winid, url, referer))
+ self.wait_start_loading()
def reload(self):
self.browser.farmer.tell_monkey("WINDOW RELOAD %s" % self.winid)
@@ -304,13 +322,12 @@ class BrowserWindow:
self.go(url, referer)
self.wait_loaded()
- def reload(self):
- self.browser.farmer.tell_monkey("WINDOW RELOAD %s" % self.winid)
- self.wait_loaded()
-
- def wait_loaded(self):
+ def wait_start_loading(self):
while not self.throbbing:
self.browser.farmer.loop(once=True)
+
+ def wait_loaded(self):
+ self.wait_start_loading()
while self.throbbing:
self.browser.farmer.loop(once=True)
@@ -369,3 +386,7 @@ for cmd in cmds:
print("{} {} -> {}".format(x,y,rest))
browser.quit_and_wait()
+
+#print("Discussion was:")
+#for line in browser.farmer.discussion:
+# print("{} {}".format(line[0], line[1]))
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=77814588a8177735d85...
commit 77814588a8177735d8552fd3f11a97c0e8250f01
Author: Daniel Silverstone <dsilvers(a)digital-scurf.org>
Commit: Daniel Silverstone <dsilvers(a)digital-scurf.org>
Correct wrong MOUT_ERROR to MOUT_WINDOW
diff --git a/frontends/monkey/browser.c b/frontends/monkey/browser.c
index b93d491..69459fb 100644
--- a/frontends/monkey/browser.c
+++ b/frontends/monkey/browser.c
@@ -480,7 +480,7 @@ monkey_window_handle_redraw(int argc, char **argv)
NSLOG(netsurf, INFO, "Issue redraw");
moutf(MOUT_WINDOW, "REDRAW WIN %d START", atoi(argv[2]));
browser_window_redraw(gw->bw, gw->scrollx, gw->scrolly, &clip, &ctx);
- moutf(MOUT_ERROR, "REDRAW WIN %d STOP", atoi(argv[2]));
+ moutf(MOUT_WINDOW, "REDRAW WIN %d STOP", atoi(argv[2]));
}
static void
-----------------------------------------------------------------------
Summary of changes:
frontends/monkey/browser.c | 2 +-
frontends/monkey/farmer.py | 33 +++++++++++++++++++++++++++------
2 files changed, 28 insertions(+), 7 deletions(-)
diff --git a/frontends/monkey/browser.c b/frontends/monkey/browser.c
index b93d491..69459fb 100644
--- a/frontends/monkey/browser.c
+++ b/frontends/monkey/browser.c
@@ -480,7 +480,7 @@ monkey_window_handle_redraw(int argc, char **argv)
NSLOG(netsurf, INFO, "Issue redraw");
moutf(MOUT_WINDOW, "REDRAW WIN %d START", atoi(argv[2]));
browser_window_redraw(gw->bw, gw->scrollx, gw->scrolly, &clip, &ctx);
- moutf(MOUT_ERROR, "REDRAW WIN %d STOP", atoi(argv[2]));
+ moutf(MOUT_WINDOW, "REDRAW WIN %d STOP", atoi(argv[2]));
}
static void
diff --git a/frontends/monkey/farmer.py b/frontends/monkey/farmer.py
index c79b530..80bc8e6 100644
--- a/frontends/monkey/farmer.py
+++ b/frontends/monkey/farmer.py
@@ -56,6 +56,7 @@ class MonkeyFarmer(asyncore.dispatcher):
self.deadmonkey = False
self.online = online
self.quiet = quiet
+ self.discussion = []
def handle_connect(self):
pass
@@ -82,6 +83,7 @@ class MonkeyFarmer(asyncore.dispatcher):
cmd = (" ".join(args))
if not self.quiet:
print(">>> {}".format(cmd))
+ self.discussion.append((">",cmd))
cmd = cmd + "\n"
self.buffer += cmd.encode('utf-8')
@@ -89,6 +91,7 @@ class MonkeyFarmer(asyncore.dispatcher):
line = line.decode('utf-8')
if not self.quiet:
print("<<< {}".format(line))
+ self.discussion.append(("<", line))
self.online(line)
def schedule_event(self, event, secs=None, when=None):
@@ -128,6 +131,11 @@ class Browser:
self.farmer = MonkeyFarmer(online=self.on_monkey_line, quiet=quiet)
self.windows = {}
self.current_draw_target = None
+ self.started = False
+ self.stopped = False
+ self.launchurl = None
+ while not self.started:
+ self.farmer.loop(once=True)
def pass_options(self, *opts):
if len(opts) > 0:
@@ -145,9 +153,18 @@ class Browser:
def quit_and_wait(self):
self.quit()
self.farmer.loop()
+ return self.stopped
def handle_GENERIC(self, what, *args):
- pass
+ if what == 'STARTED':
+ self.started = True
+ elif what == 'FINISHED':
+ self.stopped = True
+ elif what == 'LAUNCH':
+ self.launchurl = args[1]
+ else:
+ # TODO: Nothing for now?
+ pass
def handle_WINDOW(self, action, _win, winid, *args):
if action == "NEW":
@@ -210,6 +227,7 @@ class BrowserWindow:
else:
self.browser.farmer.tell_monkey("WINDOW GO %s %s %s" % (
self.winid, url, referer))
+ self.wait_start_loading()
def reload(self):
self.browser.farmer.tell_monkey("WINDOW RELOAD %s" % self.winid)
@@ -304,13 +322,12 @@ class BrowserWindow:
self.go(url, referer)
self.wait_loaded()
- def reload(self):
- self.browser.farmer.tell_monkey("WINDOW RELOAD %s" % self.winid)
- self.wait_loaded()
-
- def wait_loaded(self):
+ def wait_start_loading(self):
while not self.throbbing:
self.browser.farmer.loop(once=True)
+
+ def wait_loaded(self):
+ self.wait_start_loading()
while self.throbbing:
self.browser.farmer.loop(once=True)
@@ -369,3 +386,7 @@ for cmd in cmds:
print("{} {} -> {}".format(x,y,rest))
browser.quit_and_wait()
+
+#print("Discussion was:")
+#for line in browser.farmer.discussion:
+# print("{} {}".format(line[0], line[1]))
--
NetSurf Browser
4 years, 2 months
netsurf: branch master updated. release/3.8-38-g6ff3238
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/6ff3238825f21e0abec37...
...commit http://git.netsurf-browser.org/netsurf.git/commit/6ff3238825f21e0abec37b1...
...tree http://git.netsurf-browser.org/netsurf.git/tree/6ff3238825f21e0abec37b1d4...
The branch, master has been updated
via 6ff3238825f21e0abec37b1d485318648d824cab (commit)
from 4fcb6eb3016de68b4a742cd6b4d2248550529deb (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=6ff3238825f21e0abec...
commit 6ff3238825f21e0abec37b1d485318648d824cab
Author: Vincent Sanders <vince(a)kyllikki.org>
Commit: Vincent Sanders <vince(a)kyllikki.org>
centralise monkey output generation
diff --git a/frontends/gtk/login.c b/frontends/gtk/login.c
index 02951aa..184ef29 100644
--- a/frontends/gtk/login.c
+++ b/frontends/gtk/login.c
@@ -258,12 +258,15 @@ create_login_window(nsurl *url,
/* exported function documented in gtk/login.h */
-nserror gui_401login_open(nsurl *url, const char *realm,
- const char *username, const char *password,
- nserror (*cb)(const char *username,
+nserror
+gui_401login_open(nsurl *url,
+ const char *realm,
+ const char *username,
+ const char *password,
+ nserror (*cb)(const char *username,
const char *password,
void *pw),
- void *cbpw)
+ void *cbpw)
{
lwc_string *host;
nserror res;
diff --git a/frontends/monkey/401login.c b/frontends/monkey/401login.c
index 58335dd..76550d8 100644
--- a/frontends/monkey/401login.c
+++ b/frontends/monkey/401login.c
@@ -21,6 +21,7 @@
#include <stdlib.h>
#include <stdio.h>
+#include "monkey/output.h"
#include "monkey/401login.h"
typedef struct monkey401 {
@@ -34,12 +35,16 @@ typedef struct monkey401 {
static monkey401_t *m4_ring = NULL;
static uint32_t m4_ctr = 0;
-nserror gui_401login_open(nsurl *url, const char *realm,
- const char *username, const char *password,
- nserror (*cb)(const char *username,
+
+nserror
+gui_401login_open(nsurl *url,
+ const char *realm,
+ const char *username,
+ const char *password,
+ nserror (*cb)(const char *username,
const char *password,
void *pw),
- void *cbpw)
+ void *cbpw)
{
monkey401_t *m4t = calloc(sizeof(*m4t), 1);
if (m4t == NULL) {
@@ -51,7 +56,7 @@ nserror gui_401login_open(nsurl *url, const char *realm,
RING_INSERT(m4_ring, m4t);
- fprintf(stdout, "401LOGIN OPEN M4 %u URL %s REALM %s\n",
+ moutf(MOUT_LOGIN, "OPEN LWIN %u URL %s REALM %s",
m4t->num, nsurl_access(url), realm);
return NSERROR_OK;
diff --git a/frontends/monkey/Makefile b/frontends/monkey/Makefile
index 27d6610..d49a6c5 100644
--- a/frontends/monkey/Makefile
+++ b/frontends/monkey/Makefile
@@ -39,7 +39,7 @@ endif
# ----------------------------------------------------------------------------
# S_MONKEY are sources purely for the MONKEY build
-S_FRONTEND := main.c filetype.c schedule.c bitmap.c plot.c browser.c \
+S_FRONTEND := main.c output.c filetype.c schedule.c bitmap.c plot.c browser.c \
download.c 401login.c cert.c layout.c dispatch.c fetch.c
diff --git a/frontends/monkey/bitmap.c b/frontends/monkey/bitmap.c
index 83b8566..e53b565 100644
--- a/frontends/monkey/bitmap.c
+++ b/frontends/monkey/bitmap.c
@@ -23,6 +23,7 @@
#include "utils/errors.h"
#include "netsurf/bitmap.h"
+#include "monkey/output.h"
#include "monkey/bitmap.h"
struct bitmap {
@@ -127,7 +128,7 @@ static int bitmap_get_height(void *bitmap)
static nserror bitmap_render(struct bitmap *bitmap,
struct hlcache_handle *content)
{
- fprintf(stdout, "GENERIC BITMAP RENDER\n");
+ moutf(MOUT_GENERIC, "BITMAP RENDER");
return NSERROR_OK;
}
diff --git a/frontends/monkey/browser.c b/frontends/monkey/browser.c
index 1fbbbf0..b93d491 100644
--- a/frontends/monkey/browser.c
+++ b/frontends/monkey/browser.c
@@ -32,6 +32,7 @@
#include "netsurf/browser_window.h"
#include "netsurf/plotters.h"
+#include "monkey/output.h"
#include "monkey/browser.h"
#include "monkey/plot.h"
@@ -42,7 +43,7 @@ static struct gui_window *gw_ring = NULL;
/* exported function documented in monkey/browser.h */
nserror monkey_warn_user(const char *warning, const char *detail)
{
- fprintf(stderr, "WARN %s %s\n", warning, detail);
+ moutf(MOUT_WARNING, "%s %s", warning, detail);
return NSERROR_OK;
}
@@ -50,14 +51,14 @@ struct gui_window *
monkey_find_window_by_num(uint32_t win_num)
{
struct gui_window *ret = NULL;
-
+
RING_ITERATE_START(struct gui_window, gw_ring, c_ring) {
if (c_ring->win_num == win_num) {
ret = c_ring;
RING_ITERATE_STOP(gw_ring, c_ring);
}
} RING_ITERATE_END(gw_ring, c_ring);
-
+
return ret;
}
@@ -77,28 +78,31 @@ gui_window_create(struct browser_window *bw,
struct gui_window *ret = calloc(sizeof(*ret), 1);
if (ret == NULL)
return NULL;
-
+
ret->win_num = win_ctr++;
ret->bw = bw;
-
+
ret->width = 800;
ret->height = 600;
-
- fprintf(stdout, "WINDOW NEW WIN %u FOR %p EXISTING %p NEWTAB %s CLONE %s\n",
- ret->win_num, bw, existing, flags & GW_CREATE_TAB ? "TRUE" : "FALSE",
- flags & GW_CREATE_CLONE ? "TRUE" : "FALSE");
- fprintf(stdout, "WINDOW SIZE WIN %u WIDTH %d HEIGHT %d\n",
- ret->win_num, ret->width, ret->height);
-
+
+ moutf(MOUT_WINDOW,
+ "NEW WIN %u FOR %p EXISTING %p NEWTAB %s CLONE %s",
+ ret->win_num, bw, existing,
+ flags & GW_CREATE_TAB ? "TRUE" : "FALSE",
+ flags & GW_CREATE_CLONE ? "TRUE" : "FALSE");
+ moutf(MOUT_WINDOW,
+ "SIZE WIN %u WIDTH %d HEIGHT %d",
+ ret->win_num, ret->width, ret->height);
+
RING_INSERT(gw_ring, ret);
-
+
return ret;
}
static void
gui_window_destroy(struct gui_window *g)
{
- fprintf(stdout, "WINDOW DESTROY WIN %u\n", g->win_num);
+ moutf(MOUT_WINDOW, "DESTROY WIN %u", g->win_num);
RING_REMOVE(gw_ring, g);
free(g);
}
@@ -106,7 +110,7 @@ gui_window_destroy(struct gui_window *g)
static void
gui_window_set_title(struct gui_window *g, const char *title)
{
- fprintf(stdout, "WINDOW TITLE WIN %u STR %s\n", g->win_num, title);
+ moutf(MOUT_WINDOW, "TITLE WIN %u STR %s", g->win_num, title);
}
/**
@@ -120,9 +124,9 @@ gui_window_set_title(struct gui_window *g, const char *title)
*/
static nserror
gui_window_get_dimensions(struct gui_window *g, int *width, int *height,
- bool scaled)
+ bool scaled)
{
- fprintf(stdout, "WINDOW GET_DIMENSIONS WIN %u WIDTH %d HEIGHT %d\n",
+ moutf(MOUT_WINDOW, "GET_DIMENSIONS WIN %u WIDTH %d HEIGHT %d",
g->win_num, g->width, g->height);
*width = g->width;
*height = g->height;
@@ -133,25 +137,25 @@ gui_window_get_dimensions(struct gui_window *g, int *width, int *height,
static void
gui_window_new_content(struct gui_window *g)
{
- fprintf(stdout, "WINDOW NEW_CONTENT WIN %u\n", g->win_num);
+ moutf(MOUT_WINDOW, "NEW_CONTENT WIN %u", g->win_num);
}
static void
gui_window_set_icon(struct gui_window *g, struct hlcache_handle *icon)
{
- fprintf(stdout, "WINDOW NEW_ICON WIN %u\n", g->win_num);
+ moutf(MOUT_WINDOW, "NEW_ICON WIN %u", g->win_num);
}
static void
gui_window_start_throbber(struct gui_window *g)
{
- fprintf(stdout, "WINDOW START_THROBBER WIN %u\n", g->win_num);
+ moutf(MOUT_WINDOW, "START_THROBBER WIN %u", g->win_num);
}
static void
gui_window_stop_throbber(struct gui_window *g)
{
- fprintf(stdout, "WINDOW STOP_THROBBER WIN %u\n", g->win_num);
+ moutf(MOUT_WINDOW, "STOP_THROBBER WIN %u", g->win_num);
}
@@ -171,7 +175,7 @@ gui_window_set_scroll(struct gui_window *gw, const struct rect *rect)
gw->scrollx = rect->x0;
gw->scrolly = rect->y0;
- fprintf(stdout, "WINDOW SET_SCROLL WIN %u X %d Y %d\n",
+ moutf(MOUT_WINDOW, "SET_SCROLL WIN %u X %d Y %d",
gw->win_num, rect->x0, rect->y0);
return NSERROR_OK;
}
@@ -187,15 +191,14 @@ gui_window_set_scroll(struct gui_window *gw, const struct rect *rect)
static nserror
monkey_window_invalidate_area(struct gui_window *gw, const struct rect *rect)
{
- fprintf(stdout, "WINDOW INVALIDATE_AREA WIN %u", gw->win_num);
-
if (rect != NULL) {
- fprintf(stdout,
- " X %d Y %d WIDTH %d HEIGHT %d\n",
- rect->x0, rect->y0,
- (rect->x1 - rect->x0), (rect->y1 - rect->y0));
+ moutf(MOUT_WINDOW,
+ "INVALIDATE_AREA WIN %u X %d Y %d WIDTH %d HEIGHT %d",
+ gw->win_num,
+ rect->x0, rect->y0,
+ (rect->x1 - rect->x0), (rect->y1 - rect->y0));
} else {
- fprintf(stdout," ALL\n");
+ moutf(MOUT_WINDOW, "INVALIDATE_AREA WIN %u ALL", gw->win_num);
}
return NSERROR_OK;
@@ -209,21 +212,21 @@ gui_window_update_extent(struct gui_window *g)
if (browser_window_get_extents(g->bw, false, &width, &height) != NSERROR_OK)
return;
- fprintf(stdout, "WINDOW UPDATE_EXTENT WIN %u WIDTH %d HEIGHT %d\n",
- g->win_num, width, height);
+ moutf(MOUT_WINDOW, "UPDATE_EXTENT WIN %u WIDTH %d HEIGHT %d",
+ g->win_num, width, height);
}
static void
gui_window_set_status(struct gui_window *g, const char *text)
{
- fprintf(stdout, "WINDOW SET_STATUS WIN %u STR %s\n", g->win_num, text);
+ moutf(MOUT_WINDOW, "SET_STATUS WIN %u STR %s", g->win_num, text);
}
static void
gui_window_set_pointer(struct gui_window *g, gui_pointer_shape shape)
{
const char *ptr_name = "UNKNOWN";
-
+
switch (shape) {
case GUI_POINTER_POINT:
ptr_name = "POINT";
@@ -285,21 +288,24 @@ gui_window_set_pointer(struct gui_window *g, gui_pointer_shape shape)
default:
break;
}
- fprintf(stdout, "WINDOW SET_POINTER WIN %u POINTER %s\n", g->win_num, ptr_name);
+
+ moutf(MOUT_WINDOW, "SET_POINTER WIN %u POINTER %s",
+ g->win_num, ptr_name);
}
static nserror
gui_window_set_url(struct gui_window *g, nsurl *url)
{
- fprintf(stdout, "WINDOW SET_URL WIN %u URL %s\n", g->win_num, nsurl_access(url));
+ moutf(MOUT_WINDOW, "SET_URL WIN %u URL %s",
+ g->win_num, nsurl_access(url));
return NSERROR_OK;
}
static bool
gui_window_get_scroll(struct gui_window *g, int *sx, int *sy)
{
- fprintf(stdout, "WINDOW GET_SCROLL WIN %u X %d Y %d\n",
- g->win_num, g->scrollx, g->scrolly);
+ moutf(MOUT_WINDOW, "GET_SCROLL WIN %u X %d Y %d",
+ g->win_num, g->scrollx, g->scrolly);
*sx = g->scrollx;
*sy = g->scrolly;
return true;
@@ -308,7 +314,7 @@ gui_window_get_scroll(struct gui_window *g, int *sx, int *sy)
static bool
gui_window_scroll_start(struct gui_window *g)
{
- fprintf(stdout, "WINDOW SCROLL_START WIN %u\n", g->win_num);
+ moutf(MOUT_WINDOW, "SCROLL_START WIN %u", g->win_num);
g->scrollx = g->scrolly = 0;
return true;
}
@@ -318,28 +324,28 @@ static void
gui_window_place_caret(struct gui_window *g, int x, int y, int height,
const struct rect *clip)
{
- fprintf(stdout, "WINDOW PLACE_CARET WIN %u X %d Y %d HEIGHT %d\n",
- g->win_num, x, y, height);
+ moutf(MOUT_WINDOW, "PLACE_CARET WIN %u X %d Y %d HEIGHT %d",
+ g->win_num, x, y, height);
}
static void
gui_window_remove_caret(struct gui_window *g)
{
- fprintf(stdout, "WINDOW REMOVE_CARET WIN %u\n", g->win_num);
+ moutf(MOUT_WINDOW, "REMOVE_CARET WIN %u", g->win_num);
}
static bool
gui_window_drag_start(struct gui_window *g, gui_drag_type type,
- const struct rect *rect)
+ const struct rect *rect)
{
- fprintf(stdout, "WINDOW SCROLL_START WIN %u TYPE %i\n", g->win_num, type);
+ moutf(MOUT_WINDOW, "SCROLL_START WIN %u TYPE %i", g->win_num, type);
return false;
}
static nserror
gui_window_save_link(struct gui_window *g, nsurl *url, const char *title)
{
- fprintf(stdout, "WINDOW SAVE_LINK WIN %u URL %s TITLE %s\n",
+ moutf(MOUT_WINDOW, "SAVE_LINK WIN %u URL %s TITLE %s",
g->win_num, nsurl_access(url), title);
return NSERROR_OK;
}
@@ -380,11 +386,11 @@ monkey_window_handle_destroy(int argc, char **argv)
{
struct gui_window *gw;
uint32_t nr = atoi((argc > 2) ? argv[2] : "-1");
-
+
gw = monkey_find_window_by_num(nr);
-
+
if (gw == NULL) {
- fprintf(stdout, "ERROR WINDOW NUM BAD\n");
+ moutf(MOUT_ERROR, "WINDOW NUM BAD");
} else {
browser_window_destroy(gw->bw);
}
@@ -397,16 +403,16 @@ monkey_window_handle_go(int argc, char **argv)
nsurl *url;
nsurl *ref_url = NULL;
nserror error;
-
+
if (argc < 4 || argc > 5) {
- fprintf(stdout, "ERROR WINDOW GO ARGS BAD\n");
+ moutf(MOUT_ERROR, "WINDOW GO ARGS BAD");
return;
}
-
+
gw = monkey_find_window_by_num(atoi(argv[2]));
-
+
if (gw == NULL) {
- fprintf(stdout, "ERROR WINDOW NUM BAD\n");
+ moutf(MOUT_ERROR, "WINDOW NUM BAD");
return;
}
@@ -446,35 +452,35 @@ monkey_window_handle_redraw(int argc, char **argv)
.background_images = true,
.plot = monkey_plotters
};
-
+
if (argc != 3 && argc != 7) {
- fprintf(stdout, "ERROR WINDOW REDRAW ARGS BAD\n");
+ moutf(MOUT_ERROR, "WINDOW REDRAW ARGS BAD");
return;
}
gw = monkey_find_window_by_num(atoi(argv[2]));
-
+
if (gw == NULL) {
- fprintf(stdout, "ERROR WINDOW NUM BAD\n");
+ moutf(MOUT_ERROR, "WINDOW NUM BAD");
return;
}
-
+
clip.x0 = 0;
clip.y0 = 0;
clip.x1 = gw->width;
clip.y1 = gw->height;
-
+
if (argc == 7) {
clip.x0 = atoi(argv[3]);
clip.y0 = atoi(argv[4]);
clip.x1 = atoi(argv[5]);
clip.y1 = atoi(argv[6]);
}
-
+
NSLOG(netsurf, INFO, "Issue redraw");
- fprintf(stdout, "WINDOW REDRAW WIN %d START\n", atoi(argv[2]));
- browser_window_redraw(gw->bw, gw->scrollx, gw->scrolly, &clip, &ctx);
- fprintf(stdout, "WINDOW REDRAW WIN %d STOP\n", atoi(argv[2]));
+ moutf(MOUT_WINDOW, "REDRAW WIN %d START", atoi(argv[2]));
+ browser_window_redraw(gw->bw, gw->scrollx, gw->scrolly, &clip, &ctx);
+ moutf(MOUT_ERROR, "REDRAW WIN %d STOP", atoi(argv[2]));
}
static void
@@ -482,13 +488,13 @@ monkey_window_handle_reload(int argc, char **argv)
{
struct gui_window *gw;
if (argc != 3 && argc != 4) {
- fprintf(stdout, "ERROR WINDOW RELOAD ARGS BAD\n");
+ moutf(MOUT_ERROR, "WINDOW RELOAD ARGS BAD\n");
}
-
+
gw = monkey_find_window_by_num(atoi(argv[2]));
-
+
if (gw == NULL) {
- fprintf(stdout, "ERROR WINDOW NUM BAD\n");
+ moutf(MOUT_ERROR, "WINDOW NUM BAD");
} else {
browser_window_reload(gw->bw, argc == 4);
}
@@ -500,7 +506,7 @@ monkey_window_handle_command(int argc, char **argv)
{
if (argc == 1)
return;
-
+
if (strcmp(argv[1], "NEW") == 0) {
monkey_window_handle_new(argc, argv);
} else if (strcmp(argv[1], "DESTROY") == 0) {
@@ -512,9 +518,9 @@ monkey_window_handle_command(int argc, char **argv)
} else if (strcmp(argv[1], "RELOAD") == 0) {
monkey_window_handle_reload(argc, argv);
} else {
- fprintf(stdout, "ERROR WINDOW COMMAND UNKNOWN %s\n", argv[1]);
+ moutf(MOUT_ERROR, "WINDOW COMMAND UNKNOWN %s\n", argv[1]);
}
-
+
}
static struct gui_window_table window_table = {
diff --git a/frontends/monkey/cert.c b/frontends/monkey/cert.c
index a199755..0827ff0 100644
--- a/frontends/monkey/cert.c
+++ b/frontends/monkey/cert.c
@@ -22,6 +22,7 @@
#include "utils/ring.h"
#include "utils/nsurl.h"
+#include "monkey/output.h"
#include "monkey/cert.h"
typedef struct monkey_cert {
@@ -36,9 +37,10 @@ static monkey_cert_t *cert_ring = NULL;
static uint32_t cert_ctr = 0;
nserror
-gui_cert_verify(nsurl *url, const struct ssl_cert_info *certs,
- unsigned long num, nserror (*cb)(bool proceed, void *pw),
- void *cbpw)
+gui_cert_verify(nsurl *url,
+ const struct ssl_cert_info *certs,
+ unsigned long num, nserror (*cb)(bool proceed, void *pw),
+ void *cbpw)
{
monkey_cert_t *m4t = calloc(sizeof(*m4t), 1);
if (m4t == NULL) {
@@ -47,13 +49,11 @@ gui_cert_verify(nsurl *url, const struct ssl_cert_info *certs,
m4t->cb = cb;
m4t->pw = cbpw;
m4t->num = cert_ctr++;
-
+
RING_INSERT(cert_ring, m4t);
-
- fprintf(stdout, "SSLCERT VERIFY CERT %u URL %s\n",
- m4t->num, nsurl_access(url));
+
+ moutf(MOUT_SSLCERT, "VERIFY CWIN %u URL %s",
+ m4t->num, nsurl_access(url));
return NSERROR_OK;
}
-
-
diff --git a/frontends/monkey/download.c b/frontends/monkey/download.c
index 5c9ce1b..1c516e3 100644
--- a/frontends/monkey/download.c
+++ b/frontends/monkey/download.c
@@ -25,6 +25,7 @@
#include "netsurf/download.h"
#include "desktop/download.h"
+#include "monkey/output.h"
#include "monkey/browser.h"
static uint32_t dwin_ctr = 0;
@@ -51,8 +52,8 @@ gui_download_window_create(download_context *ctx,
RING_INSERT(dw_ring, ret);
- fprintf(stdout, "DOWNLOAD_WINDOW CREATE DWIN %u WIN %u\n",
- ret->dwin_num, parent->win_num);
+ moutf(MOUT_DOWNLOAD, "CREATE DWIN %u WIN %u",
+ ret->dwin_num, parent->win_num);
return ret;
}
@@ -61,7 +62,7 @@ static nserror
gui_download_window_data(struct gui_download_window *dw,
const char *data, unsigned int size)
{
- fprintf(stdout, "DOWNLOAD_WINDOW DATA DWIN %u SIZE %u DATA %s\n",
+ moutf(MOUT_DOWNLOAD, "DATA DWIN %u SIZE %u DATA %s",
dw->dwin_num, size, data);
return NSERROR_OK;
}
@@ -70,15 +71,13 @@ static void
gui_download_window_error(struct gui_download_window *dw,
const char *error_msg)
{
- fprintf(stdout, "DOWNLOAD_WINDOW ERROR DWIN %u ERROR %s\n",
- dw->dwin_num, error_msg);
+ moutf(MOUT_DOWNLOAD, "ERROR DWIN %u ERROR %s", dw->dwin_num, error_msg);
}
static void
gui_download_window_done(struct gui_download_window *dw)
{
- fprintf(stdout, "DOWNLOAD_WINDOW DONE DWIN %u\n",
- dw->dwin_num);
+ moutf(MOUT_DOWNLOAD, "DONE DWIN %u", dw->dwin_num);
RING_REMOVE(dw_ring, dw);
free(dw);
}
diff --git a/frontends/monkey/main.c b/frontends/monkey/main.c
index 53cde5a..7ef4208 100644
--- a/frontends/monkey/main.c
+++ b/frontends/monkey/main.c
@@ -37,6 +37,7 @@
#include "netsurf/cookie_db.h"
#include "content/fetch.h"
+#include "monkey/output.h"
#include "monkey/dispatch.h"
#include "monkey/browser.h"
#include "monkey/cert.h"
@@ -66,7 +67,7 @@ static bool monkey_done = false;
*/
static void die(const char * const error)
{
- fprintf(stderr, "DIE %s\n", error);
+ moutf(MOUT_DIE, "%s", error);
exit(EXIT_FAILURE);
}
@@ -199,7 +200,7 @@ static void monkey_quit(void)
static nserror gui_launch_url(struct nsurl *url)
{
- fprintf(stdout, "GENERIC LAUNCH URL %s\n", nsurl_access(url));
+ moutf(MOUT_GENERIC, "LAUNCH URL %s", nsurl_access(url));
return NSERROR_OK;
}
@@ -279,7 +280,7 @@ static void monkey_run(void)
switch (schedtm) {
case -1:
NSLOG(netsurf, INFO, "Iterate blocking");
- fprintf(stdout, "GENERIC POLL BLOCKING\n");
+ moutf(MOUT_GENERIC, "POLL BLOCKING");
timeout = NULL;
break;
@@ -292,7 +293,7 @@ static void monkey_run(void)
default:
NSLOG(netsurf, INFO, "Iterate non-blocking");
- fprintf(stdout, "GENERIC POLL TIMED %d\n", schedtm);
+ moutf(MOUT_GENERIC, "POLL TIMED %d", schedtm);
tv.tv_sec = schedtm / 1000; /* miliseconds to seconds */
tv.tv_usec = (schedtm % 1000) * 1000; /* remainder to microseconds */
timeout = &tv;
@@ -392,14 +393,14 @@ main(int argc, char **argv)
die("options handler failed to register");
}
- fprintf(stdout, "GENERIC STARTED\n");
+ moutf(MOUT_GENERIC, "STARTED");
monkey_run();
- fprintf(stdout, "GENERIC CLOSING_DOWN\n");
+ moutf(MOUT_GENERIC, "CLOSING_DOWN");
monkey_kill_browser_windows();
netsurf_exit();
- fprintf(stdout, "GENERIC FINISHED\n");
+ moutf(MOUT_GENERIC, "FINISHED");
/* finalise options */
nsoption_finalise(nsoptions, nsoptions_default);
diff --git a/frontends/monkey/output.c b/frontends/monkey/output.c
new file mode 100644
index 0000000..a3390ea
--- /dev/null
+++ b/frontends/monkey/output.c
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2018 Vincent Sanders <vince(a)nexturf-browser.org>
+ *
+ * This file is part of NetSurf, http://www.netsurf-browser.org/
+ *
+ * NetSurf is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * NetSurf is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <stdio.h>
+#include <stdarg.h>
+
+#include "monkey/output.h"
+
+/**
+ * output type prefixes
+ */
+static const char *type_text[]={
+ "DIE",
+ "ERROR",
+ "WARN",
+ "GENERIC",
+ "WINDOW",
+ "LOGIN",
+ "SSLCERT",
+ "DOWNLOAD",
+ "PLOT",
+};
+
+/* exported interface documented in monkey/output.h */
+int moutf(enum monkey_output_type mout_type, const char *fmt, ...)
+{
+ va_list ap;
+ int res;
+
+ res = fprintf(stdout, "%s ", type_text[mout_type]);
+
+ va_start(ap, fmt);
+ res += vfprintf(stdout, fmt, ap);
+ va_end(ap);
+
+ fputc('\n', stdout);
+
+ return res + 1;
+}
diff --git a/frontends/monkey/output.h b/frontends/monkey/output.h
new file mode 100644
index 0000000..5e77ab3
--- /dev/null
+++ b/frontends/monkey/output.h
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2018 Vincent Sanders <vince(a)netsurf-browser.org>
+ *
+ * This file is part of NetSurf, http://www.netsurf-browser.org/
+ *
+ * NetSurf is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * NetSurf is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef NS_MONKEY_OUTPUT_H
+#define NS_MONKEY_OUTPUT_H
+
+enum monkey_output_type {
+ MOUT_DIE,
+ MOUT_ERROR,
+ MOUT_WARNING,
+ MOUT_GENERIC,
+ MOUT_WINDOW,
+ MOUT_LOGIN,
+ MOUT_SSLCERT,
+ MOUT_DOWNLOAD,
+ MOUT_PLOT,
+};
+
+int moutf(enum monkey_output_type mout_type, const char *fmt, ...);
+
+#endif
diff --git a/frontends/monkey/plot.c b/frontends/monkey/plot.c
index 2fc9a3c..7a84c4a 100644
--- a/frontends/monkey/plot.c
+++ b/frontends/monkey/plot.c
@@ -22,6 +22,8 @@
#include "utils/errors.h"
#include "netsurf/plotters.h"
+#include "monkey/output.h"
+
/**
* \brief Sets a clip rectangle for subsequent plot operations.
*
@@ -33,8 +35,7 @@
static nserror
monkey_plot_clip(const struct redraw_context *ctx, const struct rect *clip)
{
- fprintf(stdout,
- "PLOT CLIP X0 %d Y0 %d X1 %d Y1 %d\n",
+ moutf(MOUT_PLOT, "CLIP X0 %d Y0 %d X1 %d Y1 %d",
clip->x0, clip->y0, clip->x1, clip->y1);
return NSERROR_OK;
}
@@ -61,9 +62,8 @@ monkey_plot_arc(const struct redraw_context *ctx,
const plot_style_t *style,
int x, int y, int radius, int angle1, int angle2)
{
- fprintf(stdout,
- "PLOT ARC X %d Y %d RADIUS %d ANGLE1 %d ANGLE2 %d\n",
- x, y, radius, angle1, angle2);
+ moutf(MOUT_PLOT, "ARC X %d Y %d RADIUS %d ANGLE1 %d ANGLE2 %d",
+ x, y, radius, angle1, angle2);
return NSERROR_OK;
}
@@ -85,9 +85,7 @@ monkey_plot_disc(const struct redraw_context *ctx,
const plot_style_t *style,
int x, int y, int radius)
{
- fprintf(stdout,
- "PLOT DISC X %d Y %d RADIUS %d\n",
- x, y, radius);
+ moutf(MOUT_PLOT, "DISC X %d Y %d RADIUS %d", x, y, radius);
return NSERROR_OK;
}
@@ -108,8 +106,7 @@ monkey_plot_line(const struct redraw_context *ctx,
const plot_style_t *style,
const struct rect *line)
{
- fprintf(stdout,
- "PLOT LINE X0 %d Y0 %d X1 %d Y1 %d\n",
+ moutf(MOUT_PLOT, "LINE X0 %d Y0 %d X1 %d Y1 %d",
line->x0, line->y0, line->x1, line->y1);
return NSERROR_OK;
}
@@ -133,8 +130,7 @@ monkey_plot_rectangle(const struct redraw_context *ctx,
const plot_style_t *style,
const struct rect *rect)
{
- fprintf(stdout,
- "PLOT RECT X0 %d Y0 %d X1 %d Y1 %d\n",
+ moutf(MOUT_PLOT, "RECT X0 %d Y0 %d X1 %d Y1 %d",
rect->x0, rect->y0, rect->x1, rect->y1);
return NSERROR_OK;
}
@@ -160,9 +156,7 @@ monkey_plot_polygon(const struct redraw_context *ctx,
const int *p,
unsigned int n)
{
- fprintf(stdout,
- "PLOT POLYGON VERTICIES %d\n",
- n);
+ moutf(MOUT_PLOT, "POLYGON VERTICIES %d", n);
return NSERROR_OK;
}
@@ -187,8 +181,7 @@ monkey_plot_path(const struct redraw_context *ctx,
unsigned int n,
const float transform[6])
{
- fprintf(stdout,
- "PLOT PATH VERTICIES %d WIDTH %f\n",
+ moutf(MOUT_PLOT, "PATH VERTICIES %d WIDTH %f",
n, plot_style_fixed_to_float(pstyle->stroke_width));
return NSERROR_OK;
}
@@ -227,9 +220,8 @@ monkey_plot_bitmap(const struct redraw_context *ctx,
colour bg,
bitmap_flags_t flags)
{
- fprintf(stdout,
- "PLOT BITMAP X %d Y %d WIDTH %d HEIGHT %d\n",
- x, y, width, height);
+ moutf(MOUT_PLOT, "BITMAP X %d Y %d WIDTH %d HEIGHT %d",
+ x, y, width, height);
return NSERROR_OK;
}
@@ -253,9 +245,7 @@ monkey_plot_text(const struct redraw_context *ctx,
const char *text,
size_t length)
{
- fprintf(stdout,
- "PLOT TEXT X %d Y %d STR %*s\n",
- x, y, (int)length, text);
+ moutf(MOUT_PLOT, "TEXT X %d Y %d STR %*s\n", x, y, (int)length, text);
return NSERROR_OK;
}
-----------------------------------------------------------------------
Summary of changes:
frontends/gtk/login.c | 11 +-
frontends/monkey/401login.c | 15 ++-
frontends/monkey/Makefile | 2 +-
frontends/monkey/bitmap.c | 3 +-
frontends/monkey/browser.c | 144 ++++++++++++------------
frontends/monkey/cert.c | 18 +--
frontends/monkey/download.c | 13 +--
frontends/monkey/main.c | 15 +--
frontends/{riscos/assert.c => monkey/output.c} | 48 ++++----
desktop/version.c => frontends/monkey/output.h | 24 ++--
frontends/monkey/plot.c | 36 +++---
11 files changed, 175 insertions(+), 154 deletions(-)
copy frontends/{riscos/assert.c => monkey/output.c} (55%)
copy desktop/version.c => frontends/monkey/output.h (72%)
diff --git a/frontends/gtk/login.c b/frontends/gtk/login.c
index 02951aa..184ef29 100644
--- a/frontends/gtk/login.c
+++ b/frontends/gtk/login.c
@@ -258,12 +258,15 @@ create_login_window(nsurl *url,
/* exported function documented in gtk/login.h */
-nserror gui_401login_open(nsurl *url, const char *realm,
- const char *username, const char *password,
- nserror (*cb)(const char *username,
+nserror
+gui_401login_open(nsurl *url,
+ const char *realm,
+ const char *username,
+ const char *password,
+ nserror (*cb)(const char *username,
const char *password,
void *pw),
- void *cbpw)
+ void *cbpw)
{
lwc_string *host;
nserror res;
diff --git a/frontends/monkey/401login.c b/frontends/monkey/401login.c
index 58335dd..76550d8 100644
--- a/frontends/monkey/401login.c
+++ b/frontends/monkey/401login.c
@@ -21,6 +21,7 @@
#include <stdlib.h>
#include <stdio.h>
+#include "monkey/output.h"
#include "monkey/401login.h"
typedef struct monkey401 {
@@ -34,12 +35,16 @@ typedef struct monkey401 {
static monkey401_t *m4_ring = NULL;
static uint32_t m4_ctr = 0;
-nserror gui_401login_open(nsurl *url, const char *realm,
- const char *username, const char *password,
- nserror (*cb)(const char *username,
+
+nserror
+gui_401login_open(nsurl *url,
+ const char *realm,
+ const char *username,
+ const char *password,
+ nserror (*cb)(const char *username,
const char *password,
void *pw),
- void *cbpw)
+ void *cbpw)
{
monkey401_t *m4t = calloc(sizeof(*m4t), 1);
if (m4t == NULL) {
@@ -51,7 +56,7 @@ nserror gui_401login_open(nsurl *url, const char *realm,
RING_INSERT(m4_ring, m4t);
- fprintf(stdout, "401LOGIN OPEN M4 %u URL %s REALM %s\n",
+ moutf(MOUT_LOGIN, "OPEN LWIN %u URL %s REALM %s",
m4t->num, nsurl_access(url), realm);
return NSERROR_OK;
diff --git a/frontends/monkey/Makefile b/frontends/monkey/Makefile
index 27d6610..d49a6c5 100644
--- a/frontends/monkey/Makefile
+++ b/frontends/monkey/Makefile
@@ -39,7 +39,7 @@ endif
# ----------------------------------------------------------------------------
# S_MONKEY are sources purely for the MONKEY build
-S_FRONTEND := main.c filetype.c schedule.c bitmap.c plot.c browser.c \
+S_FRONTEND := main.c output.c filetype.c schedule.c bitmap.c plot.c browser.c \
download.c 401login.c cert.c layout.c dispatch.c fetch.c
diff --git a/frontends/monkey/bitmap.c b/frontends/monkey/bitmap.c
index 83b8566..e53b565 100644
--- a/frontends/monkey/bitmap.c
+++ b/frontends/monkey/bitmap.c
@@ -23,6 +23,7 @@
#include "utils/errors.h"
#include "netsurf/bitmap.h"
+#include "monkey/output.h"
#include "monkey/bitmap.h"
struct bitmap {
@@ -127,7 +128,7 @@ static int bitmap_get_height(void *bitmap)
static nserror bitmap_render(struct bitmap *bitmap,
struct hlcache_handle *content)
{
- fprintf(stdout, "GENERIC BITMAP RENDER\n");
+ moutf(MOUT_GENERIC, "BITMAP RENDER");
return NSERROR_OK;
}
diff --git a/frontends/monkey/browser.c b/frontends/monkey/browser.c
index 1fbbbf0..b93d491 100644
--- a/frontends/monkey/browser.c
+++ b/frontends/monkey/browser.c
@@ -32,6 +32,7 @@
#include "netsurf/browser_window.h"
#include "netsurf/plotters.h"
+#include "monkey/output.h"
#include "monkey/browser.h"
#include "monkey/plot.h"
@@ -42,7 +43,7 @@ static struct gui_window *gw_ring = NULL;
/* exported function documented in monkey/browser.h */
nserror monkey_warn_user(const char *warning, const char *detail)
{
- fprintf(stderr, "WARN %s %s\n", warning, detail);
+ moutf(MOUT_WARNING, "%s %s", warning, detail);
return NSERROR_OK;
}
@@ -50,14 +51,14 @@ struct gui_window *
monkey_find_window_by_num(uint32_t win_num)
{
struct gui_window *ret = NULL;
-
+
RING_ITERATE_START(struct gui_window, gw_ring, c_ring) {
if (c_ring->win_num == win_num) {
ret = c_ring;
RING_ITERATE_STOP(gw_ring, c_ring);
}
} RING_ITERATE_END(gw_ring, c_ring);
-
+
return ret;
}
@@ -77,28 +78,31 @@ gui_window_create(struct browser_window *bw,
struct gui_window *ret = calloc(sizeof(*ret), 1);
if (ret == NULL)
return NULL;
-
+
ret->win_num = win_ctr++;
ret->bw = bw;
-
+
ret->width = 800;
ret->height = 600;
-
- fprintf(stdout, "WINDOW NEW WIN %u FOR %p EXISTING %p NEWTAB %s CLONE %s\n",
- ret->win_num, bw, existing, flags & GW_CREATE_TAB ? "TRUE" : "FALSE",
- flags & GW_CREATE_CLONE ? "TRUE" : "FALSE");
- fprintf(stdout, "WINDOW SIZE WIN %u WIDTH %d HEIGHT %d\n",
- ret->win_num, ret->width, ret->height);
-
+
+ moutf(MOUT_WINDOW,
+ "NEW WIN %u FOR %p EXISTING %p NEWTAB %s CLONE %s",
+ ret->win_num, bw, existing,
+ flags & GW_CREATE_TAB ? "TRUE" : "FALSE",
+ flags & GW_CREATE_CLONE ? "TRUE" : "FALSE");
+ moutf(MOUT_WINDOW,
+ "SIZE WIN %u WIDTH %d HEIGHT %d",
+ ret->win_num, ret->width, ret->height);
+
RING_INSERT(gw_ring, ret);
-
+
return ret;
}
static void
gui_window_destroy(struct gui_window *g)
{
- fprintf(stdout, "WINDOW DESTROY WIN %u\n", g->win_num);
+ moutf(MOUT_WINDOW, "DESTROY WIN %u", g->win_num);
RING_REMOVE(gw_ring, g);
free(g);
}
@@ -106,7 +110,7 @@ gui_window_destroy(struct gui_window *g)
static void
gui_window_set_title(struct gui_window *g, const char *title)
{
- fprintf(stdout, "WINDOW TITLE WIN %u STR %s\n", g->win_num, title);
+ moutf(MOUT_WINDOW, "TITLE WIN %u STR %s", g->win_num, title);
}
/**
@@ -120,9 +124,9 @@ gui_window_set_title(struct gui_window *g, const char *title)
*/
static nserror
gui_window_get_dimensions(struct gui_window *g, int *width, int *height,
- bool scaled)
+ bool scaled)
{
- fprintf(stdout, "WINDOW GET_DIMENSIONS WIN %u WIDTH %d HEIGHT %d\n",
+ moutf(MOUT_WINDOW, "GET_DIMENSIONS WIN %u WIDTH %d HEIGHT %d",
g->win_num, g->width, g->height);
*width = g->width;
*height = g->height;
@@ -133,25 +137,25 @@ gui_window_get_dimensions(struct gui_window *g, int *width, int *height,
static void
gui_window_new_content(struct gui_window *g)
{
- fprintf(stdout, "WINDOW NEW_CONTENT WIN %u\n", g->win_num);
+ moutf(MOUT_WINDOW, "NEW_CONTENT WIN %u", g->win_num);
}
static void
gui_window_set_icon(struct gui_window *g, struct hlcache_handle *icon)
{
- fprintf(stdout, "WINDOW NEW_ICON WIN %u\n", g->win_num);
+ moutf(MOUT_WINDOW, "NEW_ICON WIN %u", g->win_num);
}
static void
gui_window_start_throbber(struct gui_window *g)
{
- fprintf(stdout, "WINDOW START_THROBBER WIN %u\n", g->win_num);
+ moutf(MOUT_WINDOW, "START_THROBBER WIN %u", g->win_num);
}
static void
gui_window_stop_throbber(struct gui_window *g)
{
- fprintf(stdout, "WINDOW STOP_THROBBER WIN %u\n", g->win_num);
+ moutf(MOUT_WINDOW, "STOP_THROBBER WIN %u", g->win_num);
}
@@ -171,7 +175,7 @@ gui_window_set_scroll(struct gui_window *gw, const struct rect *rect)
gw->scrollx = rect->x0;
gw->scrolly = rect->y0;
- fprintf(stdout, "WINDOW SET_SCROLL WIN %u X %d Y %d\n",
+ moutf(MOUT_WINDOW, "SET_SCROLL WIN %u X %d Y %d",
gw->win_num, rect->x0, rect->y0);
return NSERROR_OK;
}
@@ -187,15 +191,14 @@ gui_window_set_scroll(struct gui_window *gw, const struct rect *rect)
static nserror
monkey_window_invalidate_area(struct gui_window *gw, const struct rect *rect)
{
- fprintf(stdout, "WINDOW INVALIDATE_AREA WIN %u", gw->win_num);
-
if (rect != NULL) {
- fprintf(stdout,
- " X %d Y %d WIDTH %d HEIGHT %d\n",
- rect->x0, rect->y0,
- (rect->x1 - rect->x0), (rect->y1 - rect->y0));
+ moutf(MOUT_WINDOW,
+ "INVALIDATE_AREA WIN %u X %d Y %d WIDTH %d HEIGHT %d",
+ gw->win_num,
+ rect->x0, rect->y0,
+ (rect->x1 - rect->x0), (rect->y1 - rect->y0));
} else {
- fprintf(stdout," ALL\n");
+ moutf(MOUT_WINDOW, "INVALIDATE_AREA WIN %u ALL", gw->win_num);
}
return NSERROR_OK;
@@ -209,21 +212,21 @@ gui_window_update_extent(struct gui_window *g)
if (browser_window_get_extents(g->bw, false, &width, &height) != NSERROR_OK)
return;
- fprintf(stdout, "WINDOW UPDATE_EXTENT WIN %u WIDTH %d HEIGHT %d\n",
- g->win_num, width, height);
+ moutf(MOUT_WINDOW, "UPDATE_EXTENT WIN %u WIDTH %d HEIGHT %d",
+ g->win_num, width, height);
}
static void
gui_window_set_status(struct gui_window *g, const char *text)
{
- fprintf(stdout, "WINDOW SET_STATUS WIN %u STR %s\n", g->win_num, text);
+ moutf(MOUT_WINDOW, "SET_STATUS WIN %u STR %s", g->win_num, text);
}
static void
gui_window_set_pointer(struct gui_window *g, gui_pointer_shape shape)
{
const char *ptr_name = "UNKNOWN";
-
+
switch (shape) {
case GUI_POINTER_POINT:
ptr_name = "POINT";
@@ -285,21 +288,24 @@ gui_window_set_pointer(struct gui_window *g, gui_pointer_shape shape)
default:
break;
}
- fprintf(stdout, "WINDOW SET_POINTER WIN %u POINTER %s\n", g->win_num, ptr_name);
+
+ moutf(MOUT_WINDOW, "SET_POINTER WIN %u POINTER %s",
+ g->win_num, ptr_name);
}
static nserror
gui_window_set_url(struct gui_window *g, nsurl *url)
{
- fprintf(stdout, "WINDOW SET_URL WIN %u URL %s\n", g->win_num, nsurl_access(url));
+ moutf(MOUT_WINDOW, "SET_URL WIN %u URL %s",
+ g->win_num, nsurl_access(url));
return NSERROR_OK;
}
static bool
gui_window_get_scroll(struct gui_window *g, int *sx, int *sy)
{
- fprintf(stdout, "WINDOW GET_SCROLL WIN %u X %d Y %d\n",
- g->win_num, g->scrollx, g->scrolly);
+ moutf(MOUT_WINDOW, "GET_SCROLL WIN %u X %d Y %d",
+ g->win_num, g->scrollx, g->scrolly);
*sx = g->scrollx;
*sy = g->scrolly;
return true;
@@ -308,7 +314,7 @@ gui_window_get_scroll(struct gui_window *g, int *sx, int *sy)
static bool
gui_window_scroll_start(struct gui_window *g)
{
- fprintf(stdout, "WINDOW SCROLL_START WIN %u\n", g->win_num);
+ moutf(MOUT_WINDOW, "SCROLL_START WIN %u", g->win_num);
g->scrollx = g->scrolly = 0;
return true;
}
@@ -318,28 +324,28 @@ static void
gui_window_place_caret(struct gui_window *g, int x, int y, int height,
const struct rect *clip)
{
- fprintf(stdout, "WINDOW PLACE_CARET WIN %u X %d Y %d HEIGHT %d\n",
- g->win_num, x, y, height);
+ moutf(MOUT_WINDOW, "PLACE_CARET WIN %u X %d Y %d HEIGHT %d",
+ g->win_num, x, y, height);
}
static void
gui_window_remove_caret(struct gui_window *g)
{
- fprintf(stdout, "WINDOW REMOVE_CARET WIN %u\n", g->win_num);
+ moutf(MOUT_WINDOW, "REMOVE_CARET WIN %u", g->win_num);
}
static bool
gui_window_drag_start(struct gui_window *g, gui_drag_type type,
- const struct rect *rect)
+ const struct rect *rect)
{
- fprintf(stdout, "WINDOW SCROLL_START WIN %u TYPE %i\n", g->win_num, type);
+ moutf(MOUT_WINDOW, "SCROLL_START WIN %u TYPE %i", g->win_num, type);
return false;
}
static nserror
gui_window_save_link(struct gui_window *g, nsurl *url, const char *title)
{
- fprintf(stdout, "WINDOW SAVE_LINK WIN %u URL %s TITLE %s\n",
+ moutf(MOUT_WINDOW, "SAVE_LINK WIN %u URL %s TITLE %s",
g->win_num, nsurl_access(url), title);
return NSERROR_OK;
}
@@ -380,11 +386,11 @@ monkey_window_handle_destroy(int argc, char **argv)
{
struct gui_window *gw;
uint32_t nr = atoi((argc > 2) ? argv[2] : "-1");
-
+
gw = monkey_find_window_by_num(nr);
-
+
if (gw == NULL) {
- fprintf(stdout, "ERROR WINDOW NUM BAD\n");
+ moutf(MOUT_ERROR, "WINDOW NUM BAD");
} else {
browser_window_destroy(gw->bw);
}
@@ -397,16 +403,16 @@ monkey_window_handle_go(int argc, char **argv)
nsurl *url;
nsurl *ref_url = NULL;
nserror error;
-
+
if (argc < 4 || argc > 5) {
- fprintf(stdout, "ERROR WINDOW GO ARGS BAD\n");
+ moutf(MOUT_ERROR, "WINDOW GO ARGS BAD");
return;
}
-
+
gw = monkey_find_window_by_num(atoi(argv[2]));
-
+
if (gw == NULL) {
- fprintf(stdout, "ERROR WINDOW NUM BAD\n");
+ moutf(MOUT_ERROR, "WINDOW NUM BAD");
return;
}
@@ -446,35 +452,35 @@ monkey_window_handle_redraw(int argc, char **argv)
.background_images = true,
.plot = monkey_plotters
};
-
+
if (argc != 3 && argc != 7) {
- fprintf(stdout, "ERROR WINDOW REDRAW ARGS BAD\n");
+ moutf(MOUT_ERROR, "WINDOW REDRAW ARGS BAD");
return;
}
gw = monkey_find_window_by_num(atoi(argv[2]));
-
+
if (gw == NULL) {
- fprintf(stdout, "ERROR WINDOW NUM BAD\n");
+ moutf(MOUT_ERROR, "WINDOW NUM BAD");
return;
}
-
+
clip.x0 = 0;
clip.y0 = 0;
clip.x1 = gw->width;
clip.y1 = gw->height;
-
+
if (argc == 7) {
clip.x0 = atoi(argv[3]);
clip.y0 = atoi(argv[4]);
clip.x1 = atoi(argv[5]);
clip.y1 = atoi(argv[6]);
}
-
+
NSLOG(netsurf, INFO, "Issue redraw");
- fprintf(stdout, "WINDOW REDRAW WIN %d START\n", atoi(argv[2]));
- browser_window_redraw(gw->bw, gw->scrollx, gw->scrolly, &clip, &ctx);
- fprintf(stdout, "WINDOW REDRAW WIN %d STOP\n", atoi(argv[2]));
+ moutf(MOUT_WINDOW, "REDRAW WIN %d START", atoi(argv[2]));
+ browser_window_redraw(gw->bw, gw->scrollx, gw->scrolly, &clip, &ctx);
+ moutf(MOUT_ERROR, "REDRAW WIN %d STOP", atoi(argv[2]));
}
static void
@@ -482,13 +488,13 @@ monkey_window_handle_reload(int argc, char **argv)
{
struct gui_window *gw;
if (argc != 3 && argc != 4) {
- fprintf(stdout, "ERROR WINDOW RELOAD ARGS BAD\n");
+ moutf(MOUT_ERROR, "WINDOW RELOAD ARGS BAD\n");
}
-
+
gw = monkey_find_window_by_num(atoi(argv[2]));
-
+
if (gw == NULL) {
- fprintf(stdout, "ERROR WINDOW NUM BAD\n");
+ moutf(MOUT_ERROR, "WINDOW NUM BAD");
} else {
browser_window_reload(gw->bw, argc == 4);
}
@@ -500,7 +506,7 @@ monkey_window_handle_command(int argc, char **argv)
{
if (argc == 1)
return;
-
+
if (strcmp(argv[1], "NEW") == 0) {
monkey_window_handle_new(argc, argv);
} else if (strcmp(argv[1], "DESTROY") == 0) {
@@ -512,9 +518,9 @@ monkey_window_handle_command(int argc, char **argv)
} else if (strcmp(argv[1], "RELOAD") == 0) {
monkey_window_handle_reload(argc, argv);
} else {
- fprintf(stdout, "ERROR WINDOW COMMAND UNKNOWN %s\n", argv[1]);
+ moutf(MOUT_ERROR, "WINDOW COMMAND UNKNOWN %s\n", argv[1]);
}
-
+
}
static struct gui_window_table window_table = {
diff --git a/frontends/monkey/cert.c b/frontends/monkey/cert.c
index a199755..0827ff0 100644
--- a/frontends/monkey/cert.c
+++ b/frontends/monkey/cert.c
@@ -22,6 +22,7 @@
#include "utils/ring.h"
#include "utils/nsurl.h"
+#include "monkey/output.h"
#include "monkey/cert.h"
typedef struct monkey_cert {
@@ -36,9 +37,10 @@ static monkey_cert_t *cert_ring = NULL;
static uint32_t cert_ctr = 0;
nserror
-gui_cert_verify(nsurl *url, const struct ssl_cert_info *certs,
- unsigned long num, nserror (*cb)(bool proceed, void *pw),
- void *cbpw)
+gui_cert_verify(nsurl *url,
+ const struct ssl_cert_info *certs,
+ unsigned long num, nserror (*cb)(bool proceed, void *pw),
+ void *cbpw)
{
monkey_cert_t *m4t = calloc(sizeof(*m4t), 1);
if (m4t == NULL) {
@@ -47,13 +49,11 @@ gui_cert_verify(nsurl *url, const struct ssl_cert_info *certs,
m4t->cb = cb;
m4t->pw = cbpw;
m4t->num = cert_ctr++;
-
+
RING_INSERT(cert_ring, m4t);
-
- fprintf(stdout, "SSLCERT VERIFY CERT %u URL %s\n",
- m4t->num, nsurl_access(url));
+
+ moutf(MOUT_SSLCERT, "VERIFY CWIN %u URL %s",
+ m4t->num, nsurl_access(url));
return NSERROR_OK;
}
-
-
diff --git a/frontends/monkey/download.c b/frontends/monkey/download.c
index 5c9ce1b..1c516e3 100644
--- a/frontends/monkey/download.c
+++ b/frontends/monkey/download.c
@@ -25,6 +25,7 @@
#include "netsurf/download.h"
#include "desktop/download.h"
+#include "monkey/output.h"
#include "monkey/browser.h"
static uint32_t dwin_ctr = 0;
@@ -51,8 +52,8 @@ gui_download_window_create(download_context *ctx,
RING_INSERT(dw_ring, ret);
- fprintf(stdout, "DOWNLOAD_WINDOW CREATE DWIN %u WIN %u\n",
- ret->dwin_num, parent->win_num);
+ moutf(MOUT_DOWNLOAD, "CREATE DWIN %u WIN %u",
+ ret->dwin_num, parent->win_num);
return ret;
}
@@ -61,7 +62,7 @@ static nserror
gui_download_window_data(struct gui_download_window *dw,
const char *data, unsigned int size)
{
- fprintf(stdout, "DOWNLOAD_WINDOW DATA DWIN %u SIZE %u DATA %s\n",
+ moutf(MOUT_DOWNLOAD, "DATA DWIN %u SIZE %u DATA %s",
dw->dwin_num, size, data);
return NSERROR_OK;
}
@@ -70,15 +71,13 @@ static void
gui_download_window_error(struct gui_download_window *dw,
const char *error_msg)
{
- fprintf(stdout, "DOWNLOAD_WINDOW ERROR DWIN %u ERROR %s\n",
- dw->dwin_num, error_msg);
+ moutf(MOUT_DOWNLOAD, "ERROR DWIN %u ERROR %s", dw->dwin_num, error_msg);
}
static void
gui_download_window_done(struct gui_download_window *dw)
{
- fprintf(stdout, "DOWNLOAD_WINDOW DONE DWIN %u\n",
- dw->dwin_num);
+ moutf(MOUT_DOWNLOAD, "DONE DWIN %u", dw->dwin_num);
RING_REMOVE(dw_ring, dw);
free(dw);
}
diff --git a/frontends/monkey/main.c b/frontends/monkey/main.c
index 53cde5a..7ef4208 100644
--- a/frontends/monkey/main.c
+++ b/frontends/monkey/main.c
@@ -37,6 +37,7 @@
#include "netsurf/cookie_db.h"
#include "content/fetch.h"
+#include "monkey/output.h"
#include "monkey/dispatch.h"
#include "monkey/browser.h"
#include "monkey/cert.h"
@@ -66,7 +67,7 @@ static bool monkey_done = false;
*/
static void die(const char * const error)
{
- fprintf(stderr, "DIE %s\n", error);
+ moutf(MOUT_DIE, "%s", error);
exit(EXIT_FAILURE);
}
@@ -199,7 +200,7 @@ static void monkey_quit(void)
static nserror gui_launch_url(struct nsurl *url)
{
- fprintf(stdout, "GENERIC LAUNCH URL %s\n", nsurl_access(url));
+ moutf(MOUT_GENERIC, "LAUNCH URL %s", nsurl_access(url));
return NSERROR_OK;
}
@@ -279,7 +280,7 @@ static void monkey_run(void)
switch (schedtm) {
case -1:
NSLOG(netsurf, INFO, "Iterate blocking");
- fprintf(stdout, "GENERIC POLL BLOCKING\n");
+ moutf(MOUT_GENERIC, "POLL BLOCKING");
timeout = NULL;
break;
@@ -292,7 +293,7 @@ static void monkey_run(void)
default:
NSLOG(netsurf, INFO, "Iterate non-blocking");
- fprintf(stdout, "GENERIC POLL TIMED %d\n", schedtm);
+ moutf(MOUT_GENERIC, "POLL TIMED %d", schedtm);
tv.tv_sec = schedtm / 1000; /* miliseconds to seconds */
tv.tv_usec = (schedtm % 1000) * 1000; /* remainder to microseconds */
timeout = &tv;
@@ -392,14 +393,14 @@ main(int argc, char **argv)
die("options handler failed to register");
}
- fprintf(stdout, "GENERIC STARTED\n");
+ moutf(MOUT_GENERIC, "STARTED");
monkey_run();
- fprintf(stdout, "GENERIC CLOSING_DOWN\n");
+ moutf(MOUT_GENERIC, "CLOSING_DOWN");
monkey_kill_browser_windows();
netsurf_exit();
- fprintf(stdout, "GENERIC FINISHED\n");
+ moutf(MOUT_GENERIC, "FINISHED");
/* finalise options */
nsoption_finalise(nsoptions, nsoptions_default);
diff --git a/frontends/riscos/assert.c b/frontends/monkey/output.c
similarity index 55%
copy from frontends/riscos/assert.c
copy to frontends/monkey/output.c
index 50b8f5d..a3390ea 100644
--- a/frontends/riscos/assert.c
+++ b/frontends/monkey/output.c
@@ -1,5 +1,5 @@
/*
- * Copyright 2005 James Bursa <bursa(a)users.sourceforge.net>
+ * Copyright 2018 Vincent Sanders <vince(a)nexturf-browser.org>
*
* This file is part of NetSurf, http://www.netsurf-browser.org/
*
@@ -16,29 +16,39 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-/** \file
- * Assert reporting (RISC OS implementation).
- */
-
-#include <assert.h>
#include <stdio.h>
-#include <stdlib.h>
-#include "oslib/wimp.h"
+#include <stdarg.h>
+#include "monkey/output.h"
/**
- * Report an assert() failure and exit.
+ * output type prefixes
*/
+static const char *type_text[]={
+ "DIE",
+ "ERROR",
+ "WARN",
+ "GENERIC",
+ "WINDOW",
+ "LOGIN",
+ "SSLCERT",
+ "DOWNLOAD",
+ "PLOT",
+};
-void __assert2(const char *expr, const char *function, const char *file,
- int line)
+/* exported interface documented in monkey/output.h */
+int moutf(enum monkey_output_type mout_type, const char *fmt, ...)
{
- fprintf(stderr, "\n\"%s\", line %d: %s%sAssertion failed: %s\n",
- file, line,
- function ? function : "",
- function ? ": " : "",
- expr);
- fflush(stderr);
-
- abort();
+ va_list ap;
+ int res;
+
+ res = fprintf(stdout, "%s ", type_text[mout_type]);
+
+ va_start(ap, fmt);
+ res += vfprintf(stdout, fmt, ap);
+ va_end(ap);
+
+ fputc('\n', stdout);
+
+ return res + 1;
}
diff --git a/desktop/version.c b/frontends/monkey/output.h
similarity index 72%
copy from desktop/version.c
copy to frontends/monkey/output.h
index 387cb1f..5e77ab3 100644
--- a/desktop/version.c
+++ b/frontends/monkey/output.h
@@ -16,15 +16,21 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "testament.h"
+#ifndef NS_MONKEY_OUTPUT_H
+#define NS_MONKEY_OUTPUT_H
-#include "desktop/version.h"
+enum monkey_output_type {
+ MOUT_DIE,
+ MOUT_ERROR,
+ MOUT_WARNING,
+ MOUT_GENERIC,
+ MOUT_WINDOW,
+ MOUT_LOGIN,
+ MOUT_SSLCERT,
+ MOUT_DOWNLOAD,
+ MOUT_PLOT,
+};
+
+int moutf(enum monkey_output_type mout_type, const char *fmt, ...);
-const char * const netsurf_version = "3.9 (Dev"
-#if defined(CI_BUILD)
- " CI #" CI_BUILD
#endif
- ")"
- ;
-const int netsurf_version_major = 3;
-const int netsurf_version_minor = 9;
diff --git a/frontends/monkey/plot.c b/frontends/monkey/plot.c
index 2fc9a3c..7a84c4a 100644
--- a/frontends/monkey/plot.c
+++ b/frontends/monkey/plot.c
@@ -22,6 +22,8 @@
#include "utils/errors.h"
#include "netsurf/plotters.h"
+#include "monkey/output.h"
+
/**
* \brief Sets a clip rectangle for subsequent plot operations.
*
@@ -33,8 +35,7 @@
static nserror
monkey_plot_clip(const struct redraw_context *ctx, const struct rect *clip)
{
- fprintf(stdout,
- "PLOT CLIP X0 %d Y0 %d X1 %d Y1 %d\n",
+ moutf(MOUT_PLOT, "CLIP X0 %d Y0 %d X1 %d Y1 %d",
clip->x0, clip->y0, clip->x1, clip->y1);
return NSERROR_OK;
}
@@ -61,9 +62,8 @@ monkey_plot_arc(const struct redraw_context *ctx,
const plot_style_t *style,
int x, int y, int radius, int angle1, int angle2)
{
- fprintf(stdout,
- "PLOT ARC X %d Y %d RADIUS %d ANGLE1 %d ANGLE2 %d\n",
- x, y, radius, angle1, angle2);
+ moutf(MOUT_PLOT, "ARC X %d Y %d RADIUS %d ANGLE1 %d ANGLE2 %d",
+ x, y, radius, angle1, angle2);
return NSERROR_OK;
}
@@ -85,9 +85,7 @@ monkey_plot_disc(const struct redraw_context *ctx,
const plot_style_t *style,
int x, int y, int radius)
{
- fprintf(stdout,
- "PLOT DISC X %d Y %d RADIUS %d\n",
- x, y, radius);
+ moutf(MOUT_PLOT, "DISC X %d Y %d RADIUS %d", x, y, radius);
return NSERROR_OK;
}
@@ -108,8 +106,7 @@ monkey_plot_line(const struct redraw_context *ctx,
const plot_style_t *style,
const struct rect *line)
{
- fprintf(stdout,
- "PLOT LINE X0 %d Y0 %d X1 %d Y1 %d\n",
+ moutf(MOUT_PLOT, "LINE X0 %d Y0 %d X1 %d Y1 %d",
line->x0, line->y0, line->x1, line->y1);
return NSERROR_OK;
}
@@ -133,8 +130,7 @@ monkey_plot_rectangle(const struct redraw_context *ctx,
const plot_style_t *style,
const struct rect *rect)
{
- fprintf(stdout,
- "PLOT RECT X0 %d Y0 %d X1 %d Y1 %d\n",
+ moutf(MOUT_PLOT, "RECT X0 %d Y0 %d X1 %d Y1 %d",
rect->x0, rect->y0, rect->x1, rect->y1);
return NSERROR_OK;
}
@@ -160,9 +156,7 @@ monkey_plot_polygon(const struct redraw_context *ctx,
const int *p,
unsigned int n)
{
- fprintf(stdout,
- "PLOT POLYGON VERTICIES %d\n",
- n);
+ moutf(MOUT_PLOT, "POLYGON VERTICIES %d", n);
return NSERROR_OK;
}
@@ -187,8 +181,7 @@ monkey_plot_path(const struct redraw_context *ctx,
unsigned int n,
const float transform[6])
{
- fprintf(stdout,
- "PLOT PATH VERTICIES %d WIDTH %f\n",
+ moutf(MOUT_PLOT, "PATH VERTICIES %d WIDTH %f",
n, plot_style_fixed_to_float(pstyle->stroke_width));
return NSERROR_OK;
}
@@ -227,9 +220,8 @@ monkey_plot_bitmap(const struct redraw_context *ctx,
colour bg,
bitmap_flags_t flags)
{
- fprintf(stdout,
- "PLOT BITMAP X %d Y %d WIDTH %d HEIGHT %d\n",
- x, y, width, height);
+ moutf(MOUT_PLOT, "BITMAP X %d Y %d WIDTH %d HEIGHT %d",
+ x, y, width, height);
return NSERROR_OK;
}
@@ -253,9 +245,7 @@ monkey_plot_text(const struct redraw_context *ctx,
const char *text,
size_t length)
{
- fprintf(stdout,
- "PLOT TEXT X %d Y %d STR %*s\n",
- x, y, (int)length, text);
+ moutf(MOUT_PLOT, "TEXT X %d Y %d STR %*s\n", x, y, (int)length, text);
return NSERROR_OK;
}
--
NetSurf Browser
4 years, 2 months
netsurf-wiki: branch master updated. a67d95543484d462eeeab4ebe20e5c02cf2a5bcb
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf-wiki.git/shortlog/a67d95543484d462...
...commit http://git.netsurf-browser.org/netsurf-wiki.git/commit/a67d95543484d462ee...
...tree http://git.netsurf-browser.org/netsurf-wiki.git/tree/a67d95543484d462eeea...
The branch, master has been updated
via a67d95543484d462eeeab4ebe20e5c02cf2a5bcb (commit)
from cf4ad25530b99b103351f26dc4a8afaac4244b79 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/netsurf-wiki.git/commit/?id=a67d95543484d4...
commit a67d95543484d462eeeab4ebe20e5c02cf2a5bcb
Author: Daniel Silverstone <dsilvers(a)digital-scurf.org>
Commit: Daniel Silverstone <dsilvers(a)digital-scurf.org>
Try again to fomat
diff --git a/test/netsurf/monkey-test-plans.mdwn b/test/netsurf/monkey-test-plans.mdwn
index 7c54c76..7fef22e 100644
--- a/test/netsurf/monkey-test-plans.mdwn
+++ b/test/netsurf/monkey-test-plans.mdwn
@@ -55,163 +55,152 @@ Examples
A test will fail if NetSurf exits with a non-zero return code.
-[[!format yaml """
-title: start and stop browser
-group: basic
-steps:
-- action: launch
-- action: quit
-"""]]
+ title: start and stop browser
+ group: basic
+ steps:
+ - action: launch
+ - action: quit
There are `launch` and `quit` actions.
-[[!format yaml """
-title: start and stop browser without JS
-group: basic
-steps:
-- action: launch
- args:
- - enable_javascript=0
-- action: quit
-"""]]
+ title: start and stop browser without JS
+ group: basic
+ steps:
+ - action: launch
+ args:
+ - enable_javascript=0
+ - action: quit
Use actions to get the browser to do things.
-[[!format yaml """
-title: resource scheme
-group: basic
-steps:
-- action: launch
- language: en
-- action: window-new
- tag: win1
-- action: navigate
- window: win1
- url: resource:does-not-exist
-- action: block
- conditions:
- - window: win1
- status: complete
-- action: plot-check
- - text-contains: Not found
- - text-contains: Error 404
-- action: navigate
- window: win1
- url: resource:netsurf.png
-- action: block
- conditions:
- - window: win1
- status: complete
-- action: plot-check
- - bitmap-count: 1
-- action: window-close
- - window: win1
-- action: quit
-"""]]
+ title: resource scheme
+ group: basic
+ steps:
+ - action: launch
+ language: en
+ - action: window-new
+ tag: win1
+ - action: navigate
+ window: win1
+ url: resource:does-not-exist
+ - action: block
+ conditions:
+ - window: win1
+ status: complete
+ - action: plot-check
+ - text-contains: Not found
+ - text-contains: Error 404
+ - action: navigate
+ window: win1
+ url: resource:netsurf.png
+ - action: block
+ conditions:
+ - window: win1
+ status: complete
+ - action: plot-check
+ - bitmap-count: 1
+ - action: window-close
+ - window: win1
+ - action: quit
+
Can make multiple windows fetch stuff at the same time, without block
actions.
-[[!format yaml """
-title: simultanious page fetches
-group: real-world
-steps:
-- action: launch
- language: en
-- action: window-new
- tag: win1
-- action: window-new
- tag: win2
-- action: window-new
- tag: win3
-- action: window-new
- tag: win4
-- action: navigate
- window: win1
- url: http://www.bbc.co.uk/news
-- action: navigate
- window: win2
- url: http://www.amazon.co.uk/
-- action: navigate
- window: win3
- url: http://www.theregister.co.uk/
-- action: navigate
- window: win4
- url: http://www.arstechnica.co.uk/
-- action: block
- conditions:
- - window: *all*
- status: complete
-- action: window-close
- window: win1
-- action: window-close
- window: win2
-- action: quit
-"""]]
+ title: simultanious page fetches
+ group: real-world
+ steps:
+ - action: launch
+ language: en
+ - action: window-new
+ tag: win1
+ - action: window-new
+ tag: win2
+ - action: window-new
+ tag: win3
+ - action: window-new
+ tag: win4
+ - action: navigate
+ window: win1
+ url: http://www.bbc.co.uk/news
+ - action: navigate
+ window: win2
+ url: http://www.amazon.co.uk/
+ - action: navigate
+ window: win3
+ url: http://www.theregister.co.uk/
+ - action: navigate
+ window: win4
+ url: http://www.arstechnica.co.uk/
+ - action: block
+ conditions:
+ - window: *all*
+ status: complete
+ - action: window-close
+ window: win1
+ - action: window-close
+ window: win2
+ - action: quit
Can quit during navigate, to check cleanup in intermediate states.
Note: this requires the test to run multiple times.
-[[!format yaml """
-title: quitting mid-fetch
-group: cleanup
-steps:
-- action: repeat
- min: 0
- step: 50
- name: sleepytimer
- actions:
- - action: launch
- - action: window-new
- tag: win1
- - action: navigate
- window: win1
- url: http://www.bbc.co.uk/news
- - action: sleep-ms
- time: sleepytimer
- conditions:
- - window: win1
- status: complete
- breaks: sleepytimer
- - action: quit
-"""]]
+ title: quitting mid-fetch
+ group: cleanup
+ steps:
+ - action: repeat
+ min: 0
+ step: 50
+ name: sleepytimer
+ actions:
+ - action: launch
+ - action: window-new
+ tag: win1
+ - action: navigate
+ window: win1
+ url: http://www.bbc.co.uk/news
+ - action: sleep-ms
+ time: sleepytimer
+ conditions:
+ - window: win1
+ status: complete
+ breaks: sleepytimer
+ - action: quit
Can start and stop timers.
-[[!format yaml """
-title: cache test
-group: performance
-steps:
-- action: launch
- language: en
-- action: timer-start
- tag: timer1
-- action: window-new
- tag: win1
-- action: navigate
- window: win1
- url: http://www.bbc.co.uk/news
-- action: block
- conditions:
- - window: win1
- status: complete
-- action: timer-stop
- timer: timer1
-- action: timer-start
- tag: timer2
-- action: window-new
- tag: win2
-- action: navigate
- window: win2
- url: http://www.bbc.co.uk/news
-- action: block
- conditions:
- - window: win2
- status: complete
-- action: timer-stop
- timer: timer2
-- action: timer-check
- condition: timer2 < timer1
-- action: quit
-"""]]
+ title: cache test
+ group: performance
+ steps:
+ - action: launch
+ language: en
+ - action: timer-start
+ tag: timer1
+ - action: window-new
+ tag: win1
+ - action: navigate
+ window: win1
+ url: http://www.bbc.co.uk/news
+ - action: block
+ conditions:
+ - window: win1
+ status: complete
+ - action: timer-stop
+ timer: timer1
+ - action: timer-start
+ tag: timer2
+ - action: window-new
+ tag: win2
+ - action: navigate
+ window: win2
+ url: http://www.bbc.co.uk/news
+ - action: block
+ conditions:
+ - window: win2
+ status: complete
+ - action: timer-stop
+ timer: timer2
+ - action: timer-check
+ condition: timer2 < timer1
+ - action: quit
-----------------------------------------------------------------------
Summary of changes:
test/netsurf/monkey-test-plans.mdwn | 273 +++++++++++++++++------------------
1 file changed, 131 insertions(+), 142 deletions(-)
diff --git a/test/netsurf/monkey-test-plans.mdwn b/test/netsurf/monkey-test-plans.mdwn
index 7c54c76..7fef22e 100644
--- a/test/netsurf/monkey-test-plans.mdwn
+++ b/test/netsurf/monkey-test-plans.mdwn
@@ -55,163 +55,152 @@ Examples
A test will fail if NetSurf exits with a non-zero return code.
-[[!format yaml """
-title: start and stop browser
-group: basic
-steps:
-- action: launch
-- action: quit
-"""]]
+ title: start and stop browser
+ group: basic
+ steps:
+ - action: launch
+ - action: quit
There are `launch` and `quit` actions.
-[[!format yaml """
-title: start and stop browser without JS
-group: basic
-steps:
-- action: launch
- args:
- - enable_javascript=0
-- action: quit
-"""]]
+ title: start and stop browser without JS
+ group: basic
+ steps:
+ - action: launch
+ args:
+ - enable_javascript=0
+ - action: quit
Use actions to get the browser to do things.
-[[!format yaml """
-title: resource scheme
-group: basic
-steps:
-- action: launch
- language: en
-- action: window-new
- tag: win1
-- action: navigate
- window: win1
- url: resource:does-not-exist
-- action: block
- conditions:
- - window: win1
- status: complete
-- action: plot-check
- - text-contains: Not found
- - text-contains: Error 404
-- action: navigate
- window: win1
- url: resource:netsurf.png
-- action: block
- conditions:
- - window: win1
- status: complete
-- action: plot-check
- - bitmap-count: 1
-- action: window-close
- - window: win1
-- action: quit
-"""]]
+ title: resource scheme
+ group: basic
+ steps:
+ - action: launch
+ language: en
+ - action: window-new
+ tag: win1
+ - action: navigate
+ window: win1
+ url: resource:does-not-exist
+ - action: block
+ conditions:
+ - window: win1
+ status: complete
+ - action: plot-check
+ - text-contains: Not found
+ - text-contains: Error 404
+ - action: navigate
+ window: win1
+ url: resource:netsurf.png
+ - action: block
+ conditions:
+ - window: win1
+ status: complete
+ - action: plot-check
+ - bitmap-count: 1
+ - action: window-close
+ - window: win1
+ - action: quit
+
Can make multiple windows fetch stuff at the same time, without block
actions.
-[[!format yaml """
-title: simultanious page fetches
-group: real-world
-steps:
-- action: launch
- language: en
-- action: window-new
- tag: win1
-- action: window-new
- tag: win2
-- action: window-new
- tag: win3
-- action: window-new
- tag: win4
-- action: navigate
- window: win1
- url: http://www.bbc.co.uk/news
-- action: navigate
- window: win2
- url: http://www.amazon.co.uk/
-- action: navigate
- window: win3
- url: http://www.theregister.co.uk/
-- action: navigate
- window: win4
- url: http://www.arstechnica.co.uk/
-- action: block
- conditions:
- - window: *all*
- status: complete
-- action: window-close
- window: win1
-- action: window-close
- window: win2
-- action: quit
-"""]]
+ title: simultanious page fetches
+ group: real-world
+ steps:
+ - action: launch
+ language: en
+ - action: window-new
+ tag: win1
+ - action: window-new
+ tag: win2
+ - action: window-new
+ tag: win3
+ - action: window-new
+ tag: win4
+ - action: navigate
+ window: win1
+ url: http://www.bbc.co.uk/news
+ - action: navigate
+ window: win2
+ url: http://www.amazon.co.uk/
+ - action: navigate
+ window: win3
+ url: http://www.theregister.co.uk/
+ - action: navigate
+ window: win4
+ url: http://www.arstechnica.co.uk/
+ - action: block
+ conditions:
+ - window: *all*
+ status: complete
+ - action: window-close
+ window: win1
+ - action: window-close
+ window: win2
+ - action: quit
Can quit during navigate, to check cleanup in intermediate states.
Note: this requires the test to run multiple times.
-[[!format yaml """
-title: quitting mid-fetch
-group: cleanup
-steps:
-- action: repeat
- min: 0
- step: 50
- name: sleepytimer
- actions:
- - action: launch
- - action: window-new
- tag: win1
- - action: navigate
- window: win1
- url: http://www.bbc.co.uk/news
- - action: sleep-ms
- time: sleepytimer
- conditions:
- - window: win1
- status: complete
- breaks: sleepytimer
- - action: quit
-"""]]
+ title: quitting mid-fetch
+ group: cleanup
+ steps:
+ - action: repeat
+ min: 0
+ step: 50
+ name: sleepytimer
+ actions:
+ - action: launch
+ - action: window-new
+ tag: win1
+ - action: navigate
+ window: win1
+ url: http://www.bbc.co.uk/news
+ - action: sleep-ms
+ time: sleepytimer
+ conditions:
+ - window: win1
+ status: complete
+ breaks: sleepytimer
+ - action: quit
Can start and stop timers.
-[[!format yaml """
-title: cache test
-group: performance
-steps:
-- action: launch
- language: en
-- action: timer-start
- tag: timer1
-- action: window-new
- tag: win1
-- action: navigate
- window: win1
- url: http://www.bbc.co.uk/news
-- action: block
- conditions:
- - window: win1
- status: complete
-- action: timer-stop
- timer: timer1
-- action: timer-start
- tag: timer2
-- action: window-new
- tag: win2
-- action: navigate
- window: win2
- url: http://www.bbc.co.uk/news
-- action: block
- conditions:
- - window: win2
- status: complete
-- action: timer-stop
- timer: timer2
-- action: timer-check
- condition: timer2 < timer1
-- action: quit
-"""]]
+ title: cache test
+ group: performance
+ steps:
+ - action: launch
+ language: en
+ - action: timer-start
+ tag: timer1
+ - action: window-new
+ tag: win1
+ - action: navigate
+ window: win1
+ url: http://www.bbc.co.uk/news
+ - action: block
+ conditions:
+ - window: win1
+ status: complete
+ - action: timer-stop
+ timer: timer1
+ - action: timer-start
+ tag: timer2
+ - action: window-new
+ tag: win2
+ - action: navigate
+ window: win2
+ url: http://www.bbc.co.uk/news
+ - action: block
+ conditions:
+ - window: win2
+ status: complete
+ - action: timer-stop
+ timer: timer2
+ - action: timer-check
+ condition: timer2 < timer1
+ - action: quit
--
NetSurf Developer Wiki Backing Store
4 years, 2 months
netsurf-wiki: branch master updated. cf4ad25530b99b103351f26dc4a8afaac4244b79
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf-wiki.git/shortlog/cf4ad25530b99b10...
...commit http://git.netsurf-browser.org/netsurf-wiki.git/commit/cf4ad25530b99b1033...
...tree http://git.netsurf-browser.org/netsurf-wiki.git/tree/cf4ad25530b99b103351...
The branch, master has been updated
via cf4ad25530b99b103351f26dc4a8afaac4244b79 (commit)
from 17a60dddbf02922a2de11357038ef5c47acac6ff (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/netsurf-wiki.git/commit/?id=cf4ad25530b99b...
commit cf4ad25530b99b103351f26dc4a8afaac4244b79
Author: Daniel Silverstone <dsilvers(a)digital-scurf.org>
Commit: Daniel Silverstone <dsilvers(a)digital-scurf.org>
Try formatting
diff --git a/test/netsurf/monkey-test-plans.mdwn b/test/netsurf/monkey-test-plans.mdwn
index ae16a83..7c54c76 100644
--- a/test/netsurf/monkey-test-plans.mdwn
+++ b/test/netsurf/monkey-test-plans.mdwn
@@ -55,17 +55,17 @@ Examples
A test will fail if NetSurf exits with a non-zero return code.
-```yaml
+[[!format yaml """
title: start and stop browser
group: basic
steps:
- action: launch
- action: quit
-```
+"""]]
There are `launch` and `quit` actions.
-```yaml
+[[!format yaml """
title: start and stop browser without JS
group: basic
steps:
@@ -73,11 +73,11 @@ steps:
args:
- enable_javascript=0
- action: quit
-```
+"""]]
Use actions to get the browser to do things.
-```yaml
+[[!format yaml """
title: resource scheme
group: basic
steps:
@@ -107,13 +107,13 @@ steps:
- action: window-close
- window: win1
- action: quit
-```
+"""]]
Can make multiple windows fetch stuff at the same time, without block
actions.
-```yaml
+[[!format yaml """
title: simultanious page fetches
group: real-world
steps:
@@ -148,12 +148,12 @@ steps:
- action: window-close
window: win2
- action: quit
-```
+"""]]
Can quit during navigate, to check cleanup in intermediate states.
Note: this requires the test to run multiple times.
-```yaml
+[[!format yaml """
title: quitting mid-fetch
group: cleanup
steps:
@@ -175,11 +175,11 @@ steps:
status: complete
breaks: sleepytimer
- action: quit
-```
+"""]]
Can start and stop timers.
-```yaml
+[[!format yaml """
title: cache test
group: performance
steps:
@@ -214,4 +214,4 @@ steps:
- action: timer-check
condition: timer2 < timer1
- action: quit
-```
+"""]]
-----------------------------------------------------------------------
Summary of changes:
test/netsurf/monkey-test-plans.mdwn | 24 ++++++++++++------------
1 file changed, 12 insertions(+), 12 deletions(-)
diff --git a/test/netsurf/monkey-test-plans.mdwn b/test/netsurf/monkey-test-plans.mdwn
index ae16a83..7c54c76 100644
--- a/test/netsurf/monkey-test-plans.mdwn
+++ b/test/netsurf/monkey-test-plans.mdwn
@@ -55,17 +55,17 @@ Examples
A test will fail if NetSurf exits with a non-zero return code.
-```yaml
+[[!format yaml """
title: start and stop browser
group: basic
steps:
- action: launch
- action: quit
-```
+"""]]
There are `launch` and `quit` actions.
-```yaml
+[[!format yaml """
title: start and stop browser without JS
group: basic
steps:
@@ -73,11 +73,11 @@ steps:
args:
- enable_javascript=0
- action: quit
-```
+"""]]
Use actions to get the browser to do things.
-```yaml
+[[!format yaml """
title: resource scheme
group: basic
steps:
@@ -107,13 +107,13 @@ steps:
- action: window-close
- window: win1
- action: quit
-```
+"""]]
Can make multiple windows fetch stuff at the same time, without block
actions.
-```yaml
+[[!format yaml """
title: simultanious page fetches
group: real-world
steps:
@@ -148,12 +148,12 @@ steps:
- action: window-close
window: win2
- action: quit
-```
+"""]]
Can quit during navigate, to check cleanup in intermediate states.
Note: this requires the test to run multiple times.
-```yaml
+[[!format yaml """
title: quitting mid-fetch
group: cleanup
steps:
@@ -175,11 +175,11 @@ steps:
status: complete
breaks: sleepytimer
- action: quit
-```
+"""]]
Can start and stop timers.
-```yaml
+[[!format yaml """
title: cache test
group: performance
steps:
@@ -214,4 +214,4 @@ steps:
- action: timer-check
condition: timer2 < timer1
- action: quit
-```
+"""]]
--
NetSurf Developer Wiki Backing Store
4 years, 2 months
netsurf-wiki: branch master updated. 17a60dddbf02922a2de11357038ef5c47acac6ff
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf-wiki.git/shortlog/17a60dddbf02922a...
...commit http://git.netsurf-browser.org/netsurf-wiki.git/commit/17a60dddbf02922a2d...
...tree http://git.netsurf-browser.org/netsurf-wiki.git/tree/17a60dddbf02922a2de1...
The branch, master has been updated
via 17a60dddbf02922a2de11357038ef5c47acac6ff (commit)
from 510de7d6d33e8e21c74c54d5aa738e8d932440b1 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/netsurf-wiki.git/commit/?id=17a60dddbf0292...
commit 17a60dddbf02922a2de11357038ef5c47acac6ff
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <tlsa(a)netsurf-browser.org>
Add example test data for monkey tester.
diff --git a/test/netsurf/monkey-test-plans.mdwn b/test/netsurf/monkey-test-plans.mdwn
new file mode 100644
index 0000000..ae16a83
--- /dev/null
+++ b/test/netsurf/monkey-test-plans.mdwn
@@ -0,0 +1,217 @@
+Test plans for Monkey based NetSurf testing
+===========================================
+
+Schema
+------
+
+Top level test mapping must have:
+
+- Test `title` string.
+- Test `group` string.
+- Test `steps` sequence (of sequence step mappings).
+
+Top level test mapping might optionally have:
+
+- Test `expected-result` string. When not supplied, default is "pass".
+
+The sequence step mappings must have:
+
+- Step `action` string.
+
+Depending on the `action`, there may be other keys in the mapping for that
+specific action type.
+
+### Step action types
+
+#### `launch`
+
+Starts NetSurf.
+
+Optional parameters:
+
+`args`: sequence of strings (command line arguments).
+
+#### `quit`
+
+Exits NetSurf.
+
+
+Behaviour
+---------
+
+Standard modes of failure (unless `expected-result: fail`):
+
+- Test exits with non-zero return code.
+- NetSurf logs something at ERROR or above.
+- Leaked LWC strings on exit.
+- TODO: Maybe fail if there are any Valgrind or sanitizer errors at any point?
+
+Tests are composed of a sequence of actions, which can optionally specify
+failure conditions.
+
+
+Examples
+--------
+
+A test will fail if NetSurf exits with a non-zero return code.
+
+```yaml
+title: start and stop browser
+group: basic
+steps:
+- action: launch
+- action: quit
+```
+
+There are `launch` and `quit` actions.
+
+```yaml
+title: start and stop browser without JS
+group: basic
+steps:
+- action: launch
+ args:
+ - enable_javascript=0
+- action: quit
+```
+
+Use actions to get the browser to do things.
+
+```yaml
+title: resource scheme
+group: basic
+steps:
+- action: launch
+ language: en
+- action: window-new
+ tag: win1
+- action: navigate
+ window: win1
+ url: resource:does-not-exist
+- action: block
+ conditions:
+ - window: win1
+ status: complete
+- action: plot-check
+ - text-contains: Not found
+ - text-contains: Error 404
+- action: navigate
+ window: win1
+ url: resource:netsurf.png
+- action: block
+ conditions:
+ - window: win1
+ status: complete
+- action: plot-check
+ - bitmap-count: 1
+- action: window-close
+ - window: win1
+- action: quit
+```
+
+Can make multiple windows fetch stuff at the same time, without block
+actions.
+
+
+```yaml
+title: simultanious page fetches
+group: real-world
+steps:
+- action: launch
+ language: en
+- action: window-new
+ tag: win1
+- action: window-new
+ tag: win2
+- action: window-new
+ tag: win3
+- action: window-new
+ tag: win4
+- action: navigate
+ window: win1
+ url: http://www.bbc.co.uk/news
+- action: navigate
+ window: win2
+ url: http://www.amazon.co.uk/
+- action: navigate
+ window: win3
+ url: http://www.theregister.co.uk/
+- action: navigate
+ window: win4
+ url: http://www.arstechnica.co.uk/
+- action: block
+ conditions:
+ - window: *all*
+ status: complete
+- action: window-close
+ window: win1
+- action: window-close
+ window: win2
+- action: quit
+```
+
+Can quit during navigate, to check cleanup in intermediate states.
+Note: this requires the test to run multiple times.
+
+```yaml
+title: quitting mid-fetch
+group: cleanup
+steps:
+- action: repeat
+ min: 0
+ step: 50
+ name: sleepytimer
+ actions:
+ - action: launch
+ - action: window-new
+ tag: win1
+ - action: navigate
+ window: win1
+ url: http://www.bbc.co.uk/news
+ - action: sleep-ms
+ time: sleepytimer
+ conditions:
+ - window: win1
+ status: complete
+ breaks: sleepytimer
+ - action: quit
+```
+
+Can start and stop timers.
+
+```yaml
+title: cache test
+group: performance
+steps:
+- action: launch
+ language: en
+- action: timer-start
+ tag: timer1
+- action: window-new
+ tag: win1
+- action: navigate
+ window: win1
+ url: http://www.bbc.co.uk/news
+- action: block
+ conditions:
+ - window: win1
+ status: complete
+- action: timer-stop
+ timer: timer1
+- action: timer-start
+ tag: timer2
+- action: window-new
+ tag: win2
+- action: navigate
+ window: win2
+ url: http://www.bbc.co.uk/news
+- action: block
+ conditions:
+ - window: win2
+ status: complete
+- action: timer-stop
+ timer: timer2
+- action: timer-check
+ condition: timer2 < timer1
+- action: quit
+```
-----------------------------------------------------------------------
Summary of changes:
test/netsurf/monkey-test-plans.mdwn | 217 +++++++++++++++++++++++++++++++++++
1 file changed, 217 insertions(+)
create mode 100644 test/netsurf/monkey-test-plans.mdwn
diff --git a/test/netsurf/monkey-test-plans.mdwn b/test/netsurf/monkey-test-plans.mdwn
new file mode 100644
index 0000000..ae16a83
--- /dev/null
+++ b/test/netsurf/monkey-test-plans.mdwn
@@ -0,0 +1,217 @@
+Test plans for Monkey based NetSurf testing
+===========================================
+
+Schema
+------
+
+Top level test mapping must have:
+
+- Test `title` string.
+- Test `group` string.
+- Test `steps` sequence (of sequence step mappings).
+
+Top level test mapping might optionally have:
+
+- Test `expected-result` string. When not supplied, default is "pass".
+
+The sequence step mappings must have:
+
+- Step `action` string.
+
+Depending on the `action`, there may be other keys in the mapping for that
+specific action type.
+
+### Step action types
+
+#### `launch`
+
+Starts NetSurf.
+
+Optional parameters:
+
+`args`: sequence of strings (command line arguments).
+
+#### `quit`
+
+Exits NetSurf.
+
+
+Behaviour
+---------
+
+Standard modes of failure (unless `expected-result: fail`):
+
+- Test exits with non-zero return code.
+- NetSurf logs something at ERROR or above.
+- Leaked LWC strings on exit.
+- TODO: Maybe fail if there are any Valgrind or sanitizer errors at any point?
+
+Tests are composed of a sequence of actions, which can optionally specify
+failure conditions.
+
+
+Examples
+--------
+
+A test will fail if NetSurf exits with a non-zero return code.
+
+```yaml
+title: start and stop browser
+group: basic
+steps:
+- action: launch
+- action: quit
+```
+
+There are `launch` and `quit` actions.
+
+```yaml
+title: start and stop browser without JS
+group: basic
+steps:
+- action: launch
+ args:
+ - enable_javascript=0
+- action: quit
+```
+
+Use actions to get the browser to do things.
+
+```yaml
+title: resource scheme
+group: basic
+steps:
+- action: launch
+ language: en
+- action: window-new
+ tag: win1
+- action: navigate
+ window: win1
+ url: resource:does-not-exist
+- action: block
+ conditions:
+ - window: win1
+ status: complete
+- action: plot-check
+ - text-contains: Not found
+ - text-contains: Error 404
+- action: navigate
+ window: win1
+ url: resource:netsurf.png
+- action: block
+ conditions:
+ - window: win1
+ status: complete
+- action: plot-check
+ - bitmap-count: 1
+- action: window-close
+ - window: win1
+- action: quit
+```
+
+Can make multiple windows fetch stuff at the same time, without block
+actions.
+
+
+```yaml
+title: simultanious page fetches
+group: real-world
+steps:
+- action: launch
+ language: en
+- action: window-new
+ tag: win1
+- action: window-new
+ tag: win2
+- action: window-new
+ tag: win3
+- action: window-new
+ tag: win4
+- action: navigate
+ window: win1
+ url: http://www.bbc.co.uk/news
+- action: navigate
+ window: win2
+ url: http://www.amazon.co.uk/
+- action: navigate
+ window: win3
+ url: http://www.theregister.co.uk/
+- action: navigate
+ window: win4
+ url: http://www.arstechnica.co.uk/
+- action: block
+ conditions:
+ - window: *all*
+ status: complete
+- action: window-close
+ window: win1
+- action: window-close
+ window: win2
+- action: quit
+```
+
+Can quit during navigate, to check cleanup in intermediate states.
+Note: this requires the test to run multiple times.
+
+```yaml
+title: quitting mid-fetch
+group: cleanup
+steps:
+- action: repeat
+ min: 0
+ step: 50
+ name: sleepytimer
+ actions:
+ - action: launch
+ - action: window-new
+ tag: win1
+ - action: navigate
+ window: win1
+ url: http://www.bbc.co.uk/news
+ - action: sleep-ms
+ time: sleepytimer
+ conditions:
+ - window: win1
+ status: complete
+ breaks: sleepytimer
+ - action: quit
+```
+
+Can start and stop timers.
+
+```yaml
+title: cache test
+group: performance
+steps:
+- action: launch
+ language: en
+- action: timer-start
+ tag: timer1
+- action: window-new
+ tag: win1
+- action: navigate
+ window: win1
+ url: http://www.bbc.co.uk/news
+- action: block
+ conditions:
+ - window: win1
+ status: complete
+- action: timer-stop
+ timer: timer1
+- action: timer-start
+ tag: timer2
+- action: window-new
+ tag: win2
+- action: navigate
+ window: win2
+ url: http://www.bbc.co.uk/news
+- action: block
+ conditions:
+ - window: win2
+ status: complete
+- action: timer-stop
+ timer: timer2
+- action: timer-check
+ condition: timer2 < timer1
+- action: quit
+```
--
NetSurf Developer Wiki Backing Store
4 years, 2 months
netsurf: branch master updated. release/3.8-37-g4fcb6eb
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/4fcb6eb3016de68b4a742...
...commit http://git.netsurf-browser.org/netsurf.git/commit/4fcb6eb3016de68b4a742cd...
...tree http://git.netsurf-browser.org/netsurf.git/tree/4fcb6eb3016de68b4a742cd6b...
The branch, master has been updated
via 4fcb6eb3016de68b4a742cd6b4d2248550529deb (commit)
from 96254254a6ed491ebf8826f8e28d40425aa4f2ef (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=4fcb6eb3016de68b4a7...
commit 4fcb6eb3016de68b4a742cd6b4d2248550529deb
Author: Daniel Silverstone <dsilvers(a)digital-scurf.org>
Commit: Daniel Silverstone <dsilvers(a)digital-scurf.org>
Upgrade monkey farmer to python 3 (badly)
diff --git a/frontends/monkey/farmer.py b/frontends/monkey/farmer.py
index d4b4b1e..c79b530 100644
--- a/frontends/monkey/farmer.py
+++ b/frontends/monkey/farmer.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python3
# Copyright 2017 Daniel Silverstone <dsilvers(a)digital-scurf.org>
#
@@ -49,8 +49,8 @@ class MonkeyFarmer(asyncore.dispatcher):
monkeys.close()
- self.buffer = ""
- self.incoming = ""
+ self.buffer = b""
+ self.incoming = b""
self.lines = []
self.scheduled = []
self.deadmonkey = False
@@ -62,12 +62,12 @@ class MonkeyFarmer(asyncore.dispatcher):
def handle_read(self):
got = self.recv(8192)
- if got == "" or got is None:
+ if not got:
self.deadmonkey = True
return
self.incoming += got
- if "\n" in self.incoming:
- lines = self.incoming.split("\n")
+ if b"\n" in self.incoming:
+ lines = self.incoming.split(b"\n")
self.incoming = lines.pop()
self.lines = lines
@@ -81,12 +81,14 @@ class MonkeyFarmer(asyncore.dispatcher):
def tell_monkey(self, *args):
cmd = (" ".join(args))
if not self.quiet:
- print ">>> %s" % cmd
- self.buffer += "%s\n" % cmd
+ print(">>> {}".format(cmd))
+ cmd = cmd + "\n"
+ self.buffer += cmd.encode('utf-8')
def monkey_says(self, line):
+ line = line.decode('utf-8')
if not self.quiet:
- print "<<< %s" % line
+ print("<<< {}".format(line))
self.online(line)
def schedule_event(self, event, secs=None, when=None):
@@ -154,7 +156,7 @@ class Browser:
else:
win = self.windows.get(winid, None)
if win is None:
- print " Unknown window id %s" % winid
+ print(" Unknown window id {}".format(winid))
else:
win.handle(action, *args)
@@ -340,24 +342,30 @@ full_fname = os.path.join(os.getcwd(), fname)
browser.pass_options("--enable_javascript=0")
win.load_page("file://" + full_fname)
-print("Loaded, URL is %s" % win.url)
+print("Loaded, URL is {}".format(win.url))
cmds = win.redraw()
-print("Received %d plot commands" % len(cmds))
+print("Received {} plot commands".format(len(cmds)))
for cmd in cmds:
if cmd[0] == "TEXT":
- print "%s %s -> %s" % (cmd[2], cmd[4], (" ".join(cmd[6:])))
+ x = cmd[2]
+ y = cmd[4]
+ rest = " ".join(cmd[6:])
+ print("{} {} -> {}".format(x,y,rest))
browser.pass_options("--enable_javascript=1")
win.load_page("file://" + full_fname)
-print("Loaded, URL is %s" % win.url)
+print("Loaded, URL is {}".format(win.url))
cmds = win.redraw()
-print("Received %d plot commands" % len(cmds))
+print("Received {} plot commands".format(len(cmds)))
for cmd in cmds:
if cmd[0] == "TEXT":
- print "%s %s -> %s" % (cmd[2], cmd[4], (" ".join(cmd[6:])))
+ x = cmd[2]
+ y = cmd[4]
+ rest = " ".join(cmd[6:])
+ print("{} {} -> {}".format(x,y,rest))
browser.quit_and_wait()
-----------------------------------------------------------------------
Summary of changes:
frontends/monkey/farmer.py | 40 ++++++++++++++++++++++++----------------
1 file changed, 24 insertions(+), 16 deletions(-)
diff --git a/frontends/monkey/farmer.py b/frontends/monkey/farmer.py
index d4b4b1e..c79b530 100644
--- a/frontends/monkey/farmer.py
+++ b/frontends/monkey/farmer.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python3
# Copyright 2017 Daniel Silverstone <dsilvers(a)digital-scurf.org>
#
@@ -49,8 +49,8 @@ class MonkeyFarmer(asyncore.dispatcher):
monkeys.close()
- self.buffer = ""
- self.incoming = ""
+ self.buffer = b""
+ self.incoming = b""
self.lines = []
self.scheduled = []
self.deadmonkey = False
@@ -62,12 +62,12 @@ class MonkeyFarmer(asyncore.dispatcher):
def handle_read(self):
got = self.recv(8192)
- if got == "" or got is None:
+ if not got:
self.deadmonkey = True
return
self.incoming += got
- if "\n" in self.incoming:
- lines = self.incoming.split("\n")
+ if b"\n" in self.incoming:
+ lines = self.incoming.split(b"\n")
self.incoming = lines.pop()
self.lines = lines
@@ -81,12 +81,14 @@ class MonkeyFarmer(asyncore.dispatcher):
def tell_monkey(self, *args):
cmd = (" ".join(args))
if not self.quiet:
- print ">>> %s" % cmd
- self.buffer += "%s\n" % cmd
+ print(">>> {}".format(cmd))
+ cmd = cmd + "\n"
+ self.buffer += cmd.encode('utf-8')
def monkey_says(self, line):
+ line = line.decode('utf-8')
if not self.quiet:
- print "<<< %s" % line
+ print("<<< {}".format(line))
self.online(line)
def schedule_event(self, event, secs=None, when=None):
@@ -154,7 +156,7 @@ class Browser:
else:
win = self.windows.get(winid, None)
if win is None:
- print " Unknown window id %s" % winid
+ print(" Unknown window id {}".format(winid))
else:
win.handle(action, *args)
@@ -340,24 +342,30 @@ full_fname = os.path.join(os.getcwd(), fname)
browser.pass_options("--enable_javascript=0")
win.load_page("file://" + full_fname)
-print("Loaded, URL is %s" % win.url)
+print("Loaded, URL is {}".format(win.url))
cmds = win.redraw()
-print("Received %d plot commands" % len(cmds))
+print("Received {} plot commands".format(len(cmds)))
for cmd in cmds:
if cmd[0] == "TEXT":
- print "%s %s -> %s" % (cmd[2], cmd[4], (" ".join(cmd[6:])))
+ x = cmd[2]
+ y = cmd[4]
+ rest = " ".join(cmd[6:])
+ print("{} {} -> {}".format(x,y,rest))
browser.pass_options("--enable_javascript=1")
win.load_page("file://" + full_fname)
-print("Loaded, URL is %s" % win.url)
+print("Loaded, URL is {}".format(win.url))
cmds = win.redraw()
-print("Received %d plot commands" % len(cmds))
+print("Received {} plot commands".format(len(cmds)))
for cmd in cmds:
if cmd[0] == "TEXT":
- print "%s %s -> %s" % (cmd[2], cmd[4], (" ".join(cmd[6:])))
+ x = cmd[2]
+ y = cmd[4]
+ rest = " ".join(cmd[6:])
+ print("{} {} -> {}".format(x,y,rest))
browser.quit_and_wait()
--
NetSurf Browser
4 years, 2 months
netsurf-wiki: branch master updated. 510de7d6d33e8e21c74c54d5aa738e8d932440b1
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf-wiki.git/shortlog/510de7d6d33e8e21...
...commit http://git.netsurf-browser.org/netsurf-wiki.git/commit/510de7d6d33e8e21c7...
...tree http://git.netsurf-browser.org/netsurf-wiki.git/tree/510de7d6d33e8e21c74c...
The branch, master has been updated
via 510de7d6d33e8e21c74c54d5aa738e8d932440b1 (commit)
from 5da68c33af7045d6002df56a8d049f97a7afada5 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/netsurf-wiki.git/commit/?id=510de7d6d33e8e...
commit 510de7d6d33e8e21c74c54d5aa738e8d932440b1
Author: Daniel Silverstone <dsilvers(a)digital-scurf.org>
Commit: Daniel Silverstone <dsilvers(a)digital-scurf.org>
Notes from download discussion, and slight cleanups
diff --git a/developer-weekend/nov-2018.mdwn b/developer-weekend/nov-2018.mdwn
index df96f27..45e4675 100644
--- a/developer-weekend/nov-2018.mdwn
+++ b/developer-weekend/nov-2018.mdwn
@@ -26,9 +26,10 @@ Topics
* javascript console logging
* gtk download window
-## Monkey
+Monkey
+======
-### Vincents notes
+## Vincents notes
It would be useful if monkey could run complete page fetch tests automatically.
@@ -51,7 +52,10 @@ Extra credit things
* a coverage build
* valgrind or similar to spot out of bounds memory accesses and leaks
-### Discussion
+Discussions
+===========
+
+## Monkey
kinnison described five things that needed to be done:
@@ -92,16 +96,46 @@ be able to improve matters with the new layout engine.)
## Javascript console
-currently console output gets NSLOG under netsurf context at INFO which is a pile of pants. Daniel thinks js console should be property on browser window
+Currently console output gets NSLOG under netsurf context at INFO which is a
+both poor and unuseful. Daniel thinks that the JS console should be a property
+on `browser_window`.
-* window needs to propogate html content pointer into console object
+* `Window` needs to propagate `html_content` pointer into `Console` object on
+ creation in `Window::console()`.
* console should fire content message when logging
* browser window should consume content message (bubbling as required)
* browser window api extended to support reading and clearing console and injecting js commands to run
subsequently add interface to frontends, possibly core window
-
+## GTK Download window
+
+Many egregious function pointer related issues were found when Michael compiled
+with GCC 8. Vince wanted to point out that across all platforms, though GTK+
+especially, our handling of unknown mime types is very bad.
+
+The prevailing opinion is that behaviour ought to be more similar to firefox's
+approach, with a corewindow for handling general UI in order that the effort
+put in makes sense across all frontends.
+
+A possible API rework could be as follows:
+
+* Core says to frontend "Here, a handle to a fetch, and some metadata about it.
+ Whaddayouwant to do?"
+* Frontend either *returns* "No idea mate. abort." or "Ok, I'll deal with that."
+* In the second case, it can then present UI for "save or abort".
+* If aborting, frontend hands the handle *and* metadata back to the core for it
+ to clean up.
+* If saving, frontend calls a "OK, let's save this" handing the handle,
+ metadata and either an FD or filepath (to be decided) under which to save the
+ result.
+* The "download" core window should have UI for "cancel" and "open location"
+ type things. Progress, etc. All the goodness.
+
+As an aside, it'd be handy to have a core->frontend call which allows the core
+to get hold of a `bitmap` representing a particular mime type. This way the
+download core window might display an appropriate icon, or we might be able to
+replace empty favicons with an appropriate mime type image.
Activity
-----------------------------------------------------------------------
Summary of changes:
developer-weekend/nov-2018.mdwn | 46 ++++++++++++++++++++++++++++++++++-----
1 file changed, 40 insertions(+), 6 deletions(-)
diff --git a/developer-weekend/nov-2018.mdwn b/developer-weekend/nov-2018.mdwn
index df96f27..45e4675 100644
--- a/developer-weekend/nov-2018.mdwn
+++ b/developer-weekend/nov-2018.mdwn
@@ -26,9 +26,10 @@ Topics
* javascript console logging
* gtk download window
-## Monkey
+Monkey
+======
-### Vincents notes
+## Vincents notes
It would be useful if monkey could run complete page fetch tests automatically.
@@ -51,7 +52,10 @@ Extra credit things
* a coverage build
* valgrind or similar to spot out of bounds memory accesses and leaks
-### Discussion
+Discussions
+===========
+
+## Monkey
kinnison described five things that needed to be done:
@@ -92,16 +96,46 @@ be able to improve matters with the new layout engine.)
## Javascript console
-currently console output gets NSLOG under netsurf context at INFO which is a pile of pants. Daniel thinks js console should be property on browser window
+Currently console output gets NSLOG under netsurf context at INFO which is a
+both poor and unuseful. Daniel thinks that the JS console should be a property
+on `browser_window`.
-* window needs to propogate html content pointer into console object
+* `Window` needs to propagate `html_content` pointer into `Console` object on
+ creation in `Window::console()`.
* console should fire content message when logging
* browser window should consume content message (bubbling as required)
* browser window api extended to support reading and clearing console and injecting js commands to run
subsequently add interface to frontends, possibly core window
-
+## GTK Download window
+
+Many egregious function pointer related issues were found when Michael compiled
+with GCC 8. Vince wanted to point out that across all platforms, though GTK+
+especially, our handling of unknown mime types is very bad.
+
+The prevailing opinion is that behaviour ought to be more similar to firefox's
+approach, with a corewindow for handling general UI in order that the effort
+put in makes sense across all frontends.
+
+A possible API rework could be as follows:
+
+* Core says to frontend "Here, a handle to a fetch, and some metadata about it.
+ Whaddayouwant to do?"
+* Frontend either *returns* "No idea mate. abort." or "Ok, I'll deal with that."
+* In the second case, it can then present UI for "save or abort".
+* If aborting, frontend hands the handle *and* metadata back to the core for it
+ to clean up.
+* If saving, frontend calls a "OK, let's save this" handing the handle,
+ metadata and either an FD or filepath (to be decided) under which to save the
+ result.
+* The "download" core window should have UI for "cancel" and "open location"
+ type things. Progress, etc. All the goodness.
+
+As an aside, it'd be handy to have a core->frontend call which allows the core
+to get hold of a `bitmap` representing a particular mime type. This way the
+download core window might display an appropriate icon, or we might be able to
+replace empty favicons with an appropriate mime type image.
Activity
--
NetSurf Developer Wiki Backing Store
4 years, 2 months
netsurf: branch master updated. release/3.8-36-g9625425
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/96254254a6ed491ebf882...
...commit http://git.netsurf-browser.org/netsurf.git/commit/96254254a6ed491ebf8826f...
...tree http://git.netsurf-browser.org/netsurf.git/tree/96254254a6ed491ebf8826f8e...
The branch, master has been updated
via 96254254a6ed491ebf8826f8e28d40425aa4f2ef (commit)
via 5eb7345cc7d266dbb74534bb7510d428b58ce0a3 (commit)
from df79047cb62c26755f35083557686828849008b3 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=96254254a6ed491ebf8...
commit 96254254a6ed491ebf8826f8e28d40425aa4f2ef
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <tlsa(a)netsurf-browser.org>
GTK: Squash GCC8.2 warning.
frontends/gtk/download.c: In function ‘gui_download_window_create’:
frontends/gtk/download.c:829:10: warning: cast between incompatible function types from ‘gboolean (*)(gboolean)’ {aka ‘int (*)(int)’} to ‘gboolean (*)(void *)’ {aka ‘int (*)(void *)’} [-Wcast-function-type]
(GSourceFunc) nsgtk_download_update, FALSE);
^
diff --git a/frontends/gtk/download.c b/frontends/gtk/download.c
index c9cc1ea..3eab532 100644
--- a/frontends/gtk/download.c
+++ b/frontends/gtk/download.c
@@ -745,6 +745,16 @@ static void nsgtk_download_store_create_item (struct gui_download_window *dl)
NSGTK_DOWNLOAD, dl, -1);
}
+/**
+ * Wrapper to GSourceFunc-ify nsgtk_download_update.
+ */
+static gboolean nsgtk_download_gsourcefunc__nsgtk_download_update(
+ gpointer user_data)
+{
+ bool *force_update = user_data;
+ return nsgtk_download_update(*force_update);
+}
+
static struct gui_download_window *
gui_download_window_create(download_context *ctx, struct gui_window *gui)
{
@@ -825,8 +835,10 @@ gui_download_window_create(download_context *ctx, struct gui_window *gui)
nsgtk_download_change_status(download, NSGTK_DOWNLOAD_WORKING);
if (nsgtk_downloads_num_active == 0) {
- g_timeout_add(UPDATE_RATE,
- (GSourceFunc) nsgtk_download_update, FALSE);
+ g_timeout_add(
+ UPDATE_RATE,
+ nsgtk_download_gsourcefunc__nsgtk_download_update,
+ FALSE);
}
nsgtk_downloads_list = g_list_prepend(nsgtk_downloads_list, download);
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=5eb7345cc7d266dbb74...
commit 5eb7345cc7d266dbb74534bb7510d428b58ce0a3
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <tlsa(a)netsurf-browser.org>
GTK: Make nsgtk_download_selection_action match GFunc prototype.
Squashes GCC 8.2 warning:
frontends/gtk/download.c:244:22: warning: cast between incompatible function types
from ‘nsgtk_download_selection_action’ {aka ‘void (*)(struct gui_download_window *)’}
to ‘void (*)(void *, void *)’ [-Wcast-function-type]
g_list_foreach(dls, (GFunc)action, NULL);
^
diff --git a/frontends/gtk/download.c b/frontends/gtk/download.c
index 57f92bf..c9cc1ea 100644
--- a/frontends/gtk/download.c
+++ b/frontends/gtk/download.c
@@ -89,7 +89,9 @@ struct gui_download_window {
GError *error;
};
-typedef void (*nsgtk_download_selection_action)(struct gui_download_window *dl);
+typedef void (*nsgtk_download_selection_action)(
+ struct gui_download_window *dl,
+ void *user_data);
static GtkWindow *nsgtk_download_window, *nsgtk_download_parent;
static GtkProgressBar *nsgtk_download_progress_bar;
@@ -408,7 +410,9 @@ static gboolean nsgtk_download_update(gboolean force_update)
return TRUE;
}
-static void nsgtk_download_store_clear_item(struct gui_download_window *dl)
+static void nsgtk_download_store_clear_item(
+ struct gui_download_window *dl,
+ void *user_data)
{
if (dl->sensitivity & NSGTK_DOWNLOAD_CLEAR) {
nsgtk_downloads_list = g_list_remove(nsgtk_downloads_list, dl);
@@ -465,7 +469,9 @@ static void nsgtk_download_change_status (
}
}
-static void nsgtk_download_store_cancel_item (struct gui_download_window *dl)
+static void nsgtk_download_store_cancel_item (
+ struct gui_download_window *dl,
+ void *user_data)
{
if (dl->sensitivity & NSGTK_DOWNLOAD_CANCEL) {
dl->speed = 0;
@@ -871,7 +877,7 @@ static void gui_download_window_done(struct gui_download_window *dw)
nsgtk_download_change_status(dw, NSGTK_DOWNLOAD_COMPLETE);
if (nsoption_bool(downloads_clear))
- nsgtk_download_store_clear_item(dw);
+ nsgtk_download_store_clear_item(dw, NULL);
else
nsgtk_download_update(TRUE);
}
-----------------------------------------------------------------------
Summary of changes:
frontends/gtk/download.c | 30 ++++++++++++++++++++++++------
1 file changed, 24 insertions(+), 6 deletions(-)
diff --git a/frontends/gtk/download.c b/frontends/gtk/download.c
index 57f92bf..3eab532 100644
--- a/frontends/gtk/download.c
+++ b/frontends/gtk/download.c
@@ -89,7 +89,9 @@ struct gui_download_window {
GError *error;
};
-typedef void (*nsgtk_download_selection_action)(struct gui_download_window *dl);
+typedef void (*nsgtk_download_selection_action)(
+ struct gui_download_window *dl,
+ void *user_data);
static GtkWindow *nsgtk_download_window, *nsgtk_download_parent;
static GtkProgressBar *nsgtk_download_progress_bar;
@@ -408,7 +410,9 @@ static gboolean nsgtk_download_update(gboolean force_update)
return TRUE;
}
-static void nsgtk_download_store_clear_item(struct gui_download_window *dl)
+static void nsgtk_download_store_clear_item(
+ struct gui_download_window *dl,
+ void *user_data)
{
if (dl->sensitivity & NSGTK_DOWNLOAD_CLEAR) {
nsgtk_downloads_list = g_list_remove(nsgtk_downloads_list, dl);
@@ -465,7 +469,9 @@ static void nsgtk_download_change_status (
}
}
-static void nsgtk_download_store_cancel_item (struct gui_download_window *dl)
+static void nsgtk_download_store_cancel_item (
+ struct gui_download_window *dl,
+ void *user_data)
{
if (dl->sensitivity & NSGTK_DOWNLOAD_CANCEL) {
dl->speed = 0;
@@ -739,6 +745,16 @@ static void nsgtk_download_store_create_item (struct gui_download_window *dl)
NSGTK_DOWNLOAD, dl, -1);
}
+/**
+ * Wrapper to GSourceFunc-ify nsgtk_download_update.
+ */
+static gboolean nsgtk_download_gsourcefunc__nsgtk_download_update(
+ gpointer user_data)
+{
+ bool *force_update = user_data;
+ return nsgtk_download_update(*force_update);
+}
+
static struct gui_download_window *
gui_download_window_create(download_context *ctx, struct gui_window *gui)
{
@@ -819,8 +835,10 @@ gui_download_window_create(download_context *ctx, struct gui_window *gui)
nsgtk_download_change_status(download, NSGTK_DOWNLOAD_WORKING);
if (nsgtk_downloads_num_active == 0) {
- g_timeout_add(UPDATE_RATE,
- (GSourceFunc) nsgtk_download_update, FALSE);
+ g_timeout_add(
+ UPDATE_RATE,
+ nsgtk_download_gsourcefunc__nsgtk_download_update,
+ FALSE);
}
nsgtk_downloads_list = g_list_prepend(nsgtk_downloads_list, download);
@@ -871,7 +889,7 @@ static void gui_download_window_done(struct gui_download_window *dw)
nsgtk_download_change_status(dw, NSGTK_DOWNLOAD_COMPLETE);
if (nsoption_bool(downloads_clear))
- nsgtk_download_store_clear_item(dw);
+ nsgtk_download_store_clear_item(dw, NULL);
else
nsgtk_download_update(TRUE);
}
--
NetSurf Browser
4 years, 2 months
netsurf-wiki: branch master updated. 5da68c33af7045d6002df56a8d049f97a7afada5
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf-wiki.git/shortlog/5da68c33af7045d6...
...commit http://git.netsurf-browser.org/netsurf-wiki.git/commit/5da68c33af7045d600...
...tree http://git.netsurf-browser.org/netsurf-wiki.git/tree/5da68c33af7045d6002d...
The branch, master has been updated
via 5da68c33af7045d6002df56a8d049f97a7afada5 (commit)
via 5ca8878a0feac4636c2f5e2abc3cfa304330861b (commit)
from 642822cf396c3dca7f165ed1bd37572627de4a83 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/netsurf-wiki.git/commit/?id=5da68c33af7045...
commit 5da68c33af7045d6002df56a8d049f97a7afada5
Author: Vincent Sanders <vince(a)kyllikki.org>
Commit: Vincent Sanders <vince(a)kyllikki.org>
add js console discussion
diff --git a/developer-weekend/nov-2018.mdwn b/developer-weekend/nov-2018.mdwn
index 3eb0d81..df96f27 100644
--- a/developer-weekend/nov-2018.mdwn
+++ b/developer-weekend/nov-2018.mdwn
@@ -62,7 +62,7 @@ kinnison described five things that needed to be done:
* events from the core browser window to frontends
-### Corewindow for browser window change requirements
+## Corewindow for browser window change requirements
Everything except browser window has been moved over to corewindow.
@@ -90,6 +90,19 @@ So front ends will only know about scale for e.g. saying scale in the title
bar. All the complexity will move to browser_window. (For now; we should
be able to improve matters with the new layout engine.)
+## Javascript console
+
+currently console output gets NSLOG under netsurf context at INFO which is a pile of pants. Daniel thinks js console should be property on browser window
+
+* window needs to propogate html content pointer into console object
+* console should fire content message when logging
+* browser window should consume content message (bubbling as required)
+* browser window api extended to support reading and clearing console and injecting js commands to run
+
+subsequently add interface to frontends, possibly core window
+
+
+
Activity
========
commitdiff http://git.netsurf-browser.org/netsurf-wiki.git/commit/?id=5ca8878a0feac4...
commit 5ca8878a0feac4636c2f5e2abc3cfa304330861b
Author: Vincent Sanders <vince(a)kyllikki.org>
Commit: Vincent Sanders <vince(a)kyllikki.org>
add adressed bug
diff --git a/developer-weekend/nov-2018.mdwn b/developer-weekend/nov-2018.mdwn
index 2cda3a2..3eb0d81 100644
--- a/developer-weekend/nov-2018.mdwn
+++ b/developer-weekend/nov-2018.mdwn
@@ -98,6 +98,8 @@ Bug Triage
----------
* Group bug for line breaking issues is [[!bug 467]]
+* Addressed reported FTBFS error [[!bug 2627]]
+
Daniel
------
-----------------------------------------------------------------------
Summary of changes:
developer-weekend/nov-2018.mdwn | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)
diff --git a/developer-weekend/nov-2018.mdwn b/developer-weekend/nov-2018.mdwn
index 2cda3a2..df96f27 100644
--- a/developer-weekend/nov-2018.mdwn
+++ b/developer-weekend/nov-2018.mdwn
@@ -62,7 +62,7 @@ kinnison described five things that needed to be done:
* events from the core browser window to frontends
-### Corewindow for browser window change requirements
+## Corewindow for browser window change requirements
Everything except browser window has been moved over to corewindow.
@@ -90,6 +90,19 @@ So front ends will only know about scale for e.g. saying scale in the title
bar. All the complexity will move to browser_window. (For now; we should
be able to improve matters with the new layout engine.)
+## Javascript console
+
+currently console output gets NSLOG under netsurf context at INFO which is a pile of pants. Daniel thinks js console should be property on browser window
+
+* window needs to propogate html content pointer into console object
+* console should fire content message when logging
+* browser window should consume content message (bubbling as required)
+* browser window api extended to support reading and clearing console and injecting js commands to run
+
+subsequently add interface to frontends, possibly core window
+
+
+
Activity
========
@@ -98,6 +111,8 @@ Bug Triage
----------
* Group bug for line breaking issues is [[!bug 467]]
+* Addressed reported FTBFS error [[!bug 2627]]
+
Daniel
------
--
NetSurf Developer Wiki Backing Store
4 years, 2 months