Example #1
0
/* @smjs_globhist_class.getProperty */
static JSBool
smjs_globhist_get_property(JSContext *ctx, JSObject *obj, jsid id, jsval *vp)
{
	JSObject *jsobj;
	unsigned char *uri_string;
	struct global_history_item *history_item;

	uri_string = JS_EncodeString(ctx, JS_ValueToString(ctx, id));
	if (!uri_string) goto ret_null;

	history_item = get_global_history_item(uri_string);
	if (!history_item) goto ret_null;

	jsobj = smjs_get_globhist_item_object(history_item);
	if (!jsobj) goto ret_null;

	*vp = OBJECT_TO_JSVAL(jsobj);

	return JS_TRUE;

ret_null:
	*vp = JSVAL_NULL;

	return JS_TRUE;
}
Example #2
0
void
html_a(struct html_context *html_context, unsigned char *a,
       unsigned char *xxx3, unsigned char *xxx4, unsigned char **xxx5)
{
	unsigned char *href;

	href = get_url_val(a, (unsigned char *)"href", html_context->doc_cp);
	if (href) {
		unsigned char *target;

		mem_free_set(&format.link,
			     join_urls(html_context->base_href,
				       trim_chars(href, ' ', 0)));

		mem_free(href);

		target = get_target(html_context->options, a);
		if (target) {
			mem_free_set(&format.target, target);
		} else {
			mem_free_set(&format.target, stracpy(html_context->base_target));
		}

		if (0) {
			; /* Shut up compiler */
#ifdef CONFIG_GLOBHIST
		} else if (get_global_history_item(format.link)) {
			format.style.color.foreground = format.color.vlink;
			html_top->pseudo_class &= ~ELEMENT_LINK;
			html_top->pseudo_class |= ELEMENT_VISITED;
#endif
#ifdef CONFIG_BOOKMARKS
		} else if (get_bookmark(format.link)) {
			format.style.color.foreground = format.color.bookmark_link;
			html_top->pseudo_class &= ~ELEMENT_VISITED;
			/* XXX: Really set ELEMENT_LINK? --pasky */
			html_top->pseudo_class |= ELEMENT_LINK;
#endif
		} else {
			format.style.color.foreground = format.color.clink;
			html_top->pseudo_class &= ~ELEMENT_VISITED;
			html_top->pseudo_class |= ELEMENT_LINK;
		}

		mem_free_set(&format.title,
		             get_attr_val(a, (unsigned char *)"title", html_context->doc_cp));

		html_focusable(html_context, a);

	} else {
		pop_html_element(html_context);
	}

	set_fragment_identifier(html_context, a, (unsigned char *)"name");
}
Example #3
0
void html_a( struct html_context *html_context, unsigned char *a, unsigned char *xxx3, unsigned char *xxx4, unsigned char **xxx5 )
{
    int eax;
    int ecx;
    int edx;
    unsigned char *href;
    if ( get_attr_value( a, "href", html_context->doc_cp, HTML_ATTR_EAT_NL ) )
    {
        unsigned char *target;
        if ( html_context->stack.list_head_elinks )
        {
            mem_free( &html_context->stack.list_head_elinks );
        }
        strlen( &href[0] );
        if ( href[0] == ' ' )
        {
            do
            {
                href[0] = href[1];
                *(int*)(strlen( &href[0] ))--;
            }
            while ( href[0] == ' ' );
        }
        if ( eax )
        {
            if ( href[ eax - 1 ] == ' ' )
            {
                do
                {
                    *(char*)(edx - 1) = 0;
                    if ( eax == 1 )
                        href[0] = href[0];
                    else
                    }
                while ( *(char*)(edx - 2) != ' ' );
                href[0] = href[0];
            }
            eax += 0;
            memmove( &href[0], &href[0], 1 );
            &html_context->stack.list_head_elinks = ((void)( struct css_stylesheet *, struct uri *, unsigned char *, int  )*)join_urls( html_context->base_href, &href[0] );
            mem_free( &href[0] );
            if ( get_target( html_context->options, a ) )
            {
                if ( html_context->stack.list_head_elinks )
                {
                    mem_free( &html_context->stack.list_head_elinks );
                    html_context->stack.next = html_context->stack.next;
                }
                &html_context->stack.list_head_elinks = &target[0];
            }
            else
            {
                if ( html_context->stack.list_head_elinks )
                {
                    mem_free( &html_context->stack.list_head_elinks );
                }
                &html_context->stack.list_head_elinks = ((void)( struct css_stylesheet *, struct uri *, unsigned char *, int  )*)stracpy( html_context->base_target );
            }
            if ( get_global_history_item( &html_context->stack.list_head_elinks ) )
            {
                &html_context->stack.list_head_elinks = &html_context->stack.list_head_elinks;
                &html_context->stack.list_head_elinks &= -2;
                &html_context->stack.list_head_elinks |= 2;
            }
            else
            {
                &html_context->stack.list_head_elinks = html_context->stack.next ? &html_context->stack.list_head_elinks : &html_context->stack.list_head_elinks;
                &html_context->stack.list_head_elinks &= -3;
                &html_context->stack.list_head_elinks |= 1;
            }
            if ( html_context->stack.list_head_elinks )
            {
                mem_free( &html_context->stack.list_head_elinks );
            }
            &html_context->stack.list_head_elinks = ((void)( struct css_stylesheet *, struct uri *, unsigned char *, int  )*)get_attr_value( a, "title", html_context->doc_cp, HTML_ATTR_NONE );
            html_focusable( &html_context[0], a );
            xxx3 = "name";
            html_context = &html_context[0];
            a = a;
        }
        memmove( &href[0], &href[0], 1 );
        &html_context->stack.list_head_elinks = ((void)( struct css_stylesheet *, struct uri *, unsigned char *, int  )*)join_urls( html_context->base_href, &href[0] );
        mem_free( &href[0] );
    }
    else