2024-11-24 14:22 UTC

View Issue Details Jump to Notes ]
IDProjectCategoryView StatusLast Update
0002519NetSurfJavascriptpublic2017-01-29 11:36
Reporteragrecascino 
Assigned To 
SeverityfeatureReproducibilityN/A 
StatusacknowledgedResolutionopen 
PlatformGTKOSFedora Linux x86_64OS Version25
Product Version3.7 
Target VersionFixed in Version 
Summary0002519: Add setter for Document::cookie
DescriptionAttachment should add Document::cookie setter, allowing for javascript cookies.
TagsNo tags attached.
Fixed in CI build #
Reported in CI build #
URL of problem page
Attached Files
  • patch file icon cookie.patch (1,066 bytes) 2017-01-29 01:54 -
    --- /home/arecascino/netsurf/content/handlers/javascript/duktape/Document.bnd	2017-01-28 20:48:26.692910841 -0500
    +++ Document.bnd	2017-01-28 20:34:03.511604936 -0500
    @@ -317,6 +317,29 @@
     	return 0;
     %}
     
    +setter Document::cookie()
    +%{
    +    /* DISCLAIMER: ONLY WORKS ON REMOTE URLS */
    +    const char *cookie_str;
    +    struct html_content *htmlc;
    +    dom_exception err;   
    +    err = dom_node_get_user_data(priv->parent.node,
    +                     corestring_dom___ns_key_html_content_data,
    +                     &htmlc);
    +    if((err == DOM_NO_ERR) && (htmlc != NULL)) {
    +        cookie_str = duk_get_string(ctx,0);
    +        if(cookie_str != NULL) {
    +            urldb_set_cookie(cookie_str,
    +                     llcache_handle_get_url(htmlc->base.llcache),
    +                     0);
    +            return 1;
    +        }    
    +    } else {
    +        LOG("error getting htmlc. parent node:%p htmlc:%p",
    +            priv->parent.node, htmlc);
    +    }
    +    return 0;
    +%}
     getter Document::onabort();
     setter Document::onabort();
     getter Document::onautocompleteerror();
    
    patch file icon cookie.patch (1,066 bytes) 2017-01-29 01:54 +

-Relationships
+Relationships

-Notes
Vincent Sanders

~0001514

Vincent Sanders (administrator)

The patch is probably not wrong per-se. unfortunately urldb_set_cookie is not safe to use in this way.

This needs additional thought before applying
+Notes

-Issue History
Date Modified Username Field Change
2017-01-29 01:54 agrecascino New Issue
2017-01-29 01:54 agrecascino File Added: cookie.patch
2017-01-29 09:23 Vincent Sanders Status new => acknowledged
2017-01-29 09:23 Vincent Sanders Category Development => Javascript
2017-01-29 09:23 Vincent Sanders Product Version => 3.7
2017-01-29 11:36 Vincent Sanders Note Added: 0001514
+Issue History