NetSurf
Data Structures | Functions | Variables
fetcher.c File Reference

implementation for javascript scheme fetcher More...

#include <stdbool.h>
#include <stdlib.h>
#include <libwapcaplet/libwapcaplet.h>
#include "utils/nsurl.h"
#include "utils/corestrings.h"
#include "utils/ring.h"
#include "content/fetch.h"
#include "content/fetchers.h"
#include "javascript/fetcher.h"
Include dependency graph for fetcher.c:

Go to the source code of this file.

Data Structures

struct  fetch_javascript_context
 Context for an resource fetch. More...
 

Functions

static bool fetch_javascript_send_callback (const fetch_msg *msg, struct fetch_javascript_context *ctx)
 issue fetch callbacks with locking More...
 
static bool fetch_javascript_handler (struct fetch_javascript_context *ctx)
 called from poll to progress fetch. More...
 
static bool fetch_javascript_initialise (lwc_string *scheme)
 callback to initialise the resource fetcher. More...
 
static void fetch_javascript_finalise (lwc_string *scheme)
 callback to finalise the resource fetcher. More...
 
static bool fetch_javascript_can_fetch (const nsurl *url)
 
static void * fetch_javascript_setup (struct fetch *fetchh, nsurl *url, bool only_2xx, bool downgrade_tls, const char *post_urlenc, const struct fetch_multipart_data *post_multipart, const char **headers)
 callback to set up a resource fetch context. More...
 
static void fetch_javascript_free (void *ctx)
 callback to free a resource fetch More...
 
static bool fetch_javascript_start (void *ctx)
 callback to start a resource fetch More...
 
static void fetch_javascript_abort (void *ctx)
 callback to abort a resource fetch More...
 
static void fetch_javascript_poll (lwc_string *scheme)
 callback to poll for additional resource fetch contents More...
 
nserror fetch_javascript_register (void)
 Register javascript scheme fetcher with fetcher factory. More...
 

Variables

static struct fetch_javascript_contextring = NULL
 

Detailed Description

implementation for javascript scheme fetcher

This fetcher implements http://www.whatwg.org/specs/web-apps/current-work/multipage/browsers.html#javascript-protocol

Definition in file fetcher.c.

Function Documentation

◆ fetch_javascript_abort()

static void fetch_javascript_abort ( void *  ctx)
static

callback to abort a resource fetch

Definition at line 144 of file fetcher.c.

References fetch_javascript_context::aborted.

Referenced by fetch_javascript_register().

Here is the caller graph for this function:

◆ fetch_javascript_can_fetch()

static bool fetch_javascript_can_fetch ( const nsurl url)
static

Definition at line 96 of file fetcher.c.

Referenced by fetch_javascript_register().

Here is the caller graph for this function:

◆ fetch_javascript_finalise()

static void fetch_javascript_finalise ( lwc_string *  scheme)
static

callback to finalise the resource fetcher.

Definition at line 92 of file fetcher.c.

Referenced by fetch_javascript_register().

Here is the caller graph for this function:

◆ fetch_javascript_free()

static void fetch_javascript_free ( void *  ctx)
static

callback to free a resource fetch

Definition at line 127 of file fetcher.c.

References nsurl_unref(), ring, RING_REMOVE, and fetch_javascript_context::url.

Referenced by fetch_javascript_register().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fetch_javascript_handler()

static bool fetch_javascript_handler ( struct fetch_javascript_context ctx)
static

called from poll to progress fetch.

Todo:
This is currently completely unimplemented and just returns 204

Definition at line 69 of file fetcher.c.

References FETCH_FINISHED, fetch_javascript_send_callback(), fetch_set_http_code(), fetch_javascript_context::fetchh, and fetch_msg::type.

Referenced by fetch_javascript_poll().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fetch_javascript_initialise()

static bool fetch_javascript_initialise ( lwc_string *  scheme)
static

callback to initialise the resource fetcher.

Definition at line 86 of file fetcher.c.

Referenced by fetch_javascript_register().

Here is the caller graph for this function:

◆ fetch_javascript_poll()

static void fetch_javascript_poll ( lwc_string *  scheme)
static

callback to poll for additional resource fetch contents

Definition at line 157 of file fetcher.c.

References fetch_javascript_context::aborted, fetch_free(), fetch_javascript_handler(), fetch_remove_from_queues(), fetch_javascript_context::fetchh, fetch_javascript_context::locked, fetch_javascript_context::r_next, and ring.

Referenced by fetch_javascript_register().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fetch_javascript_register()

nserror fetch_javascript_register ( void  )

Register javascript scheme fetcher with fetcher factory.

Returns
NSERROR_OK on success or appropriate error code on faliure.

Definition at line 202 of file fetcher.c.

References fetch_javascript_abort(), fetch_javascript_can_fetch(), fetch_javascript_finalise(), fetch_javascript_free(), fetch_javascript_initialise(), fetch_javascript_poll(), fetch_javascript_setup(), fetch_javascript_start(), fetcher_add(), and fetcher_operation_table::initialise.

Referenced by fetcher_init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fetch_javascript_send_callback()

static bool fetch_javascript_send_callback ( const fetch_msg msg,
struct fetch_javascript_context ctx 
)
inlinestatic

issue fetch callbacks with locking

Definition at line 53 of file fetcher.c.

References fetch_javascript_context::aborted, fetch_send_callback(), fetch_javascript_context::fetchh, and fetch_javascript_context::locked.

Referenced by fetch_javascript_handler().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fetch_javascript_setup()

static void * fetch_javascript_setup ( struct fetch fetchh,
nsurl url,
bool  only_2xx,
bool  downgrade_tls,
const char *  post_urlenc,
const struct fetch_multipart_data post_multipart,
const char **  headers 
)
static

callback to set up a resource fetch context.

Definition at line 103 of file fetcher.c.

References fetch_javascript_context::fetchh, nsurl_ref(), ring, RING_INSERT, and fetch_javascript_context::url.

Referenced by fetch_javascript_register().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fetch_javascript_start()

static bool fetch_javascript_start ( void *  ctx)
static

callback to start a resource fetch

Definition at line 138 of file fetcher.c.

Referenced by fetch_javascript_register().

Here is the caller graph for this function:

Variable Documentation

◆ ring

struct fetch_javascript_context* ring = NULL
static

Definition at line 49 of file fetcher.c.

Referenced by fetch_javascript_free(), fetch_javascript_poll(), and fetch_javascript_setup().