Commit a91dba3d authored by Andrew Hodgkinson's avatar Andrew Hodgkinson
Browse files

Huge pile of changes bringing relatively ancient sources up to date.

Detail:
  This check-in includes Phoenix version 2.11 (26-Apr-2005); only the
  debug and JavaScript builds of Phoenix have been tested and resources
  will definitely be out of date for other versions. The various "!..."
  scripts have been updated to require a minimum of 2MB with no maximum
  limit for building, as CC 5.60 is quite RAM hungry.
Admin:
  Phoenix 2.11 JS builds OK, works reasonably well. Many outstanding
  issues of course, as this is a very outdated browser now.

Version 2.09. Tagged as 'Browse-2_09'
parent 15db9127
......@@ -3,4 +3,3 @@ awk/** gitlab-language=awk linguist-language=awk linguist-detectable=true
*,ffb gitlab-language=bbcbasic linguist-language=bbcbasic linguist-detectable=true
c/** gitlab-language=c linguist-language=c linguist-detectable=true
h/** gitlab-language=c linguist-language=c linguist-detectable=true
**/h/** gitlab-language=c linguist-language=c linguist-detectable=true
/* Copyright 1997 Acorn Computers Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* File : URI.h
* Purpose : C interface to URI handler
* Author : Ben Laughton
* History : BAL 16/04/97: Started
* ADH 13/06/97: Extended and tidied
*/
#ifndef _uri_h
#define _uri_h
#include "kernel.h"
#include <stddef.h>
/* URI handler SWI numbers */
#define URI_SWIChunkBase 0x4e380
#define URI_Version (URI_SWIChunkBase + 0)
#define URI_Dispatch (URI_SWIChunkBase + 1)
#define URI_RequestURI (URI_SWIChunkBase + 2)
#define URI_InvalidateURI (URI_SWIChunkBase + 3)
/* URI handler service call number and reason codes */
#define Service_URI 0xa7
#define Service_URI_Started 0
#define Service_URI_Dying 1
#define Service_URI_Check 2
#define Service_URI_Process 3
/* URI handler WIMP messages */
#define URI_MStarted 0x4e380
#define URI_MDying 0x4e381
#define URI_MCheck 0x4e382
#define URI_MProcess 0x4e382
#define URI_MReturnResult 0x4e383
#define URI_MProcessAck 0x4e384
/* URI file type */
#define URI_FileType 0xf91
/* Input flags for SWI URI_Dispatch */
#define URI_Dispatch_Inform 0x00000001
#define URI_Dispatch_Check 0x00000002
#define URI_Dispatch_ActiveOnly 0x00000004
/* Return values for SWI URI_Dispatch */
#define URI_Dispatch_RequestAccepted 0
/* Constants for SWI URI_RequestURI */
#define URI_RequestURI_GetSize NULL
/* Data structures for URI handler messages */
typedef struct URI_block *URI_handle_t;
typedef struct
{
union
{
struct
{
unsigned int not_defined:32; /* No flags defined for this yet */
}
bits;
unsigned int data;
}
flags;
} URIStartedMessage;
typedef struct
{
union
{
struct
{
unsigned int not_defined:32; /* No flags defined for this yet */
}
bits;
unsigned int data;
}
flags;
} URIDyingMessage;
typedef struct
{
union
{
struct
{
unsigned int check :1;
}
bits;
unsigned int data;
}
flags;
char *uri;
URI_handle_t uri_handle;
} URIProcessMessage,
URIProcessAckMessage;
typedef struct
{
union
{
struct
{
unsigned int not_claimed :1;
}
bits;
unsigned int data;
}
flags;
URI_handle_t uri_handle;
} URIReturnResultMessage;
/* Function prototypes for URI handler SWIs */
/* uri_version
*
* Inquire the version number of the URI handler
*
* Inputs
* flags : flags word
*
* Outputs
* version : version number of the URI handler (major version * 100) + minor version
*
* Returns
* success : NULL
* failure : pointer to standard error block
*/
extern _kernel_oserror * uri_version (unsigned int flags, int * version);
/* uri_dispatch
*
* Dispatch a URI or check whether URI can be handled
*
* Inputs
* in_flags : flags word
* uri : pointer to 0 terminated URI
* source_task_handle : source task handle
*
* Outputs
* return_code : return value
* uri_task_handle : task handle of URI handler
* uri_handle : URI handle
*
* Returns
* success : NULL
* failure : pointer to standard error block
*/
extern _kernel_oserror * uri_dispatch (unsigned int in_flags, char * uri,
int source_task_handle, unsigned int * return_code,
int * uri_task_handle, URI_handle_t * uri_handle);
/* uri_request_uri
*
* Get a URI from the URI handler or check the size of buffer needed to store the URI
*
* Inputs
* flags : flags word
* uri : pointer to buffer to store URI or 0 to inquire size
* buffer_size : size of buffer
* uri_handle : URI handle
*
* Outputs
* uri_length : offset into buffer of 0 terminator or required size of buffer
*
* Returns
* success : NULL
* failure : pointer to standard error block
*/
extern _kernel_oserror * uri_request_uri (unsigned int flags, char * uri, int buffer_size,
URI_handle_t uri_handle, int * uri_length);
/* uri_invalidate_uri
*
* Mark a URI as invalid
*
* Inputs
* flags : flags word
* uri_handle : URI handle
*
* Returns
* success : NULL
* failure : pointer to standard error block
*/
extern _kernel_oserror * uri_invalidate_uri (unsigned int flags, URI_handle_t uri_handle);
#endif /* From #ifndef _uri_h */
File deleted
No preview for this file type
/* (2.08)
/* (2.09)
*
* This file is automatically maintained by srccommit, do not edit manually.
* Last processed by srccommit version: 1.2.
*
*/
#define Module_MajorVersion_CMHG 2.08
#define Module_MajorVersion_CMHG 2.09
#define Module_MinorVersion_CMHG
#define Module_Date_CMHG 14 Nov 2000
#define Module_Date_CMHG 26 Apr 2005
#define Module_MajorVersion "2.08"
#define Module_Version 208
#define Module_MajorVersion "2.09"
#define Module_Version 209
#define Module_MinorVersion ""
#define Module_Date "14 Nov 2000"
#define Module_Date "26 Apr 2005"
#define Module_ApplicationDate2 "14-Nov-00"
#define Module_ApplicationDate4 "14-Nov-2000"
#define Module_ApplicationDate "26-Apr-05"
#define Module_ComponentName "Browse"
#define Module_ComponentPath "RiscOS/Sources/Apps/Browse"
#define Module_FullVersion "2.08"
#define Module_HelpVersion "2.08 (14 Nov 2000)"
#define Module_FullVersion "2.09"
#define Module_HelpVersion "2.09 (26 Apr 2005)"
#define Module_LibraryVersionInfo "2:9"
......@@ -2141,7 +2141,7 @@ int browser_pointer_check(int eventcode, WimpPollBlock * b, IdBlock * idb, brows
{
int nx, ny;
/* Find out which pixel we clicked on */
/* Find out which pixel the pointer is over */
ChkError(image_return_click_offset(handle, tp, &p, &nx, &ny));
......@@ -2243,8 +2243,11 @@ int browser_pointer_check(int eventcode, WimpPollBlock * b, IdBlock * idb, brows
if (!dealt_with)
{
handle->pointer_over = NULL;
mouse_set_pointer_shape(Mouse_Shape_Normal);
if (handle->pointer_over != NULL)
{
handle->pointer_over = NULL;
mouse_set_pointer_shape(Mouse_Shape_Normal);
}
}
}
......@@ -2256,8 +2259,11 @@ int browser_pointer_check(int eventcode, WimpPollBlock * b, IdBlock * idb, brows
mouse_set_pointer_shape(Mouse_Shape_Link);
else
{
handle->pointer_over = NULL;
mouse_set_pointer_shape(Mouse_Shape_Normal);
if (handle->pointer_over != NULL)
{
mouse_set_pointer_shape(Mouse_Shape_Normal);
handle->pointer_over = NULL;
}
}
}
......@@ -2427,7 +2433,7 @@ static HStream * browser_get_pointer_token_r(browser_data * b, reformat_cell * c
#ifdef TRACE
{
static tracelastchunk = -1;
static int tracelastchunk = -1;
if (tracelastchunk != cell->ldata[line].chunks + n)
{
......@@ -4311,15 +4317,19 @@ int browser_check_visible(browser_data * b, WimpGetWindowStateBlock * state, HSt
/* Parameters: Pointer to a browser_data struct relevant to */
/* the window; */
/* */
/* Pointer to the anchor name. */
/* Pointer to the anchor name; */
/* */
/* 1 to suppress warnings if the anchor is not */
/* found on the page, else 0. */
/**************************************************************/
void browser_show_named_anchor(browser_data * b, char * anchor)
void browser_show_named_anchor(browser_data * b, char * anchor, int suppress_error)
{
char name[Limits_NamedAnchor];
memset(name, 0, sizeof(name));
strncpy(name, anchor, sizeof(name) - 2);
name[sizeof(name) - 2] = '\0';
if (
!browser_show_token(b,
......@@ -4339,6 +4349,8 @@ void browser_show_named_anchor(browser_data * b, char * anchor)
fetch_find_anchor_token(b, name),
0,
0)
&& suppress_error == 0
)
{
erb.errnum = Utils_Error_Custom_Message;
......@@ -4384,7 +4396,10 @@ void browser_show_named_anchor(browser_data * b, char * anchor)
/* the reference; */
/* */
/* Pointer to the base URL against which the */
/* first is compared. */
/* first is compared; */
/* */
/* 1 to suppress warnings if the anchor is not */
/* found on the page, else 0. */
/* */
/* Returns: 1 if the reference is to be shown (though if */
/* the reference may not actually be found on the */
......@@ -4398,7 +4413,7 @@ void browser_show_named_anchor(browser_data * b, char * anchor)
/* must be able to write to the URL data. */
/**************************************************************/
int browser_display_local_reference(browser_data * b, char * url_requested, char * url_current)
int browser_display_local_reference(browser_data * b, char * url_requested, char * url_current, int suppress_error)
{
char * p1, * p2;
......@@ -4429,7 +4444,7 @@ int browser_display_local_reference(browser_data * b, char * url_requested, char
/* Otherwise, show the reference */
browser_show_named_anchor(b, p1 + 1);
browser_show_named_anchor(b, p1 + 1, suppress_error);
return 1;
}
......
......@@ -50,7 +50,7 @@
/* Statics */
static ObjectId menu_id = NULL_ObjectId;
static int ticked_encoding = 0xffffffff;
static int ticked_encoding = (int) 0xffffffff;
static int entries_faded;
static int encoding_get_encoding_item_r(ObjectId o, int encoding, ObjectId *encobjid, ComponentId *enccompid);
......
......@@ -52,14 +52,7 @@
#include "EventLogs.h"
/* Local definitions; default type is 1 for log by URLs, 0 for by */
/* browser windows, and default display is 1 for titles, 0 for URLs. */
/* The last item enables (1) or disables (0) the master log. */
#define EventLogs_DefaultList (EventLogs_Log_HTTPMessages | EventLogs_Log_ScriptInformation)
#define EventLogs_DefaultType (1)
#define EventLogs_DefaultDisplay (1)
#define EventLogs_DefaultMaster (0)
/* Local definitions */
#define EventLogs_TimeFormat ("%DY %M3 %CE%YR %24:%MI:%SE.%CS %TZ")
......@@ -72,11 +65,6 @@
static ObjectId window_id = NULL_ObjectId;
static eventlogs_log * log_head = NULL;
static unsigned int whattolog = EventLogs_DefaultList;
static unsigned int logbyurl = EventLogs_DefaultType;
static unsigned int showtitles = EventLogs_DefaultDisplay;
static unsigned int enablemaster = EventLogs_DefaultMaster;
static eventlogs_log master = {
NULL,
NULL,
......@@ -127,33 +115,17 @@ static int eventlog_browser (int eventcode, Tool
unsigned int eventlogs_what_to_log(void)
{
return whattolog;
}
/**************************************************************/
/* eventlogs_log_by_url() */
/* */
/* Are we logging by URL or browser window? */
/* */
/* Returns: 1 if logging by URL, else 0. */
/**************************************************************/
unsigned int flags = 0;
unsigned int eventlogs_log_by_url(void)
{
return logbyurl;
}
if (choices.ev_http_messages != 0) flags |= EventLogs_Log_HTTPMessages;
if (choices.ev_serious_errors != 0) flags |= EventLogs_Log_SeriousErrors;
if (choices.ev_events != 0) flags |= EventLogs_Log_SignificantEvents;
/**************************************************************/
/* eventlogs_show_titles() */
/* */
/* Are we displaying URLs or page titles? */
/* */
/* Returns: 1 if showing titles, else 0. */
/**************************************************************/
#ifdef JAVASCRIPT
if (choices.ev_scripts != 0) flags |= EventLogs_Log_ScriptInformation;
#endif
unsigned int eventlogs_show_titles(void)
{
return showtitles;
return flags;
}
/**************************************************************/
......@@ -202,19 +174,22 @@ int eventlogs_to_be_shown(int eventcode, ToolboxEvent * event, IdBlock * idb, vo
/* Update the various option / radio buttons */
ChkError(optionbutton_set_state (0, window_id, EventLogsHTTPMessages, !!(whattolog & EventLogs_Log_HTTPMessages)));
ChkError(optionbutton_set_state (0, window_id, EventLogsSeriousErrors, !!(whattolog & EventLogs_Log_SeriousErrors)));
ChkError(optionbutton_set_state (0, window_id, EventLogsSignificantEvents, !!(whattolog & EventLogs_Log_SignificantEvents)));
ChkError(optionbutton_set_state (0, window_id, EventLogsHTTPMessages, !!choices.ev_http_messages));
ChkError(optionbutton_set_state (0, window_id, EventLogsSeriousErrors, !!choices.ev_serious_errors));
ChkError(optionbutton_set_state (0, window_id, EventLogsSignificantEvents, !!choices.ev_events));
#ifdef JAVASCRIPT
ChkError(optionbutton_set_state (0, window_id, EventLogsScriptInformation, !!(whattolog & EventLogs_Log_ScriptInformation)));
ChkError(optionbutton_set_state (0, window_id, EventLogsScriptInformation, !!choices.ev_scripts));
#endif
ChkError(optionbutton_set_state(0, window_id, EventLogsEnableMaster, enablemaster));
ChkError(set_gadget_state(window_id, EventLogsOpenMaster, !enablemaster));
ChkError(optionbutton_set_state(0, window_id, EventLogsEnableMaster, !!choices.ev_enable_master));
ChkError(set_gadget_state(window_id, EventLogsOpenMaster, !choices.ev_enable_master));
ChkError(radiobutton_set_state(0, window_id, EventLogsPerVisitedPage, logbyurl));
ChkError(radiobutton_set_state(0, window_id, EventLogsByPageTitle, showtitles));
if (choices.ev_how_to_log == 0) ChkError(radiobutton_set_state(0, window_id, EventLogsPerBrowserWindow, 1));
else ChkError(radiobutton_set_state(0, window_id, EventLogsPerVisitedPage, 1));
if (choices.ev_display_method == 0) ChkError(radiobutton_set_state(0, window_id, EventLogsByPageTitle, 1));
else ChkError(radiobutton_set_state(0, window_id, EventLogsByURL, 1));
}
/* Update the ScrollList whether we've been re-opened or opened anew */
......@@ -254,42 +229,49 @@ static int eventlogs_new_log_list(int eventcode, ToolboxEvent * event, IdBlock *
{
int state;
whattolog = EventLogs_DefaultList;
enablemaster = EventLogs_DefaultMaster;
/* Defaults in case options aren't there in the front-end */
choices.ev_http_messages = 0;
choices.ev_serious_errors = 1;
choices.ev_events = 0;
#ifdef JAVASCRIPT
choices.ev_scripts = 1;
#endif
choices.ev_enable_master = 0;
/* Now read from the dialogue box itself */
if (!optionbutton_get_state(0, idb->self_id, EventLogsHTTPMessages, &state))
{
if (state) whattolog |= EventLogs_Log_HTTPMessages;
else whattolog &= ~EventLogs_Log_HTTPMessages;
choices.ev_http_messages = !!state;
}
if (!optionbutton_get_state(0, idb->self_id, EventLogsSeriousErrors, &state))
{
if (state) whattolog |= EventLogs_Log_SeriousErrors;
else whattolog &= ~EventLogs_Log_SeriousErrors;
choices.ev_serious_errors = !!state;
}
if (!optionbutton_get_state(0, idb->self_id, EventLogsSignificantEvents, &state))
{
if (state) whattolog |= EventLogs_Log_SignificantEvents;
else whattolog &= ~EventLogs_Log_SignificantEvents;
choices.ev_events = !!state;
}
#ifdef JAVASCRIPT
if (!optionbutton_get_state(0, idb->self_id, EventLogsScriptInformation, &state))
{
if (state) whattolog |= EventLogs_Log_ScriptInformation;
else whattolog &= ~EventLogs_Log_ScriptInformation;
choices.ev_scripts = !!state;
}
#endif
if (!optionbutton_get_state(0, idb->self_id, EventLogsEnableMaster, &state))
{
enablemaster = state;
ChkError(set_gadget_state(idb->self_id, EventLogsOpenMaster, !enablemaster));
if (!enablemaster && master.dbox) ChkError(toolbox_hide_object(0, master.dbox));
choices.ev_enable_master = !!state;
ChkError(set_gadget_state(idb->self_id, EventLogsOpenMaster, !state));
if (!state && master.dbox) ChkError(toolbox_hide_object(0, master.dbox));
}
return 1;
......@@ -307,12 +289,15 @@ static int eventlogs_new_log_type(int eventcode, ToolboxEvent * event, IdBlock *
{
int state;
logbyurl = EventLogs_DefaultType;
/* Defaults in case options aren't there in the front-end */
choices.ev_how_to_log = 1;
/* Now read from the dialogue box itself */
if (!radiobutton_get_state(0, idb->self_id, EventLogsPerVisitedPage, &state, NULL))
{
if (state) logbyurl = 1;
else logbyurl = 0;
choices.ev_how_to_log = !!state;
}
return 1;
......@@ -329,17 +314,20 @@ static int eventlogs_new_log_type(int eventcode, ToolboxEvent * event, IdBlock *
static int eventlogs_new_log_display(int eventcode, ToolboxEvent * event, IdBlock * idb, void * handle)
{
int state;
unsigned int old = showtitles;
unsigned int old = choices.ev_display_method;
/* Defaults in case options aren't there in the front-end */
showtitles = EventLogs_DefaultDisplay;
choices.ev_display_method = 1;
/* Now read from the dialogue box itself */
if (!radiobutton_get_state(0, idb->self_id, EventLogsByPageTitle, &state, NULL))
{
if (state) showtitles = 1;
else showtitles = 0;
choices.ev_display_method = !state;
}
if (showtitles != old) ChkError(eventlogs_refresh_list(idb->self_id));
if (choices.ev_display_method != old) ChkError(eventlogs_refresh_list(idb->self_id));
return 1;
}
......@@ -625,7 +613,7 @@ static _kernel_oserror * eventlogs_refresh_list(ObjectId self)
/* Ugh, page title comes from the title bar */
if (
!eventlogs_show_titles() ||
choices.ev_display_method != 0 ||
window_get_title(0,
current->self_id,
......@@ -775,23 +763,35 @@ _kernel_oserror * eventlogs_log_message(browser_data * b, eventlogs_type type, c
if (
(
type == eventlogs_http_message &&
!(whattolog & EventLogs_Log_HTTPMessages)
!choices.ev_http_messages
)
||
(
type == eventlogs_serious_error &&
!(whattolog & EventLogs_Log_SeriousErrors)
!choices.ev_serious_errors
)
||
(
type == eventlogs_significant_event &&
!(whattolog & EventLogs_Log_SignificantEvents)
)
||
(
type == eventlogs_script_information &&
!(whattolog & EventLogs_Log_ScriptInformation)
!choices.ev_events
)
#ifdef JAVASCRIPT
||
(
type == eventlogs_script_information &&
!choices.ev_scripts
)
#else
||
(
type == eventlogs_script_information
)
#endif
)
return NULL;
......@@ -826,7 +826,7 @@ _kernel_oserror * eventlogs_log_message(browser_data * b, eventlogs_type type, c
RetError(eventlogs_log_message_known(found, b, type, message));
if (enablemaster) RetError(eventlogs_log_message_known(&master, b, type, message));
if (choices.ev_enable_master) RetError(eventlogs_log_message_known(&master, b, type, message));
/* Finished */
......@@ -1008,7 +1008,7 @@ _kernel_oserror * eventlogs_url_changed(browser_data * b, unsigned int ok_to_cle
/* If we're doing per-URL logging, clear the existing text */
if (ok_to_clear && logbyurl && found->text)
if (ok_to_clear && choices.ev_how_to_log != 0 && found->text)
{
#ifdef TRACE
malloccount -= (strlen(found->text) + 1);
......@@ -1037,7 +1037,7 @@ _kernel_oserror * eventlogs_url_changed(browser_data * b, unsigned int ok_to_cle
char * text;
if (
!eventlogs_show_titles() ||
choices.ev_display_method != 0 ||
window_get_title(0,
b->self_id,
......
......@@ -85,10 +85,11 @@ static fetcher_state fetch_state;
/* Local definitions */
#define FetchBufferSize 16384 /* Size of buffer for getting data from the URL module in html_get_next_token. */
#define FetchBufferSize 32768 /* Size of buffer for getting data from the URL module in html_get_next_token. */
/* Local compilation options */
#define DUMP_HEADERS "<Wimp$Scrap>.Headers"
#undef DUMP_HEADERS
/* Static function prototyps */
......@@ -216,7 +217,7 @@ static void html_set_proxy(unsigned int handle, const char * url)
/* First append a ':' to the url_description's protocol name, */
/* so we can compare it to the HTTPmethod scheme string - we */
/* don't want to use a length-limited comparisson as this may */
/* don't want to use a length-limited comparison as this may */
/* foul up with (e.g.) 'http:' and 'https:'. This is also the */
/* way that url_set_proxy wants the method specifying. */
......@@ -539,7 +540,6 @@ _kernel_oserror * html_get(char * url, char ** extradata, int * handle, int meth
if (p) c = *p, *p = 0;
dprintf(("temp", "url_get_url for %p, url = '%s'\n",up,url));
e = url_get_url(URL_GetURL_AgentGiven, /* Should use a custom User Agent */
h, /* Session handle */
method, /* Fetch method */
......@@ -1944,7 +1944,7 @@ dprintf(("temp", "Read data within %p, %d read\n",up,read));
{
/* Log the redirection */
if (eventlogs_what_to_log() & EventLogs_Log_HTTPMessages)
if (choices.ev_http_messages != 0)
{
char tagname[8];
......@@ -1966,6 +1966,7 @@ dprintf(("temp", "Read data within %p, %d read\n",up,read));
/* Let this fail silently */
eventlogs_log_message(b, eventlogs_http_message, tokens);
*tokens = '\0';
}
if (redirect == NULL) redirect = "";
......@@ -2126,7 +2127,7 @@ dprintf(("temp", "Read data within %p, %d read\n",up,read));
{
/* For images or HTTP message event logging, create the required message */
if (image || (eventlogs_what_to_log() & EventLogs_Log_HTTPMessages))
if (image != 0 || choices.ev_http_messages != 0)
{
char tagname[8];
......
......@@ -79,7 +79,7 @@ static char * url_buffer = NULL;
/* Static function prototypes */
static _kernel_oserror * fetchpage_process_internal (browser_data * b);
static _kernel_oserror * fetchpage_preprocessed (browser_data * b, int record, int stop);
static _kernel_oserror * fetchpage_preprocessed (browser_data * b, int record, int stop, int no_anchor_errors);
static _kernel_oserror * fetchpage_postprocessed (browser_data * b, int record);
/**************************************************************/
......@@ -100,7 +100,7 @@ int fetchpage_fetch(int eventcode, WimpPollBlock * b, IdBlock * idb, browser_dat
#ifdef TRACE
{
static oldstatus;
static bs_fetch oldstatus;
if (handle->fetch_status != oldstatus)
{
......@@ -110,6 +110,12 @@ int fetchpage_fetch(int eventcode, WimpPollBlock * b, IdBlock * idb, browser_dat
}
#endif
/* Are we in a polled table cell format? */
if (handle->table_format) return 0;
/* Otherwise... */
if (handle->fetch_status == BS_START)
{
e = fetch_start(handle);
......@@ -150,7 +156,7 @@ int fetchpage_fetch(int eventcode, WimpPollBlock * b, IdBlock * idb, browser_dat
else priority = 0;
}
// do
do
{
/* If fetching, call the reformatter. */
......@@ -173,10 +179,10 @@ int fetchpage_fetch(int eventcode, WimpPollBlock * b, IdBlock * idb, browser_dat
_swix(OS_ReadMonotonicTime, _OUT(0), &tf_now);
}
// while (
// tf_now - tf_start < priority &&
// (fetching || formatting)
// );
while (
tf_now - tf_start < priority &&
(fetching || formatting)
);
/* Process images on a lower priority */
......@@ -332,13 +338,16 @@ int fetchpage_fetch(int eventcode, WimpPollBlock * b, IdBlock * idb, browser_dat
/* 1 to open the URL in a new window (with no */
/* name) regardless of the targetting, else 0 */
/* (this will not be overridden when running full */
/* screen). */
/* screen); */
/* */
/* 1 to suppress errors from in-page anchors */
/* which are not found, else 0. */
/* */
/* Parameters: Pointer to a browser_data struct relevant to */
/* the fetch. */
/**************************************************************/
_kernel_oserror * fetchpage_fetch_targetted(browser_data * parent, const char * url, const char * target, const char * appnddata, int new)
_kernel_oserror * fetchpage_fetch_targetted(browser_data * parent, const char * url, const char * target, const char * appnddata, int new_window, int no_anchor_errors)
{
browser_data * ancestor;
browser_data * targetted;
......@@ -362,12 +371,13 @@ _kernel_oserror * fetchpage_fetch_targetted(browser_data * parent, const char *
/* If we've been asked to open a new window, only the extra data */
/* parameter matters. */
if (new)
if (new_window)
{
if (appnddata) return fetchpage_new_add(NULL,
url,
1,
1,
no_anchor_errors,
appnddata,
1,
NULL);
......@@ -411,6 +421,7 @@ _kernel_oserror * fetchpage_fetch_targetted(browser_data * parent, const char *
url,
1,
1,
no_anchor_errors,
appnddata,
0,
NULL);
......@@ -421,7 +432,8 @@ _kernel_oserror * fetchpage_fetch_targetted(browser_data * parent, const char *
return fetchpage_new(targetted,
url,
1,
1);
1,
no_anchor_errors);
}
}
else
......@@ -435,6 +447,7 @@ _kernel_oserror * fetchpage_fetch_targetted(browser_data * parent, const char *
url,
1,
1,
no_anchor_errors,
appnddata,
1,
target);
......@@ -462,6 +475,7 @@ _kernel_oserror * fetchpage_fetch_targetted(browser_data * parent, const char *
url,
1,
1,
no_anchor_errors,
appnddata,
0,
NULL);
......@@ -469,7 +483,8 @@ _kernel_oserror * fetchpage_fetch_targetted(browser_data * parent, const char *
else return fetchpage_new(parent,
url,
1,
1);
1,
no_anchor_errors);
}
}
}
......@@ -627,10 +642,13 @@ static _kernel_oserror * fetchpage_process_internal(browser_data * b)
/* */
/* 1 to stop other page fetches in any other */
/* frames related to this document, 0 to only */
/* stop those in this frame. */
/* stop those in this frame; */
/* */
/* 1 to suppress errors from in-page anchors */
/* which are not found, else 0. */
/**************************************************************/
static _kernel_oserror * fetchpage_preprocessed(browser_data * b, int record, int stop)
static _kernel_oserror * fetchpage_preprocessed(browser_data * b, int record, int stop, int no_anchor_errors)
{
_kernel_oserror * e;
......@@ -651,14 +669,16 @@ static _kernel_oserror * fetchpage_preprocessed(browser_data * b, int record, in
(
browser_display_local_reference(b,
url_buffer,
(char *) browser_current_url(b))
(char *) browser_current_url(b),
no_anchor_errors)
)
||
(
b->urlbdata &&
browser_display_local_reference(b,
url_buffer,
(char *) browser_base_url(b))
(char *) browser_base_url(b),
no_anchor_errors)
)
)
)
......@@ -973,10 +993,13 @@ _kernel_oserror * fetchpage_postprocess_uri(browser_data * b, char * uri, int re
/* */
/* 1 to stop other page fetches in any other */
/* frames related to this document, 0 to only */
/* stop those in this frame. */
/* stop those in this frame; */
/* */
/* 1 to suppress errors from in-page anchors */
/* which are not found, else 0. */
/**************************************************************/
_kernel_oserror * fetchpage_new(browser_data * b, const char * url, int record, int stop)
_kernel_oserror * fetchpage_new(browser_data * b, const char * url, int record, int stop, int no_anchor_errors)
{
/* Don't proceed unless there's something to fetch */
......@@ -1024,7 +1047,7 @@ _kernel_oserror * fetchpage_new(browser_data * b, const char * url, int record,
urlutils_fix_url(url_buffer, strlen(url_buffer) + 128);
return fetchpage_preprocessed(b, record, stop);
return fetchpage_preprocessed(b, record, stop, no_anchor_errors);
}
/**************************************************************/
......@@ -1054,6 +1077,9 @@ _kernel_oserror * fetchpage_new(browser_data * b, const char * url, int record,
/* frames related to this document, 0 to only */
/* stop those in this frame; */
/* */
/* 1 to suppress errors from in-page anchors */
/* which are not found, else 0; */
/* */
/* Pointer to the data to add onto the end of the */
/* URL string; */
/* */
......@@ -1063,7 +1089,7 @@ _kernel_oserror * fetchpage_new(browser_data * b, const char * url, int record,
/* window name (if wanted), or NULL. */
/**************************************************************/
_kernel_oserror * fetchpage_new_add(browser_data * b, const char * url, int record, int stop, const char * add, int new_window, const char * name)
_kernel_oserror * fetchpage_new_add(browser_data * b, const char * url, int record, int stop, int no_anchor_errors, const char * add, int new_window, const char * name)
{
/* Don't proceed unless there's something to fetch */
......@@ -1124,7 +1150,7 @@ _kernel_oserror * fetchpage_new_add(browser_data * b, const char * url, int reco
urlutils_fix_url(url_buffer, strlen(url_buffer) + 128);
if (!new_window || b->full_screen) return fetchpage_preprocessed(b, record, stop);
if (!new_window || b->full_screen) return fetchpage_preprocessed(b, record, stop, no_anchor_errors);
else
{
RetError(windows_create_browser(url_buffer,
......@@ -1157,10 +1183,13 @@ _kernel_oserror * fetchpage_new_add(browser_data * b, const char * url, int reco
/* */
/* 1 to stop other page fetches in any other */
/* frames related to this document, 0 to only */
/* stop those in this frame. */
/* stop those in this frame; */
/* */
/* 1 to suppress errors from in-page anchors */
/* which are not found, else 0. */
/**************************************************************/
_kernel_oserror * fetchpage_new_raw(browser_data * b, const char * url, int record, int stop)
_kernel_oserror * fetchpage_new_raw(browser_data * b, const char * url, int record, int stop, int no_anchor_errors)
{
/* Don't proceed unless there's something to fetch */
......@@ -1206,7 +1235,7 @@ _kernel_oserror * fetchpage_new_raw(browser_data * b, const char * url, int reco
#endif
return fetchpage_preprocessed(b, record, stop);
return fetchpage_preprocessed(b, record, stop, no_anchor_errors);
}
/**************************************************************/
......
......@@ -983,7 +983,7 @@ _kernel_oserror * fm_char_box(fm_face h, char c, BBox * box)
/* the Red Green and Blue bytes. */
/**************************************************************/
_kernel_oserror * fm_set_font_colour(fm_face h, int fore, int back)
_kernel_oserror * fm_set_font_colour(fm_face h, unsigned int fore, unsigned int back)
{
/* First, the system font case */
......
......@@ -2720,7 +2720,7 @@ static int form_encode_flex_data(void ** data, const char * enctype, int start_a
{
char code[10];
if (*p == '\n') strcpy (code, "%0D%0A");
if (*p == '\n') strcpy (code, "%0A"); /* Was %0D%0A but this caused problems with e.g. Bugzilla under Unix; hopefully, having just %0A won't cause problems with Windows! */
else sprintf(code, "%%%02X", *p);
if (!form_extend_flex(data, strlen(code) - 1)) return 0;
......@@ -3524,7 +3524,8 @@ static _kernel_oserror * form_submit_form(browser_data * b, HStream * token, int
data,
HtmlFORMtarget(tp),
NULL,
adj);
adj,
0);
}
if (data)
......@@ -3576,7 +3577,8 @@ static _kernel_oserror * form_submit_form(browser_data * b, HStream * token, int
HtmlFORMaction(tp),
HtmlFORMtarget(tp),
NULL,
adj);
adj,
0);
}
}
......@@ -3703,7 +3705,8 @@ _kernel_oserror * form_click_field(browser_data * b, HStream * token, int mode,
data,
HtmlFORMtarget(token),
NULL,
controls.ignore_adjust ? 0 : adjust());
controls.ignore_adjust ? 0 : adjust(),
0);
free(data);
}
......
......@@ -1624,7 +1624,7 @@ _kernel_oserror * frames_define_frame(browser_data * b, HStream * token)
dprintf(("Fram", "frames_define_frame: Exitting through fetchpage_new()\n"));
return fetchpage_new(child, token->src, 1, 0);
return fetchpage_new(child, token->src, 1, 0, 0);
}
/**************************************************************/
......
......@@ -13,7 +13,7 @@
* limitations under the License.
*/
/**************************************************************/
/* File: Global.h */
/* File: Global.c */
/* (C) 2000 Pace Micro Technology PLC */
/* All rights reserved */
/* */
......@@ -90,6 +90,7 @@
/* Running flex alloc/free count CFle */
/* Image handling code Imag */
/* History (both local and global) Hist */
/* Image history ImgH */
/* Frames Fram */
/* Stream and memcpy/memmove trace Stre */
/* Table parsing information Tabl */
......
......@@ -629,9 +629,9 @@ static void handle_url_submission(browser_data * b, int key)
browser_current_url(b)[strlen(url)] == '?' /* ...and the first extra character is a '?', */
)
ChkError(fetchpage_new(b, browser_current_url(b), 1, 1)); /* ...then fetch the current URL instead. */
ChkError(fetchpage_new(b, browser_current_url(b), 1, 1, 0)); /* ...then fetch the current URL instead. */
else ChkError(fetchpage_new(b, url, 1, 1)); /* Otherwise do what the user asked! */
else ChkError(fetchpage_new(b, url, 1, 1, 0)); /* Otherwise do what the user asked! */
#else
......@@ -651,7 +651,7 @@ static void handle_url_submission(browser_data * b, int key)
/* Start the new fetch */
ChkError(fetchpage_new(b, url, 1, 1));
ChkError(fetchpage_new(b, url, 1, 1, 0));
#endif
}
......@@ -1490,11 +1490,29 @@ int handle_link_clicks(int eventcode, WimpPollBlock * b, IdBlock * idb, browser_
{
if (p->anchor || (p->type & TYPE_ISCLIENTMAP)) /* An anchor or client-side map */
{
int ignore = 0;
int ignore = 0;
int no_anchor_errors = 0;
/* First, do we have JavaScript code to deal with? */
if (p->onclick && *p->onclick) ChkError(javascript_href_onclick(handle, p, &ignore));
if (p->onclick != NULL && *p->onclick != '\0')
{
#ifdef JAVASCRIPT
javascript_set_source(JavaScript_Source_LinkInPage);
#endif
ChkError(javascript_href_onclick(handle, p, &ignore));
#ifdef JAVASCRIPT
/* 'ignore' will always be set in JS builds but what we actually want */
/* to do is just suppress errors from unrecognised local anchors. */
ignore = 0;
no_anchor_errors = 1;
#endif
}
/* If ignore is zero, we're supposed to deal with the HREF attribute */
/* on the link - otherwise, ignore it. */
......@@ -1531,7 +1549,8 @@ int handle_link_clicks(int eventcode, WimpPollBlock * b, IdBlock * idb, browser_
url,
target,
NULL,
adj));
adj,
no_anchor_errors));
used = 1;
}
......@@ -1572,7 +1591,8 @@ int handle_link_clicks(int eventcode, WimpPollBlock * b, IdBlock * idb, browser_
p->anchor,
p->target,
coords,
adj));
adj,
no_anchor_errors));
}
used = 1;
......@@ -1592,7 +1612,8 @@ int handle_link_clicks(int eventcode, WimpPollBlock * b, IdBlock * idb, browser_
p->anchor,
p->target,
NULL,
adj));
adj,
no_anchor_errors));
used = 1;
}
......@@ -1646,7 +1667,8 @@ int handle_link_clicks(int eventcode, WimpPollBlock * b, IdBlock * idb, browser_
ChkError(fetchpage_new(handle,
p->anchor,
0,
1));
1,
0));
}
else
{
......@@ -1785,13 +1807,28 @@ int handle_drags(int eventcode, WimpPollBlock * b, IdBlock * idb, browser_data *
{
/* Make sure the pointer is the correct shape if we're no */
/* longer over the original window or if the pointer is */
/* over any of the window border tools. */
/* over any of the window border tools. Otherwise make */
/* sure it's a relevant shape for any token it is over. */
if (
info.window_handle != browser_scrolled->window_handle ||
info.icon_handle < -1
)
mouse_set_pointer_shape(Mouse_Shape_Normal);
{
browser_data * new_b;
if (
utils_browser_from_window(info.window_handle, &new_b) != NULL ||
new_b == NULL
)
mouse_set_pointer_shape(Mouse_Shape_Normal);
else browser_pointer_check(0, NULL, NULL, new_b);
}
else
{
browser_pointer_check(0, NULL, NULL, browser_scrolled);
}
/* If there's an attached MayScroll indicator, make sure it's */
/* turned off. */
......@@ -2184,6 +2221,18 @@ int handle_drags(int eventcode, WimpPollBlock * b, IdBlock * idb, browser_data *
int handle_close_browser(int eventcode, WimpPollBlock * b, IdBlock * idb, browser_data * handle)
{
/* Reformatting a table? */
if (handle->table_format != 0 && b != NULL)
{
IdBlock idb;
idb.ancestor_id = 0;
idb.self_id = handle->self_id;
handle_stop(0, NULL, &idb, NULL);
}
/* If this was a 'file:/' URL, open the parent window - */
/* provided Adjust was used. If Shift was held down too */
/* we don't even close the window... */
......@@ -2258,7 +2307,7 @@ int handle_home(int eventcode, ToolboxEvent * event, IdBlock * idb, void * handl
#endif
if (from_menu || controls.ignore_adjust || !adjust()) ChkError(fetchpage_new(b, home, 1, 1));
if (from_menu || controls.ignore_adjust || !adjust()) ChkError(fetchpage_new(b, home, 1, 1, 0));
else
{
ChkError(windows_create_browser(home,
......@@ -2489,7 +2538,7 @@ int handle_reload(int eventcode, ToolboxEvent * event, IdBlock * idb, void * han
b->reloading = 1;
b->reload_lock = 1;
e = fetchpage_new(b, b->urlddata, 0, 1);
e = fetchpage_new(b, b->urlddata, 0, 1, 0);
if (e) show_error_ret(e);
}
......@@ -2520,7 +2569,7 @@ int handle_reload(int eventcode, ToolboxEvent * event, IdBlock * idb, void * han
if (*url)
{
if (!new_view) ChkError(fetchpage_new(b, url, 1, 1));
if (!new_view) ChkError(fetchpage_new(b, url, 1, 1, 0));
else
{
ChkError(windows_create_browser(url,
......@@ -2672,7 +2721,7 @@ int handle_view_hotlist(int eventcode, ToolboxEvent * event, IdBlock * idb, void
ChkError(browser_inherit(b, last_browser));
}
else ChkError(fetchpage_new(b, path, 1, 1));
else ChkError(fetchpage_new(b, path, 1, 1, 0));
#endif
......@@ -2818,7 +2867,7 @@ int handle_view_resources(int eventcode, ToolboxEvent * event, IdBlock * idb, vo
ChkError(browser_inherit(b, last_browser));
}
else ChkError(fetchpage_new(b, temp, 1, 1));
else ChkError(fetchpage_new(b, temp, 1, 1, 0));
}
else return 0;
......@@ -3134,7 +3183,7 @@ int handle_tristate(int eventcode, ToolboxEvent * event, IdBlock * idb, void * h
/* Deal with each button type individually */
switch (b->bistate)
switch (b->tristate)
{
case TriState_Go_GoTo_Stop:
{
......
......@@ -176,8 +176,6 @@ static void history_remove_entry (browser_data * b, history_entr
static int history_compare_entries (const void * first, const void * second);
static unsigned int history_ensure_sane (FILE * file, char * item, unsigned int item_len, long int old_position);
/**************************************************************/
/* history_find_entry() */
/* */
......@@ -1252,7 +1250,7 @@ _kernel_oserror * history_fetch_backwards(browser_data * b, int new_view)
/* Fetch the URL, flagging not to record this URL in the history */
return (fetchpage_new(b, (char *) url, 0, 1));
return (fetchpage_new(b, (char *) url, 0, 1, 0));
}
else
{
......@@ -1332,7 +1330,7 @@ _kernel_oserror * history_fetch_forwards(browser_data * b, int new_view)
/* Fetch the URL, flagging not to record this URL in the history */
return (fetchpage_new(b, (char *) url, 0, 1));
return (fetchpage_new(b, (char *) url, 0, 1, 0));
}
else
{
......@@ -2099,7 +2097,8 @@ _kernel_oserror * history_menu_selection(browser_data * b, WimpPollBlock * block
if (!adj) return fetchpage_new(b,
url,
0,
1);
1,
0);
else return windows_create_browser((char *) url,
NULL,
......@@ -2125,6 +2124,8 @@ _kernel_oserror * history_menu_selection(browser_data * b, WimpPollBlock * block
/* are any '\n' chars in a read string and rereading up to */
/* but not including the '\n' if so. */
/* */
/* Used by both the visit and image history loaders. */
/* */
/* Parameters: Pointer to the FILE * to read through; */
/* */
/* Pointer to the string just read; */
......@@ -2137,7 +2138,7 @@ _kernel_oserror * history_menu_selection(browser_data * b, WimpPollBlock * block
/* Returns: Length of item after checking. */
/**************************************************************/
static unsigned int history_ensure_sane(FILE * file, char * item, unsigned int item_len, long int old_position)
unsigned int history_ensure_sane(FILE * file, char * item, unsigned int item_len, long int old_position)
{
unsigned int count = 0;
......@@ -2183,10 +2184,11 @@ _kernel_oserror * history_load(char * pathname)
char * title = NULL;
char * url = NULL;
static char * local_path = NULL;
int result;
int last_accessed, title_len, url_len;
int items, item;
dprintf(("Hist", "history_load: Called with '%s'\n", pathname ? pathname : "<NULL>"));
if (!pathname || !*pathname) return NULL;
local_path = malloc(strlen(pathname) + 1);
......@@ -2194,8 +2196,6 @@ _kernel_oserror * history_load(char * pathname)
strcpy(local_path, pathname);
dprintf(("Hist", "history_load: Called\n"));
file = fopen(local_path, "rb");
if (!file)
......@@ -2209,9 +2209,7 @@ _kernel_oserror * history_load(char * pathname)
dprintf(("Hist", "history_load: File opened OK\n"));
result = fscanf(file, "%d\n", &items);
if (result == EOF)
if (fscanf(file, "%d\n", &items) == EOF)
{
fclose(file);
free(local_path);
......@@ -2235,8 +2233,17 @@ _kernel_oserror * history_load(char * pathname)
/* Read the last accessed time and required string lengths */
result = fscanf(file, "%d,%d,%d\n", &last_accessed, &title_len, &url_len);
if (result == EOF) goto history_load_exit;
if (
fscanf(file,
"%d,%d,%d\n",
&last_accessed,
&title_len,
&url_len)
== EOF
)
goto history_load_exit;
/* Allocate buffers for the strings */
......@@ -2280,14 +2287,14 @@ _kernel_oserror * history_load(char * pathname)
goto history_load_exit;
}
else title_len = history_ensure_sane(file, title, title_len, reread);
/* Skip the '\n' */
if (fgetc(file) == EOF) goto history_load_exit;
}
title[title_len] = 0;
/* Skip the '\n' */
if (fgetc(file) == EOF) goto history_load_exit;
/* Read the URL */
if (url_len)
......@@ -2301,12 +2308,12 @@ _kernel_oserror * history_load(char * pathname)
else url_len = history_ensure_sane(file, url, url_len, reread);
}
url[url_len] = 0;
/* Skip the '\n' */
if (fgetc(file) == EOF) goto history_load_exit;
url[url_len] = 0;
dprintf(("Hist", "history_load: %04d Title = \0213'%s'\0217\n"
" URL = \0216'%s'\0217\n",
......
......@@ -142,6 +142,10 @@ static browser_data * browser_redrawing = NULL;
#define FAST_TOKEN_REFERENCE_SHIFT 12
#undef ALL_FAST
// Presently unused... TBD...
#define ImageGranularity 8
// Unimplemented functions:
// /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
......@@ -930,7 +934,7 @@ _kernel_oserror * image_new_image(browser_data * b, const char * url, HStream *
if (idata)
{
int oldsize;
int oldsize;//, size;
oldsize = flex_size ((flex_ptr) &idata);
ok = flex_extend((flex_ptr) &idata, oldsize + sizeof(image_info));
......@@ -1283,7 +1287,7 @@ dprintf(("temp", "Bytes got for image %d = %d (+%d this time)\n",image,idata[ima
/* Log errors regardless of parser mode */
if (e)
if (e != NULL && choices.ev_events != 0)
{
if (strlen(idata[image].flex->urldata) < sizeof(tokens))
{
......@@ -1305,6 +1309,8 @@ dprintf(("temp", "Bytes got for image %d = %d (+%d this time)\n",image,idata[ima
if (ok) eventlogs_log_message(b,
eventlogs_significant_event,
tokens);
*tokens = '\0';
}
}
}
......@@ -3515,7 +3521,7 @@ _kernel_oserror * image_fill_background(void * handle, int * i)
if (idata[ximage].xref >= 0) ximage = idata[ximage].xref;
if (image >= nimages || image <=0)
if (image >= nimages || image < 0)
{
dprintf(("Imag", "image_fill_background: \0211Serious error!\0217 Invalid image number %d. Exitting.\n",image));
......@@ -4137,7 +4143,7 @@ void image_token_reformatted(browser_data * b, HStream * token)
/* Get the image number */
image = image_get_token_image_actual(b, token);
if (image < 0 || image > nimages) return;
if (image < 0 || image >= nimages) return;
if (idata[image].xref >= 0) xref = idata[image].xref;
else xref = image;
......@@ -4841,7 +4847,7 @@ static _kernel_oserror * image_get_image_size(browser_data * b, int image, BBox
sprintf(erb.errmess,"Invalid image number %d passed to image_get_image_size (nimages = %d)", image, nimages);
return &erb;
}
if (image > nimages)
if (image >= nimages)
{
erb.errnum = Utils_Error_Custom_Normal;
sprintf(erb.errmess,"Out of range image number %d passed to image_get_image_size (nimages = %d)", image, nimages);
......@@ -5127,7 +5133,7 @@ static _kernel_oserror * image_set_image_size(browser_data * b, int image, BBox
sprintf(erb.errmess,"Invalid image number %d passed to image_set_image_size (nimages = %d)", image, nimages);
return &erb;
}
if (image > nimages)
if (image >= nimages)
{
erb.errnum = Utils_Error_Custom_Normal;
sprintf(erb.errmess,"Out of range image number %d passed to image_set_image_size (nimages = %d)", image, nimages);
......@@ -6331,3 +6337,32 @@ image_tile_to_draw_exit:
return 0;
}
// /**************************************************************/
// /* image_gflex() */
// /* */
// /* Allocate / extend a flex block with granularity, to try */
// /* and avoid too much flex shifting. */
// /* */
// /* Parameters: Flex anchor for the block; */
// /* */
// /* Minimum size of the block. */
// /* */
// /* Returns: 1 for OK, 0 for failure. */
// /**************************************************************/
//
// static int image_gflex(flex_ptr ptr, int size)
// {
// ///// Presently unused... TBD...
//
// int oldsize;
//
// size = ((size >> ImageGranularity) + 1) << ImageGranularity;
//
// if (*ptr == NULL) return flex_alloc(ptr, size);
//
// oldsize = ((flex_size(ptr) >> ImageGranularity) + 1) << ImageGranularity;
//
// if (oldsize != size) return flex_extend(ptr, size);
// else return 1;
// }
......@@ -44,6 +44,7 @@
#include "Utils.h"
#include "ChoiceDefs.h"
#include "History.h" /* For history_ensure_sane */
#include "Images.h"
#include "Save.h" /* For Save_ScrapFile definition */
#include "URLutils.h" /* For FileMethod definition */
......@@ -444,10 +445,10 @@ _kernel_oserror * imghistory_load(const char * pathname)
FILE * file;
char * url = NULL;
static char * local_path = NULL;
int result;
int last_accessed, os_x, os_y, url_len;
int items, item;
int cc, ch;
dprintf(("ImgH", "imghistory_load: Called with '%s'\n", pathname ? pathname : "<NULL>"));
if (!pathname || !*pathname) return NULL;
......@@ -467,9 +468,9 @@ _kernel_oserror * imghistory_load(const char * pathname)
/* Read how many items there are - again file silently, the */
/* file may just be zero bytes long. */
result = fscanf(file, "%d\n", &items);
dprintf(("ImgH", "imghistory_load: File opened OK\n"));
if (result == EOF)
if (fscanf(file, "%d\n", &items) == EOF)
{
fclose(file);
free(local_path);
......@@ -493,6 +494,11 @@ _kernel_oserror * imghistory_load(const char * pathname)
/* Now load each entry's details */
#ifdef TRACE
if (items > 1) dprintf(("ImgH", "imghistory_load: There are %d items\n",items));
else dprintf(("ImgH", "imghistory_load: There is 1 item\n"));
#endif
_swix(Hourglass_On, 0);
for (item = 0; item < items; item++)
......@@ -504,8 +510,18 @@ _kernel_oserror * imghistory_load(const char * pathname)
/* Read the last accessed time and required string lengths */
result = fscanf(file, "%d,%d,%d,%d\n", &last_accessed, &os_x, &os_y, &url_len);
if (result == EOF) goto imghistory_load_exit;
if (
fscanf(file,
"%d,%d,%d,%d\n",
&last_accessed,
&os_x,
&os_y,
&url_len)
== EOF
)
goto imghistory_load_exit;
/* Allocate buffers for the strings */
......@@ -526,21 +542,24 @@ _kernel_oserror * imghistory_load(const char * pathname)
/* Read the URL */
for (cc = 0; cc < url_len; cc++)
if (url_len)
{
int ch = fgetc(file);
long int reread = ftell(file);
if (result == ch) goto imghistory_load_exit;
url[cc] = (char) ch;
if (!fread(url, url_len, sizeof(char), file))
{
goto imghistory_load_exit;
}
else url_len = history_ensure_sane(file, url, url_len, reread);
}
url[url_len] = 0;
/* Skip the '\n' */
ch = fgetc(file);
if (result == ch) goto imghistory_load_exit;
if (fgetc(file) == EOF) goto imghistory_load_exit;
dprintf(("ImgH", "imghistory_load: %04d URL = \0216'%s'\0217\n", item, url));
/* Now make the entry */
......
......@@ -1069,7 +1069,7 @@
b->reload_lock = 1;
}
e = fetchpage_new(b, jsurl_get_url_string(cx, obj), 0, 1);
e = fetchpage_new(b, jsurl_get_url_string(cx, obj), 0, 1, 1);
if (e)
{
......
......@@ -180,7 +180,12 @@ _kernel_oserror * javascript_body_onload(browser_data * b)
/* the contents of the HREF attribute in the link */
/* that held the onClick should be ignored (else */
/* 0 is written) - this may be NULL if you're not */
/* interested. */
/* interested - in CUSTOMER_SPECIAL builds, or an */
/* indication that the script function executed */
/* and returned, so any unknown anchor reference */
/* should be ignored (as an empty anchor is a */
/* common construct in links that only do a JS */
/* action) in non-CUSTOMER_SPECIAL script builds. */
/**************************************************************/
_kernel_oserror * javascript_href_onclick(browser_data * b, HStream * t, int * ignore)
......@@ -200,6 +205,15 @@ _kernel_oserror * javascript_href_onclick(browser_data * b, HStream * t, int * i
e = customer_href_onclick(b, t, ignore);
}
#else
#ifdef JAVASCRIPT
e = javascript_process_script(b, t->onclick);
if (ignore) *ignore = 1;
#endif
#endif
return e;
......@@ -288,7 +302,7 @@ _kernel_oserror * javascript_window_open(browser_data * b, int must_find, int re
dprintf(("JScr", "javascript_window_open: Relativised URL is '%s'\n",url));
}
e = fetchpage_new(targetted, url, record, 0);
e = fetchpage_new(targetted, url, record, 0, 1);
if (free_it) free(url);
......@@ -553,9 +567,12 @@ _kernel_oserror * javascript_window_open(browser_data * b, int must_find, int re
dprintf(("JScr", "javascript_error: Called\n"));
eventlogs_log_message(script_browser,
eventlogs_script_information,
message);
if (choices.ev_scripts)
{
eventlogs_log_message(script_browser,
eventlogs_script_information,
message);
}
if (choices.js_error_boxes != 0)
{
......@@ -1767,7 +1784,8 @@ _kernel_oserror * javascript_window_open(browser_data * b, int must_find, int re
e = fetchpage_new(pending_b,
pending_url,
pending_record,
pending_stop);
pending_stop,
1);
free(pending_url);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment