aboutsummaryrefslogtreecommitdiffstats
path: root/embed/mozilla/EphyContentPolicy.cpp
diff options
context:
space:
mode:
authorChristian Persch <chpe@cvs.gnome.org>2006-03-03 06:19:20 +0800
committerChristian Persch <chpe@src.gnome.org>2006-03-03 06:19:20 +0800
commita4889534d369b488f867006888590b99ca688516 (patch)
tree05371ee3db91a7e3061fbc27d7650405de26a6d3 /embed/mozilla/EphyContentPolicy.cpp
parentbead6bf79620b3dc88e5fe65ac59befdd975254a (diff)
downloadgsoc2013-epiphany-a4889534d369b488f867006888590b99ca688516.tar
gsoc2013-epiphany-a4889534d369b488f867006888590b99ca688516.tar.gz
gsoc2013-epiphany-a4889534d369b488f867006888590b99ca688516.tar.bz2
gsoc2013-epiphany-a4889534d369b488f867006888590b99ca688516.tar.lz
gsoc2013-epiphany-a4889534d369b488f867006888590b99ca688516.tar.xz
gsoc2013-epiphany-a4889534d369b488f867006888590b99ca688516.tar.zst
gsoc2013-epiphany-a4889534d369b488f867006888590b99ca688516.zip
Don't block stylesheets (for now).
2006-03-02 Christian Persch <chpe@cvs.gnome.org> * embed/mozilla/EphyContentPolicy.cpp: Don't block stylesheets (for now).
Diffstat (limited to 'embed/mozilla/EphyContentPolicy.cpp')
-rw-r--r--embed/mozilla/EphyContentPolicy.cpp23
1 files changed, 17 insertions, 6 deletions
diff --git a/embed/mozilla/EphyContentPolicy.cpp b/embed/mozilla/EphyContentPolicy.cpp
index 930e39e86..137b8ae89 100644
--- a/embed/mozilla/EphyContentPolicy.cpp
+++ b/embed/mozilla/EphyContentPolicy.cpp
@@ -68,8 +68,6 @@ EphyContentPolicy::~EphyContentPolicy()
GtkWidget *
EphyContentPolicy::GetEmbedFromContext (nsISupports *aContext)
{
- GtkWidget *ret;
-
/*
* aContext is either an nsIDOMWindow, an nsIDOMNode, or NULL. If it's
* an nsIDOMNode, we need the nsIDOMWindow to get the EphyEmbed.
@@ -102,10 +100,10 @@ EphyContentPolicy::GetEmbedFromContext (nsISupports *aContext)
}
NS_ENSURE_TRUE (window, NULL);
- ret = EphyUtils::FindEmbed (window);
- if (EPHY_IS_EMBED (ret)) return GTK_WIDGET (ret);
+ GtkWidget *embed = EphyUtils::FindEmbed (window);
+ if (!EPHY_IS_EMBED (embed)) NULL;
- return NULL;
+ return embed;
}
#if MOZ_NSICONTENTPOLICY_VARIANT == 2
@@ -140,7 +138,20 @@ EphyContentPolicy::ShouldLoad(PRUint32 aContentType,
EphyAdBlockManager *adblock_manager =
EPHY_ADBLOCK_MANAGER (ephy_embed_shell_get_adblock_manager (embed_shell));
- if (!ephy_adblock_manager_should_load (adblock_manager, spec.get (), AdUriCheckType (aContentType)))
+ static PRBool kBlockType[nsIContentPolicy::TYPE_REFRESH + 1] = {
+ PR_FALSE /* unused/unknown, don't block */,
+ PR_TRUE /* TYPE_OTHER */,
+ PR_TRUE /* TYPE_SCRIPT */,
+ PR_TRUE /* TYPE_IMAGE */,
+ PR_FALSE /* TYPE_STYLESHEET */,
+ PR_TRUE /* TYPE_OBJECT */,
+ PR_FALSE /* TYPE_DOCUMENT */,
+ PR_TRUE /* TYPE_SUBDOCUMENT */,
+ PR_TRUE /* TYPE_REFRESH */
+ };
+
+ if (kBlockType[aContentType < G_N_ELEMENTS (kBlockType) ? aContentType : 0] &&
+ !ephy_adblock_manager_should_load (adblock_manager, spec.get (), AdUriCheckType (aContentType)))
{
*aDecision = nsIContentPolicy::REJECT_REQUEST;