aboutsummaryrefslogtreecommitdiff
path: root/src/styleengine.cc
diff options
context:
space:
mode:
authorJohannes Hofmann <Johannes.Hofmann@gmx.de>2014-04-02 21:47:26 +0200
committerJohannes Hofmann <Johannes.Hofmann@gmx.de>2014-04-02 21:47:26 +0200
commit488e5f9ca3b937c7aa5993a80d0e5610ef88ac42 (patch)
tree5537ed03ebb683e5968093538f7097b0bf94a79b /src/styleengine.cc
parentbd44716237e2f4d8e34a814ada508dd7a11af70d (diff)
fix crash and use proper requester URL for CSS images
Diffstat (limited to 'src/styleengine.cc')
-rw-r--r--src/styleengine.cc13
1 files changed, 10 insertions, 3 deletions
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;