mirror of
https://github.com/rkd77/elinks.git
synced 2024-12-04 14:46:47 -05:00
Add a read-only .uri property to the cache_entry class.
This commit is contained in:
parent
217f905d88
commit
c0fd25b368
@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
#include "cache/cache.h"
|
#include "cache/cache.h"
|
||||||
#include "ecmascript/spidermonkey/util.h"
|
#include "ecmascript/spidermonkey/util.h"
|
||||||
|
#include "protocol/uri.h"
|
||||||
#include "scripting/smjs/cache_object.h"
|
#include "scripting/smjs/cache_object.h"
|
||||||
#include "scripting/smjs/core.h"
|
#include "scripting/smjs/core.h"
|
||||||
#include "util/error.h"
|
#include "util/error.h"
|
||||||
@ -18,6 +19,7 @@ enum cache_entry_prop {
|
|||||||
CACHE_ENTRY_TYPE,
|
CACHE_ENTRY_TYPE,
|
||||||
CACHE_ENTRY_LENGTH,
|
CACHE_ENTRY_LENGTH,
|
||||||
CACHE_ENTRY_HEAD,
|
CACHE_ENTRY_HEAD,
|
||||||
|
CACHE_ENTRY_URI,
|
||||||
};
|
};
|
||||||
|
|
||||||
static const JSPropertySpec cache_entry_props[] = {
|
static const JSPropertySpec cache_entry_props[] = {
|
||||||
@ -25,6 +27,7 @@ static const JSPropertySpec cache_entry_props[] = {
|
|||||||
{ "type", CACHE_ENTRY_TYPE, JSPROP_ENUMERATE },
|
{ "type", CACHE_ENTRY_TYPE, JSPROP_ENUMERATE },
|
||||||
{ "length", CACHE_ENTRY_LENGTH, JSPROP_ENUMERATE | JSPROP_READONLY },
|
{ "length", CACHE_ENTRY_LENGTH, JSPROP_ENUMERATE | JSPROP_READONLY },
|
||||||
{ "head", CACHE_ENTRY_HEAD, JSPROP_ENUMERATE },
|
{ "head", CACHE_ENTRY_HEAD, JSPROP_ENUMERATE },
|
||||||
|
{ "uri", CACHE_ENTRY_URI, JSPROP_ENUMERATE | JSPROP_READONLY },
|
||||||
{ NULL }
|
{ NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -65,6 +68,11 @@ cache_entry_get_property(JSContext *ctx, JSObject *obj, jsval id, jsval *vp)
|
|||||||
case CACHE_ENTRY_LENGTH:
|
case CACHE_ENTRY_LENGTH:
|
||||||
*vp = INT_TO_JSVAL(cached->length);
|
*vp = INT_TO_JSVAL(cached->length);
|
||||||
|
|
||||||
|
return JS_TRUE;
|
||||||
|
case CACHE_ENTRY_URI:
|
||||||
|
*vp = STRING_TO_JSVAL(JS_NewStringCopyZ(smjs_ctx,
|
||||||
|
struri(cached->uri)));
|
||||||
|
|
||||||
return JS_TRUE;
|
return JS_TRUE;
|
||||||
default:
|
default:
|
||||||
INTERNAL("Invalid ID %d in cache_entry_get_property().",
|
INTERNAL("Invalid ID %d in cache_entry_get_property().",
|
||||||
|
Loading…
Reference in New Issue
Block a user