summaryrefslogtreecommitdiff
path: root/Docs/USING-Monkey
blob: 33e50423915daf77b5a45e46418613d1f071da78 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
--------------------------------------------------------------------------------
  Usage Instructions for Monkey NetSurf                            13 March 2011
--------------------------------------------------------------------------------

  This document provides usage instructions for the Monkey version of 
  NetSurf.

  Monkey NetSurf has been tested on Ubuntu.

Overview
========

  What it is
  ----------

  The NetSurf Monkey front end is a developer debug tool used to
  test how the core interacts with the user interface.  It allows
  the developers to profile NetSurf and to interact with the core
  directly as though the developer were a front end.
 
  What it is not
  --------------

  Monkey is not a tool for building web-crawling robots or indeed
  anything other than a debug tool for the NetSurf developers.

  How to interact with nsmonkey
  -----------------------------

  In brief, monkey will produce tagged output on stdout and expect
  commands on stdin.  Windows are numbered and for the most part
  tokens are space separated.  In some cases (e.g. title or status)
  the final element on the output line is a string which might have
  spaces embedded within it.  As such, output from nsmonkey should be
  parsed a token at a time, so that when such a string is encountered,
  the parser can stop splitting and return the rest.

  Commands to Monkey are namespaced.  For example commands related to
  browser windows are prefixed by WINDOW.

  Top level tags for nsmonkey
  ---------------------------

    QUIT

    WINDOW

  Top level response tags for nsmonkey
  ------------------------------------

    GENERIC

    WARN, ERROR, DIE

    WINDOW

    DOWNLOAD_WINDOW

    SSLCERT

    401LOGIN

    PLOT

  In the below, %something% indicates a substitution made by Monkey.

    %url% will be a URL
    %id% will be an opaque ID
    %n% will be a number
    %bool% will be TRUE or FALSE
    %str% is a string and will only ever be at the end of an output line.

  Warnings, errors etc
  --------------------

  Warnings (tagged WARN) come from the NetSurf core.
  Errors (tagged ERROR) tend to come from Monkey's parsers
  Death (tagged DIE) comes from the core and kills Monkey dead.

Commands
========

  Generic commands
  ----------------

  QUIT
    Cause monkey to quit cleanly.
    This will cleanly destroy open windows etc.

  Window commands
  ---------------

  WINDOW NEW [%url%]
    Create a new browser window, optionally giving the core
    a URL to immediately navigate to.
    Minimally you will receive a WINDOW NEW WIN %id% response.

  WINDOW DESTROY %id%
    Destroy the given browser window.
    Minimally you will recieve a WINDOW DESTROY WIN %id% response.

  WINDOW GO %id% %url% [%url%]
    Cause the given browser window to visit the given URL.
    Optionally you can give a referrer URL to also use (simulating
    a click in the browser on a link).
    Minimally you can expect throbber, url etc responses.

  WINDOW REDRAW %id% [%num% %num% %num% %num%]
    Cause a browser window to redraw.  Optionally you can give a
    set of coordinates to simulate a partial expose of the window.
    Said coordinates are in traditional X0 Y0 X1 Y1 order.
    The coordinates are in canvas, not window, coordinates.  So you
    should take into account the scroll offsets when issuing this
    command.
    Minimally you can expect redraw start/stop messages and you
    can likely expect some number of PLOT results.

  WINDOW RELOAD %id%
    Cause a browser window to reload its current content.
    Expect responses similar to a GO command.


Responses
=========

  Generic messages
  ----------------

  GENERIC STARTED
    Monkey has started and is ready for commands

  GENERIC CLOSING_DOWN
    Monkey has been told to shut down and is doing so

  GENERIC FINISHED
    Monkey has finished and will now exit

  GENERIC LAUNCH URL %url%
    The core asked monkey to launch the given URL

  GENERIC THUMBNAIL URL %url%
    The core asked monkey to thumbnail a content without
    a window.

  GENERIC POLL BLOCKING
    Monkey reached a point where it could sleep waiting for
    commands or scheduled timeouts.  No fetches nor redraws
    were pending.

  Window messages
  ---------------

  WINDOW NEW WIN %id% FOR %id% CLONE %id% NEWTAB %bool%
    The core asked Monkey to open a new window.  The IDs for 'FOR' and
    'CLONE' are core window IDs, the WIN id is a Monkey window ID.

  WINDOW SIZE WIN %id% WIDTH %n% HEIGHT %n%
    The window specified has been set to the shown width and height.

  WINDOW DESTROY WIN %id%
    The core has instructed Monkey to destroy the named window.

  WINDOW TITLE WIN %id% STR %str%
    The core supplied a titlebar title for the given window.

  WINDOW REDRAW WIN %id%
    The core asked that Monkey redraw the given window.

  WINDOW GET_DIMENSIONS WIN %id% WIDTH %n% HEIGHT %n%
    The core asked Monkey what the dimensions of the window are.
    Monkey has to respond immediately and returned the supplied width
    and height values to the core.

  WINDOW NEW_CONTENT WIN %id%
    The core has informed Monkey that the named window has a new
    content object.

  WINDOW NEW_ICON WIN %id%
    The core has informed Monkey that the named window hsa a new
    icon (favicon) available.

  WINDOW START_THROBBER WIN %id%
    The core asked Monkey to start the throbber for the named
    window.  This indicates to the user that the window is busy.

  WINDOW STOP_THROBBER WIN %id%
    The core asked Monkey to stop the throbber for the named
    window.  This indicates to the user that the window is finished.

  WINDOW SET_SCROLL WIN %id% X %n% Y %n%
    The core asked Monkey to set the named window's scroll offsets
    to the given X and Y position.

  WINDOW UPDATE_BOX WIN %id% X %n% Y %n% WIDTH %n% HEIGHT %n%
    The core asked Monkey to redraw the given portion of the content
    display.  Note these coordinates refer to the content, not the
    viewport which Monkey is simulating.

  WINDOW UPDATE_EXTENT WIN %id% WIDTH %n% HEIGHT %n%
    The core has told us that the content in the given window has a
    total width and height as shown.  This allows us (along with the
    window's width and height) to know the scroll limits.
    
  WINDOW SET_STATUS WIN %id% STR %str%
    The core has told us that the given window needs its status bar
    updating with the given message.

  WINDOW SET_POINTER WIN %id% POINTER %id%
    The core has told us to update the mouse pointer for the given
    window to the given pointer ID.

  WINDOW SET_SCALE WIN %id% SCALE %n%
    The core has asked us to scale the given window by the given scale
    factor.

  WINDOW SET_URL WIN %id% URL %url%
    The core has informed us that the given window's URL bar needs
    updating to the given url.

  WINDOW GET_SCROLL WIN %id% X %n% Y %n%
    The core asked Monkey for the scroll offsets.  Monkey returned the
    numbers shown for the window named.

  WINDOW SCROLL_START WIN %id%
    The core asked Monkey to scroll the named window to the top/left.

  WINDOW POSITION_FRAME WIN %id% X0 %n% Y0 %n% X1 %n% Y1 %n%
    The core asked Monkey to position the named window as a frame at
    the given coordinates of its parent.

  WINDOW SCROLL_VISIBLE WIN %id% X0 %n% Y0 %n% X1 %n% Y1 %n%
    The core asked Monkey to scroll the named window until the
    indicated box is visible.

  WINDOW PLACE_CARET WIN %id% X %n% Y %n% HEIGHT %n% 
    The core asked Monkey to render a caret in the named window at the
    indicated position with the indicated height.

  WINDOW REMOVE_CARET WIN %id%
    The core asked Monkey to remove any caret in the named window.

  WINDOW SCROLL_START WIN %id% X0 %n% Y0 %n% X1 %n% Y1 %n%
    The core asked Monkey to scroll the named window to the start of
    the given box.

  WINDOW SELECT_MENU WIN %id%
    The core asked Monkey to produce a selection menu for the named
    window.

  WINDOW SAVE_LINK WIN %id% URL %url% TITLE %str%
    The core asked Monkey to save a link from the given window with
    the given URL and anchor title.

  WINDOW THUMBNAIL WIN %id% URL %url%
    The core asked Monkey to render a thumbnail for the given window
    which is currently at the given URL.

  WINDOW REDRAW WIN %id% START
  WINDOW REDRAW WIN %id% STOP
    The core wraps redraws in these messages.  Thus PLOT responses can
    be allocated to the appropriate window.

  Download window messages
  ------------------------

  DOWNLOAD_WINDOW CREATE DWIN %id% WIN %id%
    The core asked Monkey to create a download window owned by the
    given browser window.

  DOWNLOAD_WINDOW DATA DWIN %id% SIZE %n% DATA %str%
    The core asked Monkey to update the named download window with
    the given byte size and data string.

  DOWNLOAD_WINDOW ERROR DWIN %id% ERROR %str%
    The core asked Monkey to update the named download window with
    the given error message.

  DOWNLOAD_WINDOW DONE DWIN %id%
    The core asked Monkey to destroy the named download window.

  SSL Certificate messages
  ------------------------

  SSLCERT VERIFY CERT %id% URL %url%
    The core asked Monkey to say whether or not a given SSL
    certificate is OK.

  401 Login messages
  ------------------

  401LOGIN OPEN M4 %id% URL %url% REALM %str%
    The core asked Monkey to ask for identification for the named
    realm at the given URL.

  Plotter messages
  ----------------

  Note, Monkey won't clip coordinates, but sometimes the core does.

  PLOT CLIP X0 %n% Y0 %n% X1 %n% Y1 %n%
    The core asked Monkey to clip plotting to the given clipping
    rectangle (X0,Y0) (X1,Y1)

  PLOT TEXT X %n% Y %n% STR %str%
    The core asked Monkey to plot the given string at the
    given coordinates.

  PLOT LINE X0 %n% Y0 %n% X1 %n% Y1 %n%
    The core asked Monkey to plot a line with the given start
    and end coordinates.

  PLOT RECT X0 %n% Y0 %n% X1 %n% Y1 %n%
    The core asked Monkey to plot a rectangle with the given
    coordinates as the corners.

  PLOT BITMAP X %n% Y %n% WIDTH %n% HEIGHT %n%
    The core asked Monkey to plot a bitmap at the given
    coordinates, scaled to the given width/height.