diff options
-rw-r--r-- | src/html.cc | 2 | ||||
-rw-r--r-- | src/plain.cc | 2 | ||||
-rw-r--r-- | src/styleengine.cc | 13 | ||||
-rw-r--r-- | src/styleengine.hh | 5 | ||||
-rw-r--r-- | src/web.cc | 2 |
5 files changed, 16 insertions, 8 deletions
diff --git a/src/html.cc b/src/html.cc index 3a6c3c89..1a328f0e 100644 --- a/src/html.cc +++ b/src/html.cc @@ -404,7 +404,7 @@ DilloHtml::DilloHtml(BrowserWindow *p_bw, const DilloUrl *url, DocType = DT_NONE; /* assume Tag Soup 0.0! :-) */ DocTypeVersion = 0.0f; - styleEngine = new StyleEngine (HT2LT (this), base_url); + styleEngine = new StyleEngine (HT2LT (this), page_url, base_url); cssUrls = new misc::SimpleVector <DilloUrl*> (1); diff --git a/src/plain.cc b/src/plain.cc index 810efda1..ab080886 100644 --- a/src/plain.cc +++ b/src/plain.cc @@ -96,7 +96,7 @@ DilloPlain::DilloPlain(BrowserWindow *p_bw) Layout *layout = (Layout*) bw->render_layout; // TODO (1x) No URL? - StyleEngine styleEngine (layout, NULL); + StyleEngine styleEngine (layout, NULL, NULL); styleEngine.startElement ("body", bw); styleEngine.startElement ("pre", bw); diff --git a/src/styleengine.cc b/src/styleengine.cc index 5b88798a..285da3f5 100644 --- a/src/styleengine.cc +++ b/src/styleengine.cc @@ -58,7 +58,8 @@ void StyleImageDeletionReceiver::deleted (lout::signal::ObservedObject *object) // ---------------------------------------------------------------------- -StyleEngine::StyleEngine (dw::core::Layout *layout, const DilloUrl *baseUrl) { +StyleEngine::StyleEngine (dw::core::Layout *layout, + const DilloUrl *pageUrl, const DilloUrl *baseUrl) { StyleAttrs style_attrs; FontAttrs font_attrs; @@ -67,7 +68,8 @@ StyleEngine::StyleEngine (dw::core::Layout *layout, const DilloUrl *baseUrl) { cssContext = new CssContext (); buildUserStyle (); this->layout = layout; - this->baseUrl = baseUrl; + this->pageUrl = pageUrl ? a_Url_dup(pageUrl) : NULL; + this->baseUrl = baseUrl ? a_Url_dup(baseUrl) : NULL; importDepth = 0; stackPush (); @@ -100,6 +102,9 @@ StyleEngine::~StyleEngine () { stackPop (); // dummy node on the bottom of the stack assert (stack->size () == 0); + a_Url_free(pageUrl); + a_Url_free(baseUrl); + delete stack; delete doctree; delete cssContext; @@ -535,7 +540,9 @@ void StyleEngine::apply (int i, StyleAttrs *attrs, CssPropertyList *props, ->getMainImgRenderer(), 0xffffff); - DilloWeb *web = a_Web_new(bw, imgUrl, baseUrl); + // we use the pageUrl as requester to prevent cross + // domain requests as specified in domainrc + DilloWeb *web = a_Web_new(bw, imgUrl, pageUrl); web->Image = image; a_Image_ref(image); web->flags |= WEB_Image; diff --git a/src/styleengine.hh b/src/styleengine.hh index 59c17a1a..41f892d7 100644 --- a/src/styleengine.hh +++ b/src/styleengine.hh @@ -35,7 +35,7 @@ class StyleEngine { CssContext *cssContext; Doctree *doctree; int importDepth; - const DilloUrl *baseUrl; + DilloUrl *pageUrl, *baseUrl; void stackPush (); void stackPop (); @@ -66,7 +66,8 @@ class StyleEngine { public: static void init (); - StyleEngine (dw::core::Layout *layout, const DilloUrl *baseUrl); + StyleEngine (dw::core::Layout *layout, + const DilloUrl *pageUrl, const DilloUrl *baseUrl); ~StyleEngine (); void parse (DilloHtml *html, DilloUrl *url, const char *buf, int buflen, @@ -73,7 +73,7 @@ int a_Web_dispatch_by_type (const char *Type, DilloWeb *Web, style::createPerLength (0)); /* Set a style for the widget */ - StyleEngine styleEngine (layout, Web->url); + StyleEngine styleEngine (layout, Web->url, Web->url); styleEngine.startElement ("body", Web->bw); dw = (Widget*) viewer(Type, Web, Call, Data); |