2003-06-25 03:22:00 +04:00
|
|
|
/*
|
2007-01-13 03:21:15 +03:00
|
|
|
* Copyright 2005-2007 James Bursa <bursa@users.sourceforge.net>
|
2007-08-08 20:16:03 +04:00
|
|
|
*
|
|
|
|
* 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
|
2010-03-28 20:00:54 +04:00
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
2007-08-08 20:16:03 +04:00
|
|
|
* 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/>.
|
2003-02-09 15:58:15 +03:00
|
|
|
*/
|
|
|
|
|
2016-04-18 22:58:49 +03:00
|
|
|
/**
|
|
|
|
* \file
|
2014-11-09 01:08:29 +03:00
|
|
|
* Content handling implementation.
|
2003-09-08 01:08:13 +04:00
|
|
|
*/
|
|
|
|
|
2017-01-21 17:20:55 +03:00
|
|
|
#include <stdint.h>
|
2016-04-20 01:20:29 +03:00
|
|
|
#include <stdlib.h>
|
2020-06-25 01:49:59 +03:00
|
|
|
#include <string.h>
|
2016-04-21 00:58:48 +03:00
|
|
|
#include <nsutils/time.h>
|
2014-02-04 17:57:47 +04:00
|
|
|
|
2017-01-21 17:20:55 +03:00
|
|
|
#include "netsurf/inttypes.h"
|
2016-04-18 22:58:49 +03:00
|
|
|
#include "utils/log.h"
|
|
|
|
#include "utils/messages.h"
|
2019-12-01 18:49:08 +03:00
|
|
|
#include "utils/corestrings.h"
|
2016-06-06 10:59:23 +03:00
|
|
|
#include "netsurf/browser_window.h"
|
|
|
|
#include "netsurf/bitmap.h"
|
|
|
|
#include "netsurf/content.h"
|
2016-04-18 22:58:49 +03:00
|
|
|
#include "desktop/knockout.h"
|
2011-03-05 12:49:15 +03:00
|
|
|
|
2016-04-18 22:58:49 +03:00
|
|
|
#include "content/content_protected.h"
|
2020-05-12 23:09:41 +03:00
|
|
|
#include "content/textsearch.h"
|
2016-04-19 01:04:16 +03:00
|
|
|
#include "content/content_debug.h"
|
2016-04-18 22:58:49 +03:00
|
|
|
#include "content/hlcache.h"
|
2019-12-01 19:07:45 +03:00
|
|
|
#include "content/urldb.h"
|
2003-02-09 15:58:15 +03:00
|
|
|
|
2012-07-03 17:32:13 +04:00
|
|
|
#define URL_FMT_SPC "%.140s"
|
2003-02-09 15:58:15 +03:00
|
|
|
|
2008-07-30 04:54:43 +04:00
|
|
|
const char * const content_status_name[] = {
|
2004-06-11 00:41:26 +04:00
|
|
|
"LOADING",
|
|
|
|
"READY",
|
|
|
|
"DONE",
|
|
|
|
"ERROR"
|
|
|
|
};
|
|
|
|
|
2004-06-21 03:09:52 +04:00
|
|
|
|
2003-02-09 15:58:15 +03:00
|
|
|
/**
|
2020-05-07 01:38:50 +03:00
|
|
|
* All data has arrived, convert for display.
|
2003-09-08 01:08:13 +04:00
|
|
|
*
|
2020-05-07 01:38:50 +03:00
|
|
|
* Calls the convert function for the content.
|
|
|
|
*
|
|
|
|
* - If the conversion succeeds, but there is still some processing required
|
|
|
|
* (eg. loading images), the content gets status CONTENT_STATUS_READY, and a
|
|
|
|
* CONTENT_MSG_READY is sent to all users.
|
|
|
|
* - If the conversion succeeds and is complete, the content gets status
|
|
|
|
* CONTENT_STATUS_DONE, and CONTENT_MSG_READY then CONTENT_MSG_DONE are sent.
|
|
|
|
* - If the conversion fails, CONTENT_MSG_ERROR is sent. The content will soon
|
|
|
|
* be destroyed and must no longer be used.
|
2003-02-09 15:58:15 +03:00
|
|
|
*/
|
2020-05-07 01:38:50 +03:00
|
|
|
static void content_convert(struct content *c)
|
2003-02-09 15:58:15 +03:00
|
|
|
{
|
2020-05-07 01:38:50 +03:00
|
|
|
assert(c);
|
|
|
|
assert(c->status == CONTENT_STATUS_LOADING ||
|
|
|
|
c->status == CONTENT_STATUS_ERROR);
|
2010-03-28 16:56:39 +04:00
|
|
|
|
2020-05-07 01:38:50 +03:00
|
|
|
if (c->status != CONTENT_STATUS_LOADING)
|
|
|
|
return;
|
2010-03-28 16:56:39 +04:00
|
|
|
|
2020-05-07 01:38:50 +03:00
|
|
|
if (c->locked == true)
|
|
|
|
return;
|
2004-06-11 00:41:26 +04:00
|
|
|
|
2020-05-07 01:38:50 +03:00
|
|
|
NSLOG(netsurf, INFO, "content "URL_FMT_SPC" (%p)",
|
|
|
|
nsurl_access_log(llcache_handle_get_url(c->llcache)), c);
|
2007-01-13 03:21:15 +03:00
|
|
|
|
2020-05-07 01:38:50 +03:00
|
|
|
if (c->handler->data_complete != NULL) {
|
|
|
|
c->locked = true;
|
|
|
|
if (c->handler->data_complete(c) == false) {
|
|
|
|
content_set_error(c);
|
|
|
|
}
|
|
|
|
/* Conversion to the READY state will unlock the content */
|
|
|
|
} else {
|
|
|
|
content_set_ready(c);
|
|
|
|
content_set_done(c);
|
2004-06-21 19:09:59 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-05-07 01:38:50 +03:00
|
|
|
|
2006-02-06 03:10:09 +03:00
|
|
|
/**
|
2010-03-28 16:56:39 +04:00
|
|
|
* Handler for low-level cache events
|
2006-02-06 03:10:09 +03:00
|
|
|
*
|
2010-03-28 16:56:39 +04:00
|
|
|
* \param llcache Low-level cache handle
|
2010-03-28 20:00:54 +04:00
|
|
|
* \param event Event details
|
|
|
|
* \param pw Pointer to our context
|
2010-03-28 16:56:39 +04:00
|
|
|
* \return NSERROR_OK on success, appropriate error otherwise
|
2006-02-06 03:10:09 +03:00
|
|
|
*/
|
2020-05-07 01:38:50 +03:00
|
|
|
static nserror
|
|
|
|
content_llcache_callback(llcache_handle *llcache,
|
|
|
|
const llcache_event *event, void *pw)
|
2006-02-06 03:10:09 +03:00
|
|
|
{
|
2010-03-28 16:56:39 +04:00
|
|
|
struct content *c = pw;
|
|
|
|
union content_msg_data msg_data;
|
|
|
|
nserror error = NSERROR_OK;
|
|
|
|
|
|
|
|
switch (event->type) {
|
2019-08-05 20:11:13 +03:00
|
|
|
case LLCACHE_EVENT_GOT_CERTS:
|
|
|
|
/* Will never happen: handled in hlcache */
|
|
|
|
break;
|
2010-03-28 16:56:39 +04:00
|
|
|
case LLCACHE_EVENT_HAD_HEADERS:
|
|
|
|
/* Will never happen: handled in hlcache */
|
|
|
|
break;
|
|
|
|
case LLCACHE_EVENT_HAD_DATA:
|
2011-05-07 00:40:09 +04:00
|
|
|
if (c->handler->process_data != NULL) {
|
2019-07-10 18:42:52 +03:00
|
|
|
if (c->handler->process_data(c,
|
2020-05-07 01:38:50 +03:00
|
|
|
(const char *) event->data.data.buf,
|
|
|
|
event->data.data.len) == false) {
|
2010-04-08 11:09:09 +04:00
|
|
|
llcache_handle_abort(c->llcache);
|
2010-03-28 16:56:39 +04:00
|
|
|
c->status = CONTENT_STATUS_ERROR;
|
|
|
|
/** \todo It's not clear what error this is */
|
|
|
|
error = NSERROR_NOMEM;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case LLCACHE_EVENT_DONE:
|
2020-05-07 01:38:50 +03:00
|
|
|
{
|
|
|
|
size_t source_size;
|
2010-03-28 16:56:39 +04:00
|
|
|
|
2020-05-07 01:38:50 +03:00
|
|
|
(void) llcache_handle_get_source_data(llcache, &source_size);
|
2006-02-06 03:10:09 +03:00
|
|
|
|
2020-05-07 01:38:50 +03:00
|
|
|
content_set_status(c, messages_get("Processing"));
|
|
|
|
msg_data.explicit_status_text = NULL;
|
|
|
|
content_broadcast(c, CONTENT_MSG_STATUS, &msg_data);
|
2010-03-28 16:56:39 +04:00
|
|
|
|
2020-05-07 01:38:50 +03:00
|
|
|
content_convert(c);
|
|
|
|
}
|
2010-03-28 16:56:39 +04:00
|
|
|
break;
|
|
|
|
case LLCACHE_EVENT_ERROR:
|
|
|
|
/** \todo Error page? */
|
|
|
|
c->status = CONTENT_STATUS_ERROR;
|
2019-08-05 22:56:07 +03:00
|
|
|
msg_data.errordata.errorcode = event->data.error.code;
|
|
|
|
msg_data.errordata.errormsg = event->data.error.msg;
|
2017-08-26 17:50:03 +03:00
|
|
|
content_broadcast(c, CONTENT_MSG_ERROR, &msg_data);
|
2010-03-28 16:56:39 +04:00
|
|
|
break;
|
|
|
|
case LLCACHE_EVENT_PROGRESS:
|
2019-08-05 22:56:07 +03:00
|
|
|
content_set_status(c, event->data.progress_msg);
|
2012-08-15 22:00:50 +04:00
|
|
|
msg_data.explicit_status_text = NULL;
|
2017-08-26 17:50:03 +03:00
|
|
|
content_broadcast(c, CONTENT_MSG_STATUS, &msg_data);
|
2010-03-28 16:56:39 +04:00
|
|
|
break;
|
2013-05-27 17:51:00 +04:00
|
|
|
case LLCACHE_EVENT_REDIRECT:
|
|
|
|
msg_data.redirect.from = event->data.redirect.from;
|
|
|
|
msg_data.redirect.to = event->data.redirect.to;
|
2017-08-26 17:50:03 +03:00
|
|
|
content_broadcast(c, CONTENT_MSG_REDIRECT, &msg_data);
|
2013-05-27 17:51:00 +04:00
|
|
|
break;
|
2006-02-06 03:10:09 +03:00
|
|
|
}
|
|
|
|
|
2010-03-28 16:56:39 +04:00
|
|
|
return error;
|
2006-02-06 03:10:09 +03:00
|
|
|
}
|
|
|
|
|
2020-05-07 01:38:50 +03:00
|
|
|
|
2007-03-03 22:46:20 +03:00
|
|
|
/**
|
2020-05-07 01:38:50 +03:00
|
|
|
* update content status message
|
2007-03-03 22:46:20 +03:00
|
|
|
*
|
2020-05-07 01:38:50 +03:00
|
|
|
* \param c the content to update.
|
2007-03-03 22:46:20 +03:00
|
|
|
*/
|
2012-08-15 14:50:08 +04:00
|
|
|
static void content_update_status(struct content *c)
|
2007-01-13 03:21:15 +03:00
|
|
|
{
|
2011-02-28 23:38:23 +03:00
|
|
|
if (c->status == CONTENT_STATUS_LOADING ||
|
2020-05-07 01:38:50 +03:00
|
|
|
c->status == CONTENT_STATUS_READY) {
|
2011-05-08 23:11:34 +04:00
|
|
|
/* Not done yet */
|
|
|
|
snprintf(c->status_message, sizeof (c->status_message),
|
2020-05-07 01:38:50 +03:00
|
|
|
"%s%s%s", messages_get("Fetching"),
|
|
|
|
c->sub_status[0] != '\0' ? ", " : " ",
|
|
|
|
c->sub_status);
|
2011-05-08 23:11:34 +04:00
|
|
|
} else {
|
|
|
|
snprintf(c->status_message, sizeof (c->status_message),
|
2020-05-07 01:38:50 +03:00
|
|
|
"%s (%.1fs)", messages_get("Done"),
|
|
|
|
(float) c->time / 1000);
|
2011-05-08 23:11:34 +04:00
|
|
|
}
|
2012-08-15 14:50:08 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-05-07 01:38:50 +03:00
|
|
|
/* exported interface documented in content/protected.h */
|
|
|
|
nserror
|
|
|
|
content__init(struct content *c,
|
|
|
|
const content_handler *handler,
|
|
|
|
lwc_string *imime_type,
|
|
|
|
const struct http_parameter *params,
|
|
|
|
llcache_handle *llcache,
|
|
|
|
const char *fallback_charset,
|
|
|
|
bool quirks)
|
2012-08-15 14:50:08 +04:00
|
|
|
{
|
2020-05-07 01:38:50 +03:00
|
|
|
struct content_user *user_sentinel;
|
|
|
|
nserror error;
|
2011-05-08 23:11:34 +04:00
|
|
|
|
2020-05-07 01:38:50 +03:00
|
|
|
NSLOG(netsurf, INFO, "url "URL_FMT_SPC" -> %p",
|
|
|
|
nsurl_access_log(llcache_handle_get_url(llcache)), c);
|
|
|
|
|
|
|
|
user_sentinel = calloc(1, sizeof(struct content_user));
|
|
|
|
if (user_sentinel == NULL) {
|
|
|
|
return NSERROR_NOMEM;
|
2012-08-15 14:50:08 +04:00
|
|
|
}
|
|
|
|
|
2020-05-07 01:38:50 +03:00
|
|
|
if (fallback_charset != NULL) {
|
|
|
|
c->fallback_charset = strdup(fallback_charset);
|
|
|
|
if (c->fallback_charset == NULL) {
|
|
|
|
free(user_sentinel);
|
|
|
|
return NSERROR_NOMEM;
|
|
|
|
}
|
|
|
|
}
|
2004-06-05 19:03:59 +04:00
|
|
|
|
2020-05-07 01:38:50 +03:00
|
|
|
c->llcache = llcache;
|
|
|
|
c->mime_type = lwc_string_ref(imime_type);
|
|
|
|
c->handler = handler;
|
|
|
|
c->status = CONTENT_STATUS_LOADING;
|
|
|
|
c->width = 0;
|
|
|
|
c->height = 0;
|
|
|
|
c->available_width = 0;
|
|
|
|
c->available_height = 0;
|
|
|
|
c->quirks = quirks;
|
|
|
|
c->refresh = 0;
|
|
|
|
nsu_getmonotonic_ms(&c->time);
|
|
|
|
c->size = 0;
|
|
|
|
c->title = NULL;
|
|
|
|
c->active = 0;
|
|
|
|
user_sentinel->callback = NULL;
|
|
|
|
user_sentinel->pw = NULL;
|
|
|
|
user_sentinel->next = NULL;
|
|
|
|
c->user_list = user_sentinel;
|
|
|
|
c->sub_status[0] = 0;
|
|
|
|
c->locked = false;
|
|
|
|
c->total_size = 0;
|
|
|
|
c->http_code = 0;
|
2004-06-05 19:03:59 +04:00
|
|
|
|
2020-05-12 23:09:41 +03:00
|
|
|
c->textsearch.string = NULL;
|
|
|
|
c->textsearch.context = NULL;
|
|
|
|
|
2020-05-07 01:38:50 +03:00
|
|
|
content_set_status(c, messages_get("Loading"));
|
|
|
|
|
|
|
|
/* Finally, claim low-level cache events */
|
|
|
|
error = llcache_handle_change_callback(llcache,
|
|
|
|
content_llcache_callback, c);
|
|
|
|
if (error != NSERROR_OK) {
|
|
|
|
lwc_string_unref(c->mime_type);
|
|
|
|
return error;
|
|
|
|
}
|
|
|
|
|
|
|
|
return NSERROR_OK;
|
|
|
|
}
|
2003-02-09 15:58:15 +03:00
|
|
|
|
2020-05-07 01:38:50 +03:00
|
|
|
|
|
|
|
/* exported interface documented in content/content.h */
|
|
|
|
bool content_can_reformat(hlcache_handle *h)
|
2003-02-09 15:58:15 +03:00
|
|
|
{
|
2020-05-07 01:38:50 +03:00
|
|
|
struct content *c = hlcache_handle_get_content(h);
|
2010-04-18 15:04:13 +04:00
|
|
|
|
2020-05-07 01:38:50 +03:00
|
|
|
if (c == NULL)
|
|
|
|
return false;
|
2010-04-18 15:04:13 +04:00
|
|
|
|
2020-05-07 01:38:50 +03:00
|
|
|
return (c->handler->reformat != NULL);
|
|
|
|
}
|
2019-07-10 18:42:52 +03:00
|
|
|
|
2005-04-05 06:36:33 +04:00
|
|
|
|
2020-05-07 01:38:50 +03:00
|
|
|
/* exported interface documented in content/protected.h */
|
|
|
|
void content_set_status(struct content *c, const char *status_message)
|
|
|
|
{
|
|
|
|
size_t len = strlen(status_message);
|
|
|
|
|
|
|
|
if (len >= sizeof(c->sub_status)) {
|
|
|
|
len = sizeof(c->sub_status) - 1;
|
2010-04-11 14:52:18 +04:00
|
|
|
}
|
2020-05-07 01:38:50 +03:00
|
|
|
memcpy(c->sub_status, status_message, len);
|
|
|
|
c->sub_status[len] = '\0';
|
|
|
|
|
|
|
|
content_update_status(c);
|
2007-01-13 03:21:15 +03:00
|
|
|
}
|
|
|
|
|
2010-04-09 22:52:44 +04:00
|
|
|
|
2020-05-07 01:38:50 +03:00
|
|
|
/* exported interface documented in content/protected.h */
|
2010-04-09 22:52:44 +04:00
|
|
|
void content_set_ready(struct content *c)
|
|
|
|
{
|
2019-07-10 18:42:52 +03:00
|
|
|
/* The content must be locked at this point, as it can only
|
2011-02-28 22:58:08 +03:00
|
|
|
* become READY after conversion. */
|
|
|
|
assert(c->locked);
|
|
|
|
c->locked = false;
|
|
|
|
|
2010-04-09 22:52:44 +04:00
|
|
|
c->status = CONTENT_STATUS_READY;
|
|
|
|
content_update_status(c);
|
2017-08-26 17:50:03 +03:00
|
|
|
content_broadcast(c, CONTENT_MSG_READY, NULL);
|
2010-04-09 22:52:44 +04:00
|
|
|
}
|
2007-01-13 03:21:15 +03:00
|
|
|
|
|
|
|
|
2020-05-07 01:38:50 +03:00
|
|
|
/* exported interface documented in content/protected.h */
|
2007-01-13 03:21:15 +03:00
|
|
|
void content_set_done(struct content *c)
|
|
|
|
{
|
2016-04-21 00:58:48 +03:00
|
|
|
uint64_t now_ms;
|
|
|
|
|
|
|
|
nsu_getmonotonic_ms(&now_ms);
|
2007-01-13 03:21:15 +03:00
|
|
|
|
|
|
|
c->status = CONTENT_STATUS_DONE;
|
2016-04-21 00:58:48 +03:00
|
|
|
c->time = now_ms - c->time;
|
2007-01-13 03:21:15 +03:00
|
|
|
content_update_status(c);
|
2017-08-26 17:50:03 +03:00
|
|
|
content_broadcast(c, CONTENT_MSG_DONE, NULL);
|
2003-02-09 15:58:15 +03:00
|
|
|
}
|
|
|
|
|
2011-07-21 01:39:51 +04:00
|
|
|
|
2020-05-07 01:38:50 +03:00
|
|
|
/* exported interface documented in content/protected.h */
|
2011-07-21 01:39:51 +04:00
|
|
|
void content_set_error(struct content *c)
|
|
|
|
{
|
|
|
|
c->locked = false;
|
|
|
|
c->status = CONTENT_STATUS_ERROR;
|
|
|
|
}
|
2003-02-09 15:58:15 +03:00
|
|
|
|
|
|
|
|
2020-05-07 01:38:50 +03:00
|
|
|
/* exported interface documented in content/content.h */
|
2011-06-24 13:30:33 +04:00
|
|
|
void content_reformat(hlcache_handle *h, bool background,
|
2020-05-07 01:38:50 +03:00
|
|
|
int width, int height)
|
2010-03-28 16:56:39 +04:00
|
|
|
{
|
2011-06-24 13:30:33 +04:00
|
|
|
content__reformat(hlcache_handle_get_content(h), background,
|
2020-05-07 01:38:50 +03:00
|
|
|
width, height);
|
2010-03-28 16:56:39 +04:00
|
|
|
}
|
|
|
|
|
2020-05-07 01:38:50 +03:00
|
|
|
|
|
|
|
/* exported interface documented in content/protected.h */
|
|
|
|
void
|
|
|
|
content__reformat(struct content *c, bool background, int width, int height)
|
2003-02-09 15:58:15 +03:00
|
|
|
{
|
2004-04-25 03:42:32 +04:00
|
|
|
union content_msg_data data;
|
2003-02-09 15:58:15 +03:00
|
|
|
assert(c != 0);
|
2003-06-17 23:24:21 +04:00
|
|
|
assert(c->status == CONTENT_STATUS_READY ||
|
2020-05-07 01:38:50 +03:00
|
|
|
c->status == CONTENT_STATUS_DONE);
|
2011-02-28 22:58:08 +03:00
|
|
|
assert(c->locked == false);
|
2016-02-06 15:40:44 +03:00
|
|
|
|
2003-04-15 21:53:00 +04:00
|
|
|
c->available_width = width;
|
2019-02-17 12:03:19 +03:00
|
|
|
c->available_height = height;
|
2011-05-07 00:40:09 +04:00
|
|
|
if (c->handler->reformat != NULL) {
|
2011-09-17 18:35:54 +04:00
|
|
|
|
|
|
|
c->locked = true;
|
2011-05-07 00:40:09 +04:00
|
|
|
c->handler->reformat(c, width, height);
|
2011-09-17 18:35:54 +04:00
|
|
|
c->locked = false;
|
|
|
|
|
2011-06-24 13:30:33 +04:00
|
|
|
data.background = background;
|
2017-08-26 17:50:03 +03:00
|
|
|
content_broadcast(c, CONTENT_MSG_REFORMAT, &data);
|
2004-03-11 05:19:14 +03:00
|
|
|
}
|
2003-02-09 15:58:15 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-05-07 01:38:50 +03:00
|
|
|
/* exported interface documented in content/content.h */
|
2003-02-09 15:58:15 +03:00
|
|
|
void content_destroy(struct content *c)
|
|
|
|
{
|
2011-10-07 22:12:47 +04:00
|
|
|
struct content_rfc5988_link *link;
|
|
|
|
|
2004-01-26 17:16:23 +03:00
|
|
|
assert(c);
|
Use coccinelle to change logging macro calls in c files
for F in $(git ls-files '*.c');do spatch --sp-file foo.cocci --in-place ${F};done
@@ expression E; @@
-LOG(E);
+NSLOG(netsurf, INFO, E);
@@ expression E, E1; @@
-LOG(E, E1);
+NSLOG(netsurf, INFO, E, E1);
@@ expression E, E1, E2; @@
-LOG(E, E1, E2);
+NSLOG(netsurf, INFO, E, E1, E2);
@@ expression E, E1, E2, E3; @@
-LOG(E, E1, E2, E3);
+NSLOG(netsurf, INFO, E, E1, E2, E3);
@@ expression E, E1, E2, E3, E4; @@
-LOG(E, E1, E2, E3, E4);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4);
@@ expression E, E1, E2, E3, E4, E5; @@
-LOG(E, E1, E2, E3, E4, E5);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5);
@@ expression E, E1, E2, E3, E4, E5, E6; @@
-LOG(E, E1, E2, E3, E4, E5, E6);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5, E6);
@@ expression E, E1, E2, E3, E4, E5, E6, E7; @@
-LOG(E, E1, E2, E3, E4, E5, E6, E7);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5, E6, E7);
2017-09-06 20:28:12 +03:00
|
|
|
NSLOG(netsurf, INFO, "content %p %s", c,
|
2020-05-07 01:38:50 +03:00
|
|
|
nsurl_access_log(llcache_handle_get_url(c->llcache)));
|
2011-02-28 22:58:08 +03:00
|
|
|
assert(c->locked == false);
|
2004-01-26 17:16:23 +03:00
|
|
|
|
2011-05-07 00:40:09 +04:00
|
|
|
if (c->handler->destroy != NULL)
|
|
|
|
c->handler->destroy(c);
|
2010-04-12 00:58:50 +04:00
|
|
|
|
|
|
|
llcache_handle_release(c->llcache);
|
|
|
|
c->llcache = NULL;
|
|
|
|
|
2011-05-07 00:40:09 +04:00
|
|
|
lwc_string_unref(c->mime_type);
|
|
|
|
|
2011-10-07 22:12:47 +04:00
|
|
|
/* release metadata links */
|
|
|
|
link = c->links;
|
|
|
|
while (link != NULL) {
|
|
|
|
link = content__free_rfc5988_link(link);
|
|
|
|
}
|
|
|
|
|
2012-10-03 22:24:58 +04:00
|
|
|
/* free the user list */
|
|
|
|
if (c->user_list != NULL) {
|
|
|
|
free(c->user_list);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* free the title */
|
|
|
|
if (c->title != NULL) {
|
|
|
|
free(c->title);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* free the fallback characterset */
|
|
|
|
if (c->fallback_charset != NULL) {
|
|
|
|
free(c->fallback_charset);
|
|
|
|
}
|
|
|
|
|
|
|
|
free(c);
|
2003-02-09 15:58:15 +03:00
|
|
|
}
|
|
|
|
|
2010-06-04 13:35:08 +04:00
|
|
|
|
2020-05-07 01:38:50 +03:00
|
|
|
/* exported interface documented in content/content.h */
|
|
|
|
void
|
|
|
|
content_mouse_track(hlcache_handle *h,
|
|
|
|
struct browser_window *bw,
|
|
|
|
browser_mouse_state mouse,
|
|
|
|
int x, int y)
|
2010-06-04 13:35:08 +04:00
|
|
|
{
|
|
|
|
struct content *c = hlcache_handle_get_content(h);
|
|
|
|
assert(c != NULL);
|
|
|
|
|
2012-08-17 13:02:41 +04:00
|
|
|
if (c->handler->mouse_track != NULL) {
|
2011-05-07 00:40:09 +04:00
|
|
|
c->handler->mouse_track(c, bw, mouse, x, y);
|
2012-08-17 13:02:41 +04:00
|
|
|
} else {
|
|
|
|
union content_msg_data msg_data;
|
|
|
|
msg_data.pointer = BROWSER_POINTER_AUTO;
|
2017-08-26 17:50:03 +03:00
|
|
|
content_broadcast(c, CONTENT_MSG_POINTER, &msg_data);
|
2012-08-17 13:02:41 +04:00
|
|
|
}
|
|
|
|
|
2011-05-07 00:40:09 +04:00
|
|
|
|
2010-06-04 13:35:08 +04:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-05-07 01:38:50 +03:00
|
|
|
/* exported interface documented in content/content.h */
|
|
|
|
void
|
|
|
|
content_mouse_action(hlcache_handle *h,
|
|
|
|
struct browser_window *bw,
|
|
|
|
browser_mouse_state mouse,
|
|
|
|
int x, int y)
|
2010-06-04 13:35:08 +04:00
|
|
|
{
|
|
|
|
struct content *c = hlcache_handle_get_content(h);
|
|
|
|
assert(c != NULL);
|
|
|
|
|
2011-05-07 00:40:09 +04:00
|
|
|
if (c->handler->mouse_action != NULL)
|
|
|
|
c->handler->mouse_action(c, bw, mouse, x, y);
|
|
|
|
|
2010-06-04 13:35:08 +04:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-05-07 01:38:50 +03:00
|
|
|
/* exported interface documented in content/content.h */
|
2013-02-22 16:19:35 +04:00
|
|
|
bool content_keypress(struct hlcache_handle *h, uint32_t key)
|
|
|
|
{
|
|
|
|
struct content *c = hlcache_handle_get_content(h);
|
|
|
|
assert(c != NULL);
|
|
|
|
|
|
|
|
if (c->handler->keypress != NULL)
|
|
|
|
return c->handler->keypress(c, key);
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-05-07 01:38:50 +03:00
|
|
|
/* exported interface documented in content/content.h */
|
2010-03-28 16:56:39 +04:00
|
|
|
void content_request_redraw(struct hlcache_handle *h,
|
2020-05-07 01:38:50 +03:00
|
|
|
int x, int y, int width, int height)
|
2004-01-23 23:46:29 +03:00
|
|
|
{
|
2011-06-28 01:37:37 +04:00
|
|
|
content__request_redraw(hlcache_handle_get_content(h),
|
2020-05-07 01:38:50 +03:00
|
|
|
x, y, width, height);
|
2011-06-28 01:37:37 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-05-07 01:38:50 +03:00
|
|
|
/* exported interface, documented in content/protected.h */
|
2011-06-28 01:37:37 +04:00
|
|
|
void content__request_redraw(struct content *c,
|
2020-05-07 01:38:50 +03:00
|
|
|
int x, int y, int width, int height)
|
2011-06-28 01:37:37 +04:00
|
|
|
{
|
2010-03-28 16:56:39 +04:00
|
|
|
union content_msg_data data;
|
2004-01-23 23:46:29 +03:00
|
|
|
|
2010-03-28 16:56:39 +04:00
|
|
|
if (c == NULL)
|
|
|
|
return;
|
2004-01-23 23:46:29 +03:00
|
|
|
|
2010-03-28 16:56:39 +04:00
|
|
|
data.redraw.x = x;
|
|
|
|
data.redraw.y = y;
|
|
|
|
data.redraw.width = width;
|
|
|
|
data.redraw.height = height;
|
2004-07-30 20:16:07 +04:00
|
|
|
|
2017-08-26 17:50:03 +03:00
|
|
|
content_broadcast(c, CONTENT_MSG_REDRAW, &data);
|
2010-03-28 16:56:39 +04:00
|
|
|
}
|
2004-07-30 20:16:07 +04:00
|
|
|
|
2020-05-07 01:38:50 +03:00
|
|
|
|
2019-05-05 17:37:56 +03:00
|
|
|
/* exported interface, documented in content/content.h */
|
|
|
|
bool content_exec(struct hlcache_handle *h, const char *src, size_t srclen)
|
|
|
|
{
|
|
|
|
struct content *c = hlcache_handle_get_content(h);
|
2019-07-10 18:42:52 +03:00
|
|
|
|
2019-05-05 17:37:56 +03:00
|
|
|
assert(c != NULL);
|
2019-07-10 18:42:52 +03:00
|
|
|
|
2019-05-05 17:37:56 +03:00
|
|
|
if (c->locked) {
|
|
|
|
/* Not safe to do stuff */
|
|
|
|
NSLOG(netsurf, DEEPDEBUG, "Unable to exec, content locked");
|
|
|
|
return false;
|
|
|
|
}
|
2019-07-10 18:42:52 +03:00
|
|
|
|
2019-05-05 17:37:56 +03:00
|
|
|
if (c->handler->exec == NULL) {
|
|
|
|
/* Can't exec something on this content */
|
|
|
|
NSLOG(netsurf, DEEPDEBUG, "Unable to exec, no exec function");
|
|
|
|
return false;
|
|
|
|
}
|
2019-07-10 18:42:52 +03:00
|
|
|
|
2019-05-05 17:37:56 +03:00
|
|
|
return c->handler->exec(c, src, srclen);
|
|
|
|
}
|
2003-05-10 15:15:49 +04:00
|
|
|
|
2020-05-07 01:38:50 +03:00
|
|
|
|
2019-12-01 18:49:08 +03:00
|
|
|
/* exported interface, documented in content/content.h */
|
|
|
|
bool content_saw_insecure_objects(struct hlcache_handle *h)
|
|
|
|
{
|
|
|
|
struct content *c = hlcache_handle_get_content(h);
|
2019-12-01 20:03:59 +03:00
|
|
|
struct nsurl *url = hlcache_handle_get_url(h);
|
|
|
|
lwc_string *scheme = nsurl_get_component(url, NSURL_SCHEME);
|
2019-12-01 18:49:08 +03:00
|
|
|
bool match;
|
|
|
|
|
|
|
|
/* Is this an internal scheme? If so, we trust here and stop */
|
|
|
|
if ((lwc_string_isequal(scheme, corestring_lwc_about,
|
|
|
|
&match) == lwc_error_ok &&
|
|
|
|
(match == true)) ||
|
|
|
|
(lwc_string_isequal(scheme, corestring_lwc_data,
|
|
|
|
&match) == lwc_error_ok &&
|
|
|
|
(match == true)) ||
|
|
|
|
(lwc_string_isequal(scheme, corestring_lwc_resource,
|
|
|
|
&match) == lwc_error_ok &&
|
2019-12-01 20:03:59 +03:00
|
|
|
(match == true)) ||
|
|
|
|
/* Our internal x-ns-css scheme is secure */
|
|
|
|
(lwc_string_isequal(scheme, corestring_lwc_x_ns_css,
|
|
|
|
&match) == lwc_error_ok &&
|
|
|
|
(match == true)) ||
|
|
|
|
/* We also treat file: as "not insecure" here */
|
|
|
|
(lwc_string_isequal(scheme, corestring_lwc_file,
|
|
|
|
&match) == lwc_error_ok &&
|
2019-12-01 18:49:08 +03:00
|
|
|
(match == true))) {
|
|
|
|
/* No insecurity to find */
|
2019-12-01 20:25:49 +03:00
|
|
|
lwc_string_unref(scheme);
|
2019-12-01 18:49:08 +03:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Okay, not internal, am *I* secure? */
|
|
|
|
if ((lwc_string_isequal(scheme, corestring_lwc_https,
|
|
|
|
&match) == lwc_error_ok)
|
|
|
|
&& (match == false)) {
|
|
|
|
/* I did see something insecure -- ME! */
|
2019-12-01 20:25:49 +03:00
|
|
|
lwc_string_unref(scheme);
|
2019-12-01 18:49:08 +03:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2019-12-01 20:25:49 +03:00
|
|
|
lwc_string_unref(scheme);
|
2019-12-01 18:49:08 +03:00
|
|
|
/* I am supposed to be secure, but was I overridden */
|
2019-12-01 20:03:59 +03:00
|
|
|
if (urldb_get_cert_permissions(url)) {
|
2019-12-01 18:49:08 +03:00
|
|
|
/* I was https:// but I was overridden, that's no good */
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Otherwise try and chain through the handler */
|
2019-12-01 20:03:59 +03:00
|
|
|
if (c != NULL && c->handler->saw_insecure_objects != NULL) {
|
2019-12-01 18:49:08 +03:00
|
|
|
return c->handler->saw_insecure_objects(c);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* If we can't see insecure objects, we can't see them */
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2020-05-07 01:38:50 +03:00
|
|
|
|
2016-06-06 10:59:23 +03:00
|
|
|
/* exported interface, documented in content/content.h */
|
2020-05-07 01:38:50 +03:00
|
|
|
bool
|
|
|
|
content_redraw(hlcache_handle *h,
|
|
|
|
struct content_redraw_data *data,
|
|
|
|
const struct rect *clip,
|
|
|
|
const struct redraw_context *ctx)
|
2003-05-10 15:15:49 +04:00
|
|
|
{
|
2010-03-28 16:56:39 +04:00
|
|
|
struct content *c = hlcache_handle_get_content(h);
|
2011-05-08 23:54:35 +04:00
|
|
|
|
|
|
|
assert(c != NULL);
|
2011-02-11 01:35:41 +03:00
|
|
|
|
|
|
|
if (c->locked) {
|
2005-07-06 02:43:38 +04:00
|
|
|
/* not safe to attempt redraw */
|
|
|
|
return true;
|
2011-02-11 01:35:41 +03:00
|
|
|
}
|
|
|
|
|
2011-05-08 23:54:35 +04:00
|
|
|
/* ensure we have a redrawable content */
|
2011-05-07 00:40:09 +04:00
|
|
|
if (c->handler->redraw == NULL) {
|
2011-02-11 01:35:41 +03:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2011-06-30 19:48:07 +04:00
|
|
|
return c->handler->redraw(c, data, clip, ctx);
|
2003-05-10 15:15:49 +04:00
|
|
|
}
|
|
|
|
|
2003-06-17 23:24:21 +04:00
|
|
|
|
2015-04-23 17:47:28 +03:00
|
|
|
/* exported interface, documented in content/content.h */
|
2020-05-07 01:38:50 +03:00
|
|
|
bool
|
|
|
|
content_scaled_redraw(struct hlcache_handle *h,
|
|
|
|
int width, int height,
|
|
|
|
const struct redraw_context *ctx)
|
2015-04-23 17:47:28 +03:00
|
|
|
{
|
|
|
|
struct content *c = hlcache_handle_get_content(h);
|
|
|
|
struct redraw_context new_ctx = *ctx;
|
|
|
|
struct rect clip;
|
|
|
|
struct content_redraw_data data;
|
|
|
|
bool plot_ok = true;
|
|
|
|
|
|
|
|
assert(c != NULL);
|
|
|
|
|
|
|
|
/* ensure it is safe to attempt redraw */
|
|
|
|
if (c->locked) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ensure we have a redrawable content */
|
|
|
|
if (c->handler->redraw == NULL) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
Use coccinelle to change logging macro calls in c files
for F in $(git ls-files '*.c');do spatch --sp-file foo.cocci --in-place ${F};done
@@ expression E; @@
-LOG(E);
+NSLOG(netsurf, INFO, E);
@@ expression E, E1; @@
-LOG(E, E1);
+NSLOG(netsurf, INFO, E, E1);
@@ expression E, E1, E2; @@
-LOG(E, E1, E2);
+NSLOG(netsurf, INFO, E, E1, E2);
@@ expression E, E1, E2, E3; @@
-LOG(E, E1, E2, E3);
+NSLOG(netsurf, INFO, E, E1, E2, E3);
@@ expression E, E1, E2, E3, E4; @@
-LOG(E, E1, E2, E3, E4);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4);
@@ expression E, E1, E2, E3, E4, E5; @@
-LOG(E, E1, E2, E3, E4, E5);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5);
@@ expression E, E1, E2, E3, E4, E5, E6; @@
-LOG(E, E1, E2, E3, E4, E5, E6);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5, E6);
@@ expression E, E1, E2, E3, E4, E5, E6, E7; @@
-LOG(E, E1, E2, E3, E4, E5, E6, E7);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5, E6, E7);
2017-09-06 20:28:12 +03:00
|
|
|
NSLOG(netsurf, INFO, "Content %p %dx%d ctx:%p", c, width, height, ctx);
|
2015-04-23 17:47:28 +03:00
|
|
|
|
|
|
|
if (ctx->plot->option_knockout) {
|
|
|
|
knockout_plot_start(ctx, &new_ctx);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Set clip rectangle to required thumbnail size */
|
|
|
|
clip.x0 = 0;
|
|
|
|
clip.y0 = 0;
|
|
|
|
clip.x1 = width;
|
|
|
|
clip.y1 = height;
|
|
|
|
|
2017-02-11 16:54:08 +03:00
|
|
|
new_ctx.plot->clip(&new_ctx, &clip);
|
2015-04-23 17:47:28 +03:00
|
|
|
|
|
|
|
/* Plot white background */
|
2017-02-11 16:54:08 +03:00
|
|
|
plot_ok &= (new_ctx.plot->rectangle(&new_ctx,
|
|
|
|
plot_style_fill_white,
|
|
|
|
&clip) == NSERROR_OK);
|
2015-04-23 17:47:28 +03:00
|
|
|
|
|
|
|
/* Set up content redraw data */
|
|
|
|
data.x = 0;
|
|
|
|
data.y = 0;
|
|
|
|
data.width = width;
|
|
|
|
data.height = height;
|
|
|
|
|
|
|
|
data.background_colour = 0xFFFFFF;
|
|
|
|
data.repeat_x = false;
|
|
|
|
data.repeat_y = false;
|
|
|
|
|
|
|
|
/* Find the scale factor to use if the content has a width */
|
|
|
|
if (c->width) {
|
|
|
|
data.scale = (float)width / (float)c->width;
|
|
|
|
} else {
|
|
|
|
data.scale = 1.0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Render the content */
|
|
|
|
plot_ok &= c->handler->redraw(c, &data, &clip, &new_ctx);
|
|
|
|
|
|
|
|
if (ctx->plot->option_knockout) {
|
2017-02-11 16:47:39 +03:00
|
|
|
knockout_plot_end(ctx);
|
2015-04-23 17:47:28 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
return plot_ok;
|
|
|
|
}
|
|
|
|
|
2003-06-17 23:24:21 +04:00
|
|
|
|
2020-05-07 01:38:50 +03:00
|
|
|
/* exported interface documented in content/content.h */
|
|
|
|
bool
|
|
|
|
content_add_user(struct content *c,
|
|
|
|
void (*callback)(
|
|
|
|
struct content *c,
|
|
|
|
content_msg msg,
|
|
|
|
const union content_msg_data *data,
|
|
|
|
void *pw),
|
|
|
|
void *pw)
|
2003-06-17 23:24:21 +04:00
|
|
|
{
|
|
|
|
struct content_user *user;
|
2005-01-02 06:58:21 +03:00
|
|
|
|
Use coccinelle to change logging macro calls in c files
for F in $(git ls-files '*.c');do spatch --sp-file foo.cocci --in-place ${F};done
@@ expression E; @@
-LOG(E);
+NSLOG(netsurf, INFO, E);
@@ expression E, E1; @@
-LOG(E, E1);
+NSLOG(netsurf, INFO, E, E1);
@@ expression E, E1, E2; @@
-LOG(E, E1, E2);
+NSLOG(netsurf, INFO, E, E1, E2);
@@ expression E, E1, E2, E3; @@
-LOG(E, E1, E2, E3);
+NSLOG(netsurf, INFO, E, E1, E2, E3);
@@ expression E, E1, E2, E3, E4; @@
-LOG(E, E1, E2, E3, E4);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4);
@@ expression E, E1, E2, E3, E4, E5; @@
-LOG(E, E1, E2, E3, E4, E5);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5);
@@ expression E, E1, E2, E3, E4, E5, E6; @@
-LOG(E, E1, E2, E3, E4, E5, E6);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5, E6);
@@ expression E, E1, E2, E3, E4, E5, E6, E7; @@
-LOG(E, E1, E2, E3, E4, E5, E6, E7);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5, E6, E7);
2017-09-06 20:28:12 +03:00
|
|
|
NSLOG(netsurf, INFO, "content "URL_FMT_SPC" (%p), user %p %p",
|
2020-05-07 01:38:50 +03:00
|
|
|
nsurl_access_log(llcache_handle_get_url(c->llcache)),
|
|
|
|
c, callback, pw);
|
2012-10-03 22:24:58 +04:00
|
|
|
user = malloc(sizeof(struct content_user));
|
2005-01-14 01:42:39 +03:00
|
|
|
if (!user)
|
2005-01-02 06:58:21 +03:00
|
|
|
return false;
|
2003-06-17 23:24:21 +04:00
|
|
|
user->callback = callback;
|
2010-03-28 16:56:39 +04:00
|
|
|
user->pw = pw;
|
2003-06-17 23:24:21 +04:00
|
|
|
user->next = c->user_list->next;
|
|
|
|
c->user_list->next = user;
|
2005-01-02 06:58:21 +03:00
|
|
|
|
2015-10-31 17:32:22 +03:00
|
|
|
if (c->handler->add_user != NULL)
|
|
|
|
c->handler->add_user(c);
|
|
|
|
|
2005-01-02 06:58:21 +03:00
|
|
|
return true;
|
2003-06-17 23:24:21 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-05-07 01:38:50 +03:00
|
|
|
/* exported interface documented in content/content.h */
|
|
|
|
void
|
|
|
|
content_remove_user(struct content *c,
|
|
|
|
void (*callback)(
|
|
|
|
struct content *c,
|
|
|
|
content_msg msg,
|
|
|
|
const union content_msg_data *data,
|
|
|
|
void *pw),
|
|
|
|
void *pw)
|
2003-06-17 23:24:21 +04:00
|
|
|
{
|
|
|
|
struct content_user *user, *next;
|
Use coccinelle to change logging macro calls in c files
for F in $(git ls-files '*.c');do spatch --sp-file foo.cocci --in-place ${F};done
@@ expression E; @@
-LOG(E);
+NSLOG(netsurf, INFO, E);
@@ expression E, E1; @@
-LOG(E, E1);
+NSLOG(netsurf, INFO, E, E1);
@@ expression E, E1, E2; @@
-LOG(E, E1, E2);
+NSLOG(netsurf, INFO, E, E1, E2);
@@ expression E, E1, E2, E3; @@
-LOG(E, E1, E2, E3);
+NSLOG(netsurf, INFO, E, E1, E2, E3);
@@ expression E, E1, E2, E3, E4; @@
-LOG(E, E1, E2, E3, E4);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4);
@@ expression E, E1, E2, E3, E4, E5; @@
-LOG(E, E1, E2, E3, E4, E5);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5);
@@ expression E, E1, E2, E3, E4, E5, E6; @@
-LOG(E, E1, E2, E3, E4, E5, E6);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5, E6);
@@ expression E, E1, E2, E3, E4, E5, E6, E7; @@
-LOG(E, E1, E2, E3, E4, E5, E6, E7);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5, E6, E7);
2017-09-06 20:28:12 +03:00
|
|
|
NSLOG(netsurf, INFO, "content "URL_FMT_SPC" (%p), user %p %p",
|
2020-05-07 01:38:50 +03:00
|
|
|
nsurl_access_log(llcache_handle_get_url(c->llcache)),
|
|
|
|
c, callback, pw);
|
2003-06-17 23:24:21 +04:00
|
|
|
|
|
|
|
/* user_list starts with a sentinel */
|
|
|
|
for (user = c->user_list; user->next != 0 &&
|
2020-05-07 01:38:50 +03:00
|
|
|
!(user->next->callback == callback &&
|
|
|
|
user->next->pw == pw); user = user->next)
|
2003-06-17 23:24:21 +04:00
|
|
|
;
|
|
|
|
if (user->next == 0) {
|
Use coccinelle to change logging macro calls in c files
for F in $(git ls-files '*.c');do spatch --sp-file foo.cocci --in-place ${F};done
@@ expression E; @@
-LOG(E);
+NSLOG(netsurf, INFO, E);
@@ expression E, E1; @@
-LOG(E, E1);
+NSLOG(netsurf, INFO, E, E1);
@@ expression E, E1, E2; @@
-LOG(E, E1, E2);
+NSLOG(netsurf, INFO, E, E1, E2);
@@ expression E, E1, E2, E3; @@
-LOG(E, E1, E2, E3);
+NSLOG(netsurf, INFO, E, E1, E2, E3);
@@ expression E, E1, E2, E3, E4; @@
-LOG(E, E1, E2, E3, E4);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4);
@@ expression E, E1, E2, E3, E4, E5; @@
-LOG(E, E1, E2, E3, E4, E5);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5);
@@ expression E, E1, E2, E3, E4, E5, E6; @@
-LOG(E, E1, E2, E3, E4, E5, E6);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5, E6);
@@ expression E, E1, E2, E3, E4, E5, E6, E7; @@
-LOG(E, E1, E2, E3, E4, E5, E6, E7);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5, E6, E7);
2017-09-06 20:28:12 +03:00
|
|
|
NSLOG(netsurf, INFO, "user not found in list");
|
2003-06-17 23:24:21 +04:00
|
|
|
assert(0);
|
|
|
|
return;
|
|
|
|
}
|
2015-10-31 17:32:22 +03:00
|
|
|
|
|
|
|
if (c->handler->remove_user != NULL)
|
|
|
|
c->handler->remove_user(c);
|
|
|
|
|
2003-06-17 23:24:21 +04:00
|
|
|
next = user->next;
|
|
|
|
user->next = next->next;
|
2012-10-03 22:24:58 +04:00
|
|
|
free(next);
|
2003-06-17 23:24:21 +04:00
|
|
|
}
|
|
|
|
|
2010-04-04 16:41:19 +04:00
|
|
|
|
2020-05-07 01:38:50 +03:00
|
|
|
/* exported interface documented in content/content.h */
|
2010-04-04 16:41:19 +04:00
|
|
|
uint32_t content_count_users(struct content *c)
|
|
|
|
{
|
|
|
|
struct content_user *user;
|
|
|
|
uint32_t counter = 0;
|
|
|
|
|
|
|
|
assert(c != NULL);
|
2019-07-10 18:42:52 +03:00
|
|
|
|
2010-04-04 16:41:19 +04:00
|
|
|
for (user = c->user_list; user != NULL; user = user->next)
|
|
|
|
counter += 1;
|
2013-10-23 18:40:27 +04:00
|
|
|
|
|
|
|
assert(counter > 0);
|
|
|
|
|
2010-04-04 16:41:19 +04:00
|
|
|
return counter - 1; /* Subtract 1 for the sentinel */
|
|
|
|
}
|
2003-06-17 23:24:21 +04:00
|
|
|
|
2020-05-07 01:38:50 +03:00
|
|
|
|
|
|
|
/* exported interface documented in content/content.h */
|
2010-04-11 20:34:23 +04:00
|
|
|
bool content_matches_quirks(struct content *c, bool quirks)
|
|
|
|
{
|
2011-05-07 00:40:09 +04:00
|
|
|
if (c->handler->matches_quirks == NULL)
|
2010-04-11 20:34:23 +04:00
|
|
|
return true;
|
|
|
|
|
2011-05-07 00:40:09 +04:00
|
|
|
return c->handler->matches_quirks(c, quirks);
|
2010-04-11 20:34:23 +04:00
|
|
|
}
|
|
|
|
|
2020-05-07 01:38:50 +03:00
|
|
|
|
|
|
|
/* exported interface documented in content/content.h */
|
2010-04-11 20:37:39 +04:00
|
|
|
bool content_is_shareable(struct content *c)
|
|
|
|
{
|
2011-05-07 00:40:09 +04:00
|
|
|
return c->handler->no_share == false;
|
2010-04-11 20:37:39 +04:00
|
|
|
}
|
|
|
|
|
2003-06-17 23:24:21 +04:00
|
|
|
|
2020-05-07 01:38:50 +03:00
|
|
|
/* exported interface documented in content/protected.h */
|
2004-04-25 03:42:32 +04:00
|
|
|
void content_broadcast(struct content *c, content_msg msg,
|
2020-05-07 01:38:50 +03:00
|
|
|
const union content_msg_data *data)
|
2003-06-17 23:24:21 +04:00
|
|
|
{
|
|
|
|
struct content_user *user, *next;
|
2005-01-13 23:26:16 +03:00
|
|
|
assert(c);
|
2017-08-26 17:50:03 +03:00
|
|
|
|
2017-09-07 20:12:09 +03:00
|
|
|
NSLOG(netsurf, DEEPDEBUG, "%p -> msg:%d", c, msg);
|
2003-06-17 23:24:21 +04:00
|
|
|
for (user = c->user_list->next; user != 0; user = next) {
|
|
|
|
next = user->next; /* user may be destroyed during callback */
|
|
|
|
if (user->callback != 0)
|
2017-08-26 18:38:18 +03:00
|
|
|
user->callback(c, msg, data, user->pw);
|
2003-06-17 23:24:21 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-05-07 01:38:50 +03:00
|
|
|
|
2012-11-26 20:24:48 +04:00
|
|
|
/* exported interface documented in content_protected.h */
|
2020-05-07 01:38:50 +03:00
|
|
|
void
|
|
|
|
content_broadcast_error(struct content *c, nserror errorcode, const char *msg)
|
2012-11-26 20:24:48 +04:00
|
|
|
{
|
|
|
|
struct content_user *user, *next;
|
|
|
|
union content_msg_data data;
|
|
|
|
|
|
|
|
assert(c);
|
|
|
|
|
2019-08-05 16:29:53 +03:00
|
|
|
data.errordata.errorcode = errorcode;
|
2019-08-05 17:25:15 +03:00
|
|
|
data.errordata.errormsg = msg;
|
2012-11-26 20:24:48 +04:00
|
|
|
|
|
|
|
for (user = c->user_list->next; user != 0; user = next) {
|
|
|
|
next = user->next; /* user may be destroyed during callback */
|
2017-08-26 18:38:18 +03:00
|
|
|
if (user->callback != 0) {
|
2019-08-05 16:29:53 +03:00
|
|
|
user->callback(c, CONTENT_MSG_ERROR,
|
2020-05-07 01:38:50 +03:00
|
|
|
&data, user->pw);
|
2017-08-26 18:38:18 +03:00
|
|
|
}
|
2012-11-26 20:24:48 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-07-15 02:57:45 +04:00
|
|
|
|
2020-05-07 01:38:50 +03:00
|
|
|
/* exported interface, documented in content/content.h */
|
2019-07-10 18:42:52 +03:00
|
|
|
nserror
|
|
|
|
content_open(hlcache_handle *h,
|
|
|
|
struct browser_window *bw,
|
|
|
|
struct content *page,
|
|
|
|
struct object_params *params)
|
2003-07-15 02:57:45 +04:00
|
|
|
{
|
2019-07-10 18:42:52 +03:00
|
|
|
struct content *c;
|
|
|
|
nserror res;
|
|
|
|
|
|
|
|
c = hlcache_handle_get_content(h);
|
2003-07-15 02:57:45 +04:00
|
|
|
assert(c != 0);
|
Use coccinelle to change logging macro calls in c files
for F in $(git ls-files '*.c');do spatch --sp-file foo.cocci --in-place ${F};done
@@ expression E; @@
-LOG(E);
+NSLOG(netsurf, INFO, E);
@@ expression E, E1; @@
-LOG(E, E1);
+NSLOG(netsurf, INFO, E, E1);
@@ expression E, E1, E2; @@
-LOG(E, E1, E2);
+NSLOG(netsurf, INFO, E, E1, E2);
@@ expression E, E1, E2, E3; @@
-LOG(E, E1, E2, E3);
+NSLOG(netsurf, INFO, E, E1, E2, E3);
@@ expression E, E1, E2, E3, E4; @@
-LOG(E, E1, E2, E3, E4);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4);
@@ expression E, E1, E2, E3, E4, E5; @@
-LOG(E, E1, E2, E3, E4, E5);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5);
@@ expression E, E1, E2, E3, E4, E5, E6; @@
-LOG(E, E1, E2, E3, E4, E5, E6);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5, E6);
@@ expression E, E1, E2, E3, E4, E5, E6, E7; @@
-LOG(E, E1, E2, E3, E4, E5, E6, E7);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5, E6, E7);
2017-09-06 20:28:12 +03:00
|
|
|
NSLOG(netsurf, INFO, "content %p %s", c,
|
2020-05-07 01:38:50 +03:00
|
|
|
nsurl_access_log(llcache_handle_get_url(c->llcache)));
|
2019-07-10 18:42:52 +03:00
|
|
|
if (c->handler->open != NULL) {
|
|
|
|
res = c->handler->open(c, bw, page, params);
|
|
|
|
} else {
|
|
|
|
res = NSERROR_OK;
|
|
|
|
}
|
|
|
|
return res;
|
2003-07-15 02:57:45 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-05-07 01:38:50 +03:00
|
|
|
/* exported interface, documented in content/content.h */
|
2019-07-10 18:42:52 +03:00
|
|
|
nserror content_close(hlcache_handle *h)
|
2003-07-15 02:57:45 +04:00
|
|
|
{
|
2019-07-10 18:42:52 +03:00
|
|
|
struct content *c;
|
|
|
|
nserror res;
|
|
|
|
|
|
|
|
c = hlcache_handle_get_content(h);
|
|
|
|
if (c == NULL) {
|
|
|
|
return NSERROR_BAD_PARAMETER;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((c->status != CONTENT_STATUS_READY) &&
|
|
|
|
(c->status != CONTENT_STATUS_DONE)) {
|
|
|
|
/* status is not read or done so nothing to do */
|
|
|
|
return NSERROR_INVALID;
|
|
|
|
}
|
|
|
|
|
Use coccinelle to change logging macro calls in c files
for F in $(git ls-files '*.c');do spatch --sp-file foo.cocci --in-place ${F};done
@@ expression E; @@
-LOG(E);
+NSLOG(netsurf, INFO, E);
@@ expression E, E1; @@
-LOG(E, E1);
+NSLOG(netsurf, INFO, E, E1);
@@ expression E, E1, E2; @@
-LOG(E, E1, E2);
+NSLOG(netsurf, INFO, E, E1, E2);
@@ expression E, E1, E2, E3; @@
-LOG(E, E1, E2, E3);
+NSLOG(netsurf, INFO, E, E1, E2, E3);
@@ expression E, E1, E2, E3, E4; @@
-LOG(E, E1, E2, E3, E4);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4);
@@ expression E, E1, E2, E3, E4, E5; @@
-LOG(E, E1, E2, E3, E4, E5);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5);
@@ expression E, E1, E2, E3, E4, E5, E6; @@
-LOG(E, E1, E2, E3, E4, E5, E6);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5, E6);
@@ expression E, E1, E2, E3, E4, E5, E6, E7; @@
-LOG(E, E1, E2, E3, E4, E5, E6, E7);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5, E6, E7);
2017-09-06 20:28:12 +03:00
|
|
|
NSLOG(netsurf, INFO, "content %p %s", c,
|
2020-05-07 01:38:50 +03:00
|
|
|
nsurl_access_log(llcache_handle_get_url(c->llcache)));
|
2020-05-12 23:09:41 +03:00
|
|
|
|
|
|
|
if (c->textsearch.context != NULL) {
|
|
|
|
content_textsearch_destroy(c->textsearch.context);
|
|
|
|
c->textsearch.context = NULL;
|
|
|
|
}
|
|
|
|
|
2019-07-10 18:42:52 +03:00
|
|
|
if (c->handler->close != NULL) {
|
|
|
|
res = c->handler->close(c);
|
|
|
|
} else {
|
|
|
|
res = NSERROR_OK;
|
|
|
|
}
|
|
|
|
return res;
|
2003-07-15 02:57:45 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-05-07 01:38:50 +03:00
|
|
|
/* exported interface, documented in content/content.h */
|
2013-02-22 16:19:35 +04:00
|
|
|
void content_clear_selection(hlcache_handle *h)
|
|
|
|
{
|
|
|
|
struct content *c = hlcache_handle_get_content(h);
|
|
|
|
assert(c != 0);
|
|
|
|
|
|
|
|
if (c->handler->get_selection != NULL)
|
|
|
|
c->handler->clear_selection(c);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-05-07 01:38:50 +03:00
|
|
|
/* exported interface, documented in content/content.h */
|
2013-02-22 16:19:35 +04:00
|
|
|
char * content_get_selection(hlcache_handle *h)
|
2011-07-13 17:20:26 +04:00
|
|
|
{
|
|
|
|
struct content *c = hlcache_handle_get_content(h);
|
|
|
|
assert(c != 0);
|
|
|
|
|
|
|
|
if (c->handler->get_selection != NULL)
|
|
|
|
return c->handler->get_selection(c);
|
|
|
|
else
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2020-05-07 01:38:50 +03:00
|
|
|
|
2014-11-02 18:46:42 +03:00
|
|
|
/* exported interface documented in content/content.h */
|
2020-05-07 01:38:50 +03:00
|
|
|
nserror
|
|
|
|
content_get_contextual_content(struct hlcache_handle *h,
|
|
|
|
int x, int y,
|
|
|
|
struct browser_window_features *data)
|
2011-09-06 22:07:30 +04:00
|
|
|
{
|
|
|
|
struct content *c = hlcache_handle_get_content(h);
|
|
|
|
assert(c != 0);
|
|
|
|
|
|
|
|
if (c->handler->get_contextual_content != NULL) {
|
2014-11-02 18:46:42 +03:00
|
|
|
return c->handler->get_contextual_content(c, x, y, data);
|
2011-09-06 22:07:30 +04:00
|
|
|
}
|
2014-11-02 18:46:42 +03:00
|
|
|
|
|
|
|
data->object = h;
|
|
|
|
return NSERROR_OK;
|
2011-09-06 22:07:30 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-05-07 01:38:50 +03:00
|
|
|
/* exported interface, documented in content/content.h */
|
|
|
|
bool
|
|
|
|
content_scroll_at_point(struct hlcache_handle *h,
|
|
|
|
int x, int y,
|
|
|
|
int scrx, int scry)
|
2011-11-29 21:47:29 +04:00
|
|
|
{
|
|
|
|
struct content *c = hlcache_handle_get_content(h);
|
|
|
|
assert(c != 0);
|
|
|
|
|
|
|
|
if (c->handler->scroll_at_point != NULL)
|
|
|
|
return c->handler->scroll_at_point(c, x, y, scrx, scry);
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-05-07 01:38:50 +03:00
|
|
|
/* exported interface, documented in content/content.h */
|
|
|
|
bool
|
|
|
|
content_drop_file_at_point(struct hlcache_handle *h,
|
|
|
|
int x, int y,
|
|
|
|
char *file)
|
2011-12-02 01:49:57 +04:00
|
|
|
{
|
|
|
|
struct content *c = hlcache_handle_get_content(h);
|
|
|
|
assert(c != 0);
|
|
|
|
|
|
|
|
if (c->handler->drop_file_at_point != NULL)
|
|
|
|
return c->handler->drop_file_at_point(c, x, y, file);
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-08-04 03:36:14 +04:00
|
|
|
/* exported interface documented in content/content.h */
|
2020-05-07 01:38:50 +03:00
|
|
|
nserror
|
|
|
|
content_debug_dump(struct hlcache_handle *h, FILE *f, enum content_debug op)
|
2012-08-20 19:03:45 +04:00
|
|
|
{
|
|
|
|
struct content *c = hlcache_handle_get_content(h);
|
|
|
|
assert(c != 0);
|
|
|
|
|
2014-08-04 03:36:14 +04:00
|
|
|
if (c->handler->debug_dump == NULL) {
|
|
|
|
return NSERROR_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
return c->handler->debug_dump(c, f, op);
|
2012-08-20 19:03:45 +04:00
|
|
|
}
|
|
|
|
|
2020-05-07 01:38:50 +03:00
|
|
|
|
2014-11-07 01:51:46 +03:00
|
|
|
/* exported interface documented in content/content.h */
|
|
|
|
nserror content_debug(struct hlcache_handle *h, enum content_debug op)
|
|
|
|
{
|
|
|
|
struct content *c = hlcache_handle_get_content(h);
|
|
|
|
|
|
|
|
if (c == NULL) {
|
|
|
|
return NSERROR_BAD_PARAMETER;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (c->handler->debug == NULL) {
|
|
|
|
return NSERROR_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
return c->handler->debug(c, op);
|
|
|
|
}
|
|
|
|
|
2012-08-20 19:03:45 +04:00
|
|
|
|
2014-11-09 01:08:29 +03:00
|
|
|
/* exported interface documented in content/content.h */
|
2011-10-07 22:12:47 +04:00
|
|
|
struct content_rfc5988_link *
|
|
|
|
content_find_rfc5988_link(hlcache_handle *h, lwc_string *rel)
|
|
|
|
{
|
|
|
|
struct content *c = hlcache_handle_get_content(h);
|
|
|
|
struct content_rfc5988_link *link = c->links;
|
|
|
|
bool rel_match = false;
|
|
|
|
|
|
|
|
while (link != NULL) {
|
2012-08-09 19:33:06 +04:00
|
|
|
if (lwc_string_caseless_isequal(link->rel, rel,
|
2020-05-07 01:38:50 +03:00
|
|
|
&rel_match) == lwc_error_ok && rel_match) {
|
2011-10-07 22:12:47 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
link = link->next;
|
|
|
|
}
|
|
|
|
return link;
|
|
|
|
}
|
|
|
|
|
2020-05-07 01:38:50 +03:00
|
|
|
|
|
|
|
/* exported interface documented in content/protected.h */
|
2011-10-07 22:12:47 +04:00
|
|
|
struct content_rfc5988_link *
|
2019-07-10 18:42:52 +03:00
|
|
|
content__free_rfc5988_link(struct content_rfc5988_link *link)
|
2011-10-07 22:12:47 +04:00
|
|
|
{
|
|
|
|
struct content_rfc5988_link *next;
|
|
|
|
|
|
|
|
next = link->next;
|
|
|
|
|
|
|
|
lwc_string_unref(link->rel);
|
|
|
|
nsurl_unref(link->href);
|
|
|
|
if (link->hreflang != NULL) {
|
|
|
|
lwc_string_unref(link->hreflang);
|
|
|
|
}
|
|
|
|
if (link->type != NULL) {
|
|
|
|
lwc_string_unref(link->type);
|
|
|
|
}
|
|
|
|
if (link->media != NULL) {
|
|
|
|
lwc_string_unref(link->media);
|
|
|
|
}
|
|
|
|
if (link->sizes != NULL) {
|
|
|
|
lwc_string_unref(link->sizes);
|
|
|
|
}
|
|
|
|
free(link);
|
|
|
|
|
|
|
|
return next;
|
|
|
|
}
|
|
|
|
|
2020-05-07 01:38:50 +03:00
|
|
|
|
|
|
|
/* exported interface documented in content/protected.h */
|
|
|
|
bool
|
|
|
|
content__add_rfc5988_link(struct content *c,
|
|
|
|
const struct content_rfc5988_link *link)
|
2011-10-07 22:12:47 +04:00
|
|
|
{
|
2019-07-10 18:42:52 +03:00
|
|
|
struct content_rfc5988_link *newlink;
|
2011-10-07 22:12:47 +04:00
|
|
|
union content_msg_data msg_data;
|
|
|
|
|
|
|
|
/* a link relation must be present for it to be a link */
|
|
|
|
if (link->rel == NULL) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* a link href must be present for it to be a link */
|
|
|
|
if (link->href == NULL) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
newlink = calloc(1, sizeof(struct content_rfc5988_link));
|
|
|
|
if (newlink == NULL) {
|
2019-07-10 18:42:52 +03:00
|
|
|
return false;
|
2011-10-07 22:12:47 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* copy values */
|
|
|
|
newlink->rel = lwc_string_ref(link->rel);
|
|
|
|
newlink->href = nsurl_ref(link->href);
|
|
|
|
if (link->hreflang != NULL) {
|
|
|
|
newlink->hreflang = lwc_string_ref(link->hreflang);
|
|
|
|
}
|
|
|
|
if (link->type != NULL) {
|
|
|
|
newlink->type = lwc_string_ref(link->type);
|
|
|
|
}
|
|
|
|
if (link->media != NULL) {
|
|
|
|
newlink->media = lwc_string_ref(link->media);
|
|
|
|
}
|
|
|
|
if (link->sizes != NULL) {
|
|
|
|
newlink->sizes = lwc_string_ref(link->sizes);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* add to metadata link to list */
|
|
|
|
newlink->next = c->links;
|
|
|
|
c->links = newlink;
|
|
|
|
|
|
|
|
/* broadcast the data */
|
|
|
|
msg_data.rfc5988_link = newlink;
|
2017-08-26 17:50:03 +03:00
|
|
|
content_broadcast(c, CONTENT_MSG_LINK, &msg_data);
|
2011-10-07 22:12:47 +04:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2014-11-09 01:08:29 +03:00
|
|
|
|
2016-06-06 10:59:23 +03:00
|
|
|
/* exported interface documented in content/content.h */
|
2014-11-09 01:08:29 +03:00
|
|
|
nsurl *content_get_url(struct content *c)
|
|
|
|
{
|
|
|
|
if (c == NULL)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
return llcache_handle_get_url(c->llcache);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* exported interface documented in content/content.h */
|
2010-03-28 16:56:39 +04:00
|
|
|
content_type content_get_type(hlcache_handle *h)
|
|
|
|
{
|
2011-05-07 00:40:09 +04:00
|
|
|
struct content *c = hlcache_handle_get_content(h);
|
2010-03-28 16:56:39 +04:00
|
|
|
|
|
|
|
if (c == NULL)
|
2011-05-07 00:40:09 +04:00
|
|
|
return CONTENT_NONE;
|
2010-03-28 16:56:39 +04:00
|
|
|
|
2011-09-03 13:27:42 +04:00
|
|
|
return c->handler->type();
|
2010-03-28 16:56:39 +04:00
|
|
|
}
|
|
|
|
|
2014-11-09 01:08:29 +03:00
|
|
|
|
|
|
|
/* exported interface documented in content/content.h */
|
2011-05-07 00:40:09 +04:00
|
|
|
lwc_string *content_get_mime_type(hlcache_handle *h)
|
2010-04-07 13:12:09 +04:00
|
|
|
{
|
|
|
|
return content__get_mime_type(hlcache_handle_get_content(h));
|
|
|
|
}
|
|
|
|
|
2020-05-07 01:38:50 +03:00
|
|
|
|
2014-11-09 01:08:29 +03:00
|
|
|
/* exported interface documented in content/content_protected.h */
|
2011-05-07 00:40:09 +04:00
|
|
|
lwc_string *content__get_mime_type(struct content *c)
|
2010-04-07 13:12:09 +04:00
|
|
|
{
|
|
|
|
if (c == NULL)
|
|
|
|
return NULL;
|
|
|
|
|
2011-05-07 00:40:09 +04:00
|
|
|
return lwc_string_ref(c->mime_type);
|
2010-04-07 13:12:09 +04:00
|
|
|
}
|
|
|
|
|
2014-11-09 01:08:29 +03:00
|
|
|
|
|
|
|
/* exported interface documented in content/content_protected.h */
|
|
|
|
bool content__set_title(struct content *c, const char *title)
|
2010-03-28 16:56:39 +04:00
|
|
|
{
|
2014-11-09 01:08:29 +03:00
|
|
|
char *new_title = strdup(title);
|
|
|
|
if (new_title == NULL)
|
|
|
|
return false;
|
2010-03-28 16:56:39 +04:00
|
|
|
|
2014-11-09 01:08:29 +03:00
|
|
|
if (c->title != NULL)
|
|
|
|
free(c->title);
|
|
|
|
|
|
|
|
c->title = new_title;
|
|
|
|
|
|
|
|
return true;
|
2010-03-28 16:56:39 +04:00
|
|
|
}
|
|
|
|
|
2014-11-09 01:08:29 +03:00
|
|
|
|
|
|
|
/* exported interface documented in content/content.h */
|
2010-03-28 16:56:39 +04:00
|
|
|
const char *content_get_title(hlcache_handle *h)
|
|
|
|
{
|
|
|
|
return content__get_title(hlcache_handle_get_content(h));
|
|
|
|
}
|
|
|
|
|
2020-05-07 01:38:50 +03:00
|
|
|
|
2014-11-09 01:08:29 +03:00
|
|
|
/* exported interface documented in content/content_protected.h */
|
2010-03-28 16:56:39 +04:00
|
|
|
const char *content__get_title(struct content *c)
|
|
|
|
{
|
|
|
|
if (c == NULL)
|
|
|
|
return NULL;
|
|
|
|
|
2011-09-28 18:21:35 +04:00
|
|
|
return c->title != NULL ? c->title :
|
2020-05-07 01:38:50 +03:00
|
|
|
nsurl_access(llcache_handle_get_url(c->llcache));
|
2010-03-28 16:56:39 +04:00
|
|
|
}
|
|
|
|
|
2014-11-09 01:08:29 +03:00
|
|
|
|
|
|
|
/* exported interface documented in content/content.h */
|
2010-03-28 16:56:39 +04:00
|
|
|
content_status content_get_status(hlcache_handle *h)
|
|
|
|
{
|
|
|
|
return content__get_status(hlcache_handle_get_content(h));
|
|
|
|
}
|
|
|
|
|
2020-05-07 01:38:50 +03:00
|
|
|
|
2014-11-09 01:08:29 +03:00
|
|
|
/* exported interface documented in content/content_protected.h */
|
2010-03-28 16:56:39 +04:00
|
|
|
content_status content__get_status(struct content *c)
|
|
|
|
{
|
|
|
|
if (c == NULL)
|
2011-02-28 23:38:23 +03:00
|
|
|
return CONTENT_STATUS_ERROR;
|
2010-03-28 16:56:39 +04:00
|
|
|
|
|
|
|
return c->status;
|
|
|
|
}
|
|
|
|
|
2014-11-09 01:08:29 +03:00
|
|
|
|
|
|
|
/* exported interface documented in content/content.h */
|
2010-03-28 16:56:39 +04:00
|
|
|
const char *content_get_status_message(hlcache_handle *h)
|
|
|
|
{
|
|
|
|
return content__get_status_message(hlcache_handle_get_content(h));
|
|
|
|
}
|
|
|
|
|
2020-05-07 01:38:50 +03:00
|
|
|
|
2014-11-09 01:08:29 +03:00
|
|
|
/* exported interface documented in content/content_protected.h */
|
2010-03-28 16:56:39 +04:00
|
|
|
const char *content__get_status_message(struct content *c)
|
|
|
|
{
|
|
|
|
if (c == NULL)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
return c->status_message;
|
|
|
|
}
|
|
|
|
|
2014-11-09 01:08:29 +03:00
|
|
|
|
|
|
|
/* exported interface documented in content/content.h */
|
2010-03-28 16:56:39 +04:00
|
|
|
int content_get_width(hlcache_handle *h)
|
|
|
|
{
|
|
|
|
return content__get_width(hlcache_handle_get_content(h));
|
|
|
|
}
|
|
|
|
|
2020-05-07 01:38:50 +03:00
|
|
|
|
2014-11-09 01:08:29 +03:00
|
|
|
/* exported interface documented in content/content_protected.h */
|
2010-03-28 16:56:39 +04:00
|
|
|
int content__get_width(struct content *c)
|
|
|
|
{
|
|
|
|
if (c == NULL)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
return c->width;
|
|
|
|
}
|
|
|
|
|
2014-11-09 01:08:29 +03:00
|
|
|
|
|
|
|
/* exported interface documented in content/content.h */
|
2010-03-28 16:56:39 +04:00
|
|
|
int content_get_height(hlcache_handle *h)
|
|
|
|
{
|
|
|
|
return content__get_height(hlcache_handle_get_content(h));
|
|
|
|
}
|
|
|
|
|
2020-05-07 01:38:50 +03:00
|
|
|
|
2014-11-09 01:08:29 +03:00
|
|
|
/* exported interface documented in content/content_protected.h */
|
2010-03-28 16:56:39 +04:00
|
|
|
int content__get_height(struct content *c)
|
|
|
|
{
|
|
|
|
if (c == NULL)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
return c->height;
|
|
|
|
}
|
|
|
|
|
2014-11-09 01:08:29 +03:00
|
|
|
|
|
|
|
/* exported interface documented in content/content.h */
|
2010-03-28 16:56:39 +04:00
|
|
|
int content_get_available_width(hlcache_handle *h)
|
|
|
|
{
|
|
|
|
return content__get_available_width(hlcache_handle_get_content(h));
|
|
|
|
}
|
|
|
|
|
2020-05-07 01:38:50 +03:00
|
|
|
|
2014-11-09 01:08:29 +03:00
|
|
|
/* exported interface documented in content/content_protected.h */
|
2010-03-28 16:56:39 +04:00
|
|
|
int content__get_available_width(struct content *c)
|
|
|
|
{
|
|
|
|
if (c == NULL)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
return c->available_width;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-11-09 01:08:29 +03:00
|
|
|
/* exported interface documented in content/content.h */
|
2019-05-06 00:46:40 +03:00
|
|
|
const uint8_t *content_get_source_data(hlcache_handle *h, size_t *size)
|
2010-03-28 16:56:39 +04:00
|
|
|
{
|
|
|
|
return content__get_source_data(hlcache_handle_get_content(h), size);
|
|
|
|
}
|
|
|
|
|
2020-05-07 01:38:50 +03:00
|
|
|
|
2014-11-09 01:08:29 +03:00
|
|
|
/* exported interface documented in content/content_protected.h */
|
2019-05-06 00:46:40 +03:00
|
|
|
const uint8_t *content__get_source_data(struct content *c, size_t *size)
|
2010-03-28 16:56:39 +04:00
|
|
|
{
|
|
|
|
assert(size != NULL);
|
|
|
|
|
2019-05-06 00:46:40 +03:00
|
|
|
/** \todo check if the content check should be an assert */
|
2010-03-28 16:56:39 +04:00
|
|
|
if (c == NULL)
|
|
|
|
return NULL;
|
|
|
|
|
2019-05-06 00:46:40 +03:00
|
|
|
return llcache_handle_get_source_data(c->llcache, size);
|
2010-03-28 16:56:39 +04:00
|
|
|
}
|
|
|
|
|
2020-05-07 01:38:50 +03:00
|
|
|
|
2014-11-08 19:49:32 +03:00
|
|
|
/* exported interface documented in content/content.h */
|
2010-03-28 16:56:39 +04:00
|
|
|
void content_invalidate_reuse_data(hlcache_handle *h)
|
|
|
|
{
|
|
|
|
content__invalidate_reuse_data(hlcache_handle_get_content(h));
|
|
|
|
}
|
|
|
|
|
2020-05-07 01:38:50 +03:00
|
|
|
|
2014-11-08 19:49:32 +03:00
|
|
|
/* exported interface documented in content/content_protected.h */
|
2010-03-28 16:56:39 +04:00
|
|
|
void content__invalidate_reuse_data(struct content *c)
|
|
|
|
{
|
2010-04-17 00:43:36 +04:00
|
|
|
if (c == NULL || c->llcache == NULL)
|
2010-03-28 16:56:39 +04:00
|
|
|
return;
|
|
|
|
|
2010-04-17 00:43:36 +04:00
|
|
|
/* Invalidate low-level cache data */
|
|
|
|
llcache_handle_invalidate_cache_data(c->llcache);
|
2010-03-28 16:56:39 +04:00
|
|
|
}
|
|
|
|
|
2020-05-07 01:38:50 +03:00
|
|
|
|
2014-11-08 19:49:32 +03:00
|
|
|
/* exported interface documented in content/content.h */
|
2011-10-03 19:56:47 +04:00
|
|
|
nsurl *content_get_refresh_url(hlcache_handle *h)
|
2010-03-28 16:56:39 +04:00
|
|
|
{
|
|
|
|
return content__get_refresh_url(hlcache_handle_get_content(h));
|
|
|
|
}
|
|
|
|
|
2020-05-07 01:38:50 +03:00
|
|
|
|
2014-11-08 19:49:32 +03:00
|
|
|
/* exported interface documented in content/content_protected.h */
|
2011-10-03 19:56:47 +04:00
|
|
|
nsurl *content__get_refresh_url(struct content *c)
|
2010-03-28 16:56:39 +04:00
|
|
|
{
|
|
|
|
if (c == NULL)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
return c->refresh;
|
|
|
|
}
|
|
|
|
|
2011-08-31 16:12:41 +04:00
|
|
|
|
2014-11-08 19:49:32 +03:00
|
|
|
/* exported interface documented in content/content.h */
|
2010-03-28 16:56:39 +04:00
|
|
|
struct bitmap *content_get_bitmap(hlcache_handle *h)
|
|
|
|
{
|
|
|
|
return content__get_bitmap(hlcache_handle_get_content(h));
|
|
|
|
}
|
|
|
|
|
2014-11-08 19:49:32 +03:00
|
|
|
|
|
|
|
/* exported interface documented in content/content_protected.h */
|
2010-03-28 16:56:39 +04:00
|
|
|
struct bitmap *content__get_bitmap(struct content *c)
|
|
|
|
{
|
2011-08-31 16:12:41 +04:00
|
|
|
struct bitmap *bitmap = NULL;
|
|
|
|
|
2019-07-10 18:42:52 +03:00
|
|
|
if ((c != NULL) &&
|
|
|
|
(c->handler != NULL) &&
|
|
|
|
(c->handler->type != NULL) &&
|
2011-09-03 13:27:42 +04:00
|
|
|
(c->handler->type() == CONTENT_IMAGE) &&
|
2011-08-31 16:12:41 +04:00
|
|
|
(c->handler->get_internal != NULL) ) {
|
|
|
|
bitmap = c->handler->get_internal(c, NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
return bitmap;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-11-08 19:49:32 +03:00
|
|
|
/* exported interface documented in content/content.h */
|
2011-08-31 16:12:41 +04:00
|
|
|
bool content_get_opaque(hlcache_handle *h)
|
|
|
|
{
|
|
|
|
return content__get_opaque(hlcache_handle_get_content(h));
|
|
|
|
}
|
|
|
|
|
2014-11-08 19:49:32 +03:00
|
|
|
|
|
|
|
/* exported interface documented in content/content_protected.h */
|
2011-08-31 16:12:41 +04:00
|
|
|
bool content__get_opaque(struct content *c)
|
|
|
|
{
|
2019-07-10 18:42:52 +03:00
|
|
|
if ((c != NULL) &&
|
|
|
|
(c->handler != NULL) &&
|
2020-05-13 21:03:14 +03:00
|
|
|
(c->handler->is_opaque != NULL)) {
|
|
|
|
return c->handler->is_opaque(c);
|
2011-08-31 16:12:41 +04:00
|
|
|
}
|
2010-03-28 16:56:39 +04:00
|
|
|
|
2020-05-13 21:03:14 +03:00
|
|
|
return false;
|
2010-03-28 16:56:39 +04:00
|
|
|
}
|
|
|
|
|
2010-04-17 00:54:57 +04:00
|
|
|
|
2014-11-08 19:49:32 +03:00
|
|
|
/* exported interface documented in content/content.h */
|
2010-04-17 00:54:57 +04:00
|
|
|
bool content_get_quirks(hlcache_handle *h)
|
|
|
|
{
|
|
|
|
struct content *c = hlcache_handle_get_content(h);
|
|
|
|
|
|
|
|
if (c == NULL)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
return c->quirks;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-11-08 19:49:32 +03:00
|
|
|
/* exported interface documented in content/content.h */
|
2020-05-07 01:38:50 +03:00
|
|
|
const char *
|
|
|
|
content_get_encoding(hlcache_handle *h, enum content_encoding_type op)
|
2014-11-06 02:44:31 +03:00
|
|
|
{
|
2014-11-07 15:33:34 +03:00
|
|
|
return content__get_encoding(hlcache_handle_get_content(h), op);
|
2014-11-06 02:44:31 +03:00
|
|
|
}
|
|
|
|
|
2014-11-08 19:49:32 +03:00
|
|
|
|
|
|
|
/* exported interface documented in content/content_protected.h */
|
2020-05-07 01:38:50 +03:00
|
|
|
const char *
|
|
|
|
content__get_encoding(struct content *c, enum content_encoding_type op)
|
2014-11-06 02:44:31 +03:00
|
|
|
{
|
|
|
|
const char *encoding = NULL;
|
|
|
|
|
|
|
|
if ((c != NULL) &&
|
|
|
|
(c->handler != NULL) &&
|
|
|
|
(c->handler->get_encoding != NULL) ) {
|
2014-11-07 15:33:34 +03:00
|
|
|
encoding = c->handler->get_encoding(c, op);
|
2014-11-06 02:44:31 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
return encoding;
|
|
|
|
}
|
|
|
|
|
2010-04-07 22:50:18 +04:00
|
|
|
|
2014-11-08 19:49:32 +03:00
|
|
|
/* exported interface documented in content/content.h */
|
2010-04-07 22:50:18 +04:00
|
|
|
bool content_is_locked(hlcache_handle *h)
|
|
|
|
{
|
|
|
|
return content__is_locked(hlcache_handle_get_content(h));
|
|
|
|
}
|
|
|
|
|
2014-11-08 19:49:32 +03:00
|
|
|
|
|
|
|
/* exported interface documented in content/content_protected.h */
|
2010-04-07 22:50:18 +04:00
|
|
|
bool content__is_locked(struct content *c)
|
|
|
|
{
|
|
|
|
return c->locked;
|
|
|
|
}
|
|
|
|
|
2020-05-07 01:38:50 +03:00
|
|
|
|
|
|
|
/* exported interface documented in content/content.h */
|
2010-03-28 16:56:39 +04:00
|
|
|
const llcache_handle *content_get_llcache_handle(struct content *c)
|
|
|
|
{
|
|
|
|
if (c == NULL)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
return c->llcache;
|
|
|
|
}
|
|
|
|
|
2020-05-07 01:38:50 +03:00
|
|
|
|
|
|
|
/* exported interface documented in content/protected.h */
|
2010-04-04 16:41:19 +04:00
|
|
|
struct content *content_clone(struct content *c)
|
|
|
|
{
|
2011-05-07 00:40:09 +04:00
|
|
|
struct content *nc;
|
|
|
|
nserror error;
|
2010-04-04 16:41:19 +04:00
|
|
|
|
2011-05-07 00:40:09 +04:00
|
|
|
error = c->handler->clone(c, &nc);
|
|
|
|
if (error != NSERROR_OK)
|
2010-04-04 16:41:19 +04:00
|
|
|
return NULL;
|
2011-05-07 00:40:09 +04:00
|
|
|
|
|
|
|
return nc;
|
|
|
|
};
|
|
|
|
|
2020-05-07 01:38:50 +03:00
|
|
|
|
|
|
|
/* exported interface documented in content/protected.h */
|
2011-05-07 00:40:09 +04:00
|
|
|
nserror content__clone(const struct content *c, struct content *nc)
|
|
|
|
{
|
|
|
|
nserror error;
|
|
|
|
|
|
|
|
error = llcache_handle_clone(c->llcache, &(nc->llcache));
|
|
|
|
if (error != NSERROR_OK) {
|
|
|
|
return error;
|
2010-04-04 16:41:19 +04:00
|
|
|
}
|
2013-05-04 19:50:59 +04:00
|
|
|
|
|
|
|
llcache_handle_change_callback(nc->llcache,
|
|
|
|
content_llcache_callback, nc);
|
2010-04-04 16:41:19 +04:00
|
|
|
|
2011-05-07 00:40:09 +04:00
|
|
|
nc->mime_type = lwc_string_ref(c->mime_type);
|
|
|
|
nc->handler = c->handler;
|
2010-04-04 16:41:19 +04:00
|
|
|
|
|
|
|
nc->status = c->status;
|
2013-05-04 19:50:59 +04:00
|
|
|
|
2010-04-04 16:41:19 +04:00
|
|
|
nc->width = c->width;
|
|
|
|
nc->height = c->height;
|
|
|
|
nc->available_width = c->available_width;
|
|
|
|
nc->quirks = c->quirks;
|
2013-05-04 19:50:59 +04:00
|
|
|
|
2010-04-04 16:41:19 +04:00
|
|
|
if (c->fallback_charset != NULL) {
|
2012-10-03 22:24:58 +04:00
|
|
|
nc->fallback_charset = strdup(c->fallback_charset);
|
2010-04-04 16:41:19 +04:00
|
|
|
if (nc->fallback_charset == NULL) {
|
2011-05-07 00:40:09 +04:00
|
|
|
return NSERROR_NOMEM;
|
2010-04-04 16:41:19 +04:00
|
|
|
}
|
|
|
|
}
|
2013-05-04 19:50:59 +04:00
|
|
|
|
2010-04-04 16:41:19 +04:00
|
|
|
if (c->refresh != NULL) {
|
2011-10-03 19:56:47 +04:00
|
|
|
nc->refresh = nsurl_ref(c->refresh);
|
2010-04-04 16:41:19 +04:00
|
|
|
if (nc->refresh == NULL) {
|
2011-05-07 00:40:09 +04:00
|
|
|
return NSERROR_NOMEM;
|
2010-04-04 16:41:19 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
nc->time = c->time;
|
|
|
|
nc->reformat_time = c->reformat_time;
|
|
|
|
nc->size = c->size;
|
2013-05-04 19:50:59 +04:00
|
|
|
|
2010-04-04 16:41:19 +04:00
|
|
|
if (c->title != NULL) {
|
2012-10-03 22:24:58 +04:00
|
|
|
nc->title = strdup(c->title);
|
2010-04-04 16:41:19 +04:00
|
|
|
if (nc->title == NULL) {
|
2011-05-07 00:40:09 +04:00
|
|
|
return NSERROR_NOMEM;
|
2010-04-04 16:41:19 +04:00
|
|
|
}
|
|
|
|
}
|
2013-05-04 19:50:59 +04:00
|
|
|
|
2010-04-04 16:41:19 +04:00
|
|
|
nc->active = c->active;
|
2011-09-18 04:49:34 +04:00
|
|
|
|
2013-05-04 19:50:59 +04:00
|
|
|
nc->user_list = calloc(1, sizeof(struct content_user));
|
|
|
|
if (nc->user_list == NULL) {
|
|
|
|
return NSERROR_NOMEM;
|
|
|
|
}
|
|
|
|
|
2010-04-04 16:41:19 +04:00
|
|
|
memcpy(&(nc->status_message), &(c->status_message), 120);
|
|
|
|
memcpy(&(nc->sub_status), &(c->sub_status), 80);
|
2013-05-04 19:50:59 +04:00
|
|
|
|
2010-04-04 16:41:19 +04:00
|
|
|
nc->locked = c->locked;
|
|
|
|
nc->total_size = c->total_size;
|
|
|
|
nc->http_code = c->http_code;
|
2019-07-10 18:42:52 +03:00
|
|
|
|
2011-05-07 00:40:09 +04:00
|
|
|
return NSERROR_OK;
|
2010-04-04 16:41:19 +04:00
|
|
|
}
|
|
|
|
|
2020-05-07 01:38:50 +03:00
|
|
|
|
|
|
|
/* exported interface documented in content/content.h */
|
2010-04-04 16:41:19 +04:00
|
|
|
nserror content_abort(struct content *c)
|
|
|
|
{
|
Use coccinelle to change logging macro calls in c files
for F in $(git ls-files '*.c');do spatch --sp-file foo.cocci --in-place ${F};done
@@ expression E; @@
-LOG(E);
+NSLOG(netsurf, INFO, E);
@@ expression E, E1; @@
-LOG(E, E1);
+NSLOG(netsurf, INFO, E, E1);
@@ expression E, E1, E2; @@
-LOG(E, E1, E2);
+NSLOG(netsurf, INFO, E, E1, E2);
@@ expression E, E1, E2, E3; @@
-LOG(E, E1, E2, E3);
+NSLOG(netsurf, INFO, E, E1, E2, E3);
@@ expression E, E1, E2, E3, E4; @@
-LOG(E, E1, E2, E3, E4);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4);
@@ expression E, E1, E2, E3, E4, E5; @@
-LOG(E, E1, E2, E3, E4, E5);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5);
@@ expression E, E1, E2, E3, E4, E5, E6; @@
-LOG(E, E1, E2, E3, E4, E5, E6);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5, E6);
@@ expression E, E1, E2, E3, E4, E5, E6, E7; @@
-LOG(E, E1, E2, E3, E4, E5, E6, E7);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5, E6, E7);
2017-09-06 20:28:12 +03:00
|
|
|
NSLOG(netsurf, INFO, "Aborting %p", c);
|
2019-07-10 18:42:52 +03:00
|
|
|
|
2011-07-20 00:23:59 +04:00
|
|
|
if (c->handler->stop != NULL)
|
|
|
|
c->handler->stop(c);
|
2019-07-10 18:42:52 +03:00
|
|
|
|
2010-04-04 16:41:19 +04:00
|
|
|
/* And for now, abort our llcache object */
|
|
|
|
return llcache_handle_abort(c->llcache);
|
|
|
|
}
|