mirror of
https://github.com/netsurf-browser/netsurf
synced 2025-01-18 08:39:50 +03:00
JS: Remove unused slow script callback
Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
This commit is contained in:
parent
2503b17f02
commit
313dc9b099
@ -608,7 +608,7 @@ void js_finalise(void)
|
|||||||
|
|
||||||
/* exported interface documented in js.h */
|
/* exported interface documented in js.h */
|
||||||
nserror
|
nserror
|
||||||
js_newcontext(int timeout, jscallback *cb, void *cbctx, jscontext **jsctx)
|
js_newcontext(int timeout, jscontext **jsctx)
|
||||||
{
|
{
|
||||||
duk_context *ctx;
|
duk_context *ctx;
|
||||||
jscontext *ret = calloc(1, sizeof(*ret));
|
jscontext *ret = calloc(1, sizeof(*ret));
|
||||||
|
@ -28,8 +28,6 @@
|
|||||||
typedef struct jscontext jscontext;
|
typedef struct jscontext jscontext;
|
||||||
typedef struct jsobject jsobject;
|
typedef struct jsobject jsobject;
|
||||||
|
|
||||||
typedef bool(jscallback)(void *ctx);
|
|
||||||
|
|
||||||
struct dom_event;
|
struct dom_event;
|
||||||
struct dom_document;
|
struct dom_document;
|
||||||
struct dom_node;
|
struct dom_node;
|
||||||
@ -52,12 +50,10 @@ void js_finalise(void);
|
|||||||
* There is usually one context per browsing context (browser window)
|
* There is usually one context per browsing context (browser window)
|
||||||
*
|
*
|
||||||
* \param timeout elapsed wallclock time (in seconds) before \a callback is called
|
* \param timeout elapsed wallclock time (in seconds) before \a callback is called
|
||||||
* \param cb the callback when the runtime exceeds the timeout
|
|
||||||
* \param cbctx The context to pass to the callback
|
|
||||||
* \param jsctx Updated to the created JS context
|
* \param jsctx Updated to the created JS context
|
||||||
* \return NSERROR_OK on success, appropriate error otherwise.
|
* \return NSERROR_OK on success, appropriate error otherwise.
|
||||||
*/
|
*/
|
||||||
nserror js_newcontext(int timeout, jscallback *cb, void *cbctx, jscontext **jsctx);
|
nserror js_newcontext(int timeout, jscontext **jsctx);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Destroy a previously created context
|
* Destroy a previously created context
|
||||||
|
@ -35,8 +35,7 @@ void js_finalise(void)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
nserror js_newcontext(int timeout, jscallback *cb, void *cbctx,
|
nserror js_newcontext(int timeout, jscontext **jsctx)
|
||||||
jscontext **jsctx)
|
|
||||||
{
|
{
|
||||||
*jsctx = NULL;
|
*jsctx = NULL;
|
||||||
return NSERROR_OK;
|
return NSERROR_OK;
|
||||||
|
@ -329,22 +329,6 @@ browser_window__get_contextual_content(struct browser_window *bw,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* slow script handler
|
|
||||||
*/
|
|
||||||
static bool slow_script(void *ctx)
|
|
||||||
{
|
|
||||||
static int count = 0;
|
|
||||||
NSLOG(netsurf, INFO, "Continuing execution %d", count);
|
|
||||||
count++;
|
|
||||||
if (count > 1) {
|
|
||||||
count = 0;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* implements the download operation of a window navigate
|
* implements the download operation of a window navigate
|
||||||
*/
|
*/
|
||||||
@ -3101,8 +3085,7 @@ browser_window_initialise_common(enum browser_window_create_flags flags,
|
|||||||
assert(bw);
|
assert(bw);
|
||||||
|
|
||||||
/* new javascript context for each window/(i)frame */
|
/* new javascript context for each window/(i)frame */
|
||||||
err = js_newcontext(nsoption_int(script_timeout),
|
err = js_newcontext(nsoption_int(script_timeout), &bw->jsctx);
|
||||||
slow_script, NULL, &bw->jsctx);
|
|
||||||
if (err != NSERROR_OK)
|
if (err != NSERROR_OK)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user