aboutsummaryrefslogtreecommitdiffstats
path: root/embed/mozilla/EphyContentPolicy.cpp
diff options
context:
space:
mode:
authorChristian Persch <chpe@cvs.gnome.org>2006-05-11 02:07:03 +0800
committerChristian Persch <chpe@src.gnome.org>2006-05-11 02:07:03 +0800
commit24b71aa8ac7de8dd140092705bb7cc439f6b3309 (patch)
tree65631a3c5c3b28414788e1f9ef060962b95de9a1 /embed/mozilla/EphyContentPolicy.cpp
parentc3a7867c638dd105405fa2078b2de828a318b909 (diff)
downloadgsoc2013-epiphany-24b71aa8ac7de8dd140092705bb7cc439f6b3309.tar
gsoc2013-epiphany-24b71aa8ac7de8dd140092705bb7cc439f6b3309.tar.gz
gsoc2013-epiphany-24b71aa8ac7de8dd140092705bb7cc439f6b3309.tar.bz2
gsoc2013-epiphany-24b71aa8ac7de8dd140092705bb7cc439f6b3309.tar.lz
gsoc2013-epiphany-24b71aa8ac7de8dd140092705bb7cc439f6b3309.tar.xz
gsoc2013-epiphany-24b71aa8ac7de8dd140092705bb7cc439f6b3309.tar.zst
gsoc2013-epiphany-24b71aa8ac7de8dd140092705bb7cc439f6b3309.zip
Drop support for gecko 1.7.
2006-05-10 Christian Persch <chpe@cvs.gnome.org> * configure.ac: * data/glade/prefs-dialog.glade: * embed/ephy-favicon-cache.c: (ephy_favicon_cache_get): * embed/mozilla/AutoJSContextStack.cpp: * embed/mozilla/ContentHandler.cpp: * embed/mozilla/ContentHandler.h: * embed/mozilla/EphyAboutModule.cpp: * embed/mozilla/EphyAboutModule.h: * embed/mozilla/EphyBrowser.cpp: * embed/mozilla/EphyBrowser.h: * embed/mozilla/EphyContentPolicy.cpp: * embed/mozilla/EphyContentPolicy.h: * embed/mozilla/EphyDirectoryProvider.cpp: * embed/mozilla/EphyFind.cpp: * embed/mozilla/EphyFind.h: * embed/mozilla/EphyHeaderSniffer.cpp: * embed/mozilla/EphyHeaderSniffer.h: * embed/mozilla/EphyHistoryListener.cpp: * embed/mozilla/EphyHistoryListener.h: * embed/mozilla/EphyPromptService.cpp: * embed/mozilla/EphySidebar.cpp: * embed/mozilla/EphySidebar.h: * embed/mozilla/EphySingle.cpp: * embed/mozilla/EphySingle.h: * embed/mozilla/EphyUtils.cpp: * embed/mozilla/EphyUtils.h: * embed/mozilla/EventContext.cpp: * embed/mozilla/EventContext.h: * embed/mozilla/FilePicker.cpp: * embed/mozilla/FilePicker.h: * embed/mozilla/GlobalHistory.cpp: * embed/mozilla/GlobalHistory.h: * embed/mozilla/GtkNSSClientAuthDialogs.cpp: * embed/mozilla/GtkNSSDialogs.cpp: * embed/mozilla/GtkNSSKeyPairDialogs.cpp: * embed/mozilla/GtkNSSSecurityWarningDialogs.cpp: * embed/mozilla/GtkNSSSecurityWarningDialogs.h: * embed/mozilla/Makefile.am: * embed/mozilla/MozDownload.cpp: * embed/mozilla/MozDownload.h: * embed/mozilla/MozRegisterComponents.cpp: * embed/mozilla/MozRegisterComponents.h: * embed/mozilla/MozillaPrivate.cpp: * embed/mozilla/MozillaPrivate.h: * embed/mozilla/PrintingPromptService.cpp: * embed/mozilla/PrintingPromptService.h: * embed/mozilla/mozilla-download.cpp: * embed/mozilla/mozilla-download.h: * embed/mozilla/mozilla-embed-event.cpp: * embed/mozilla/mozilla-embed-event.h: * embed/mozilla/mozilla-embed-find.cpp: * embed/mozilla/mozilla-embed-find.h: * embed/mozilla/mozilla-embed-persist.cpp: * embed/mozilla/mozilla-embed-persist.h: * embed/mozilla/mozilla-embed-single.cpp: * embed/mozilla/mozilla-embed.cpp: * embed/mozilla/mozilla-embed.h: * embed/mozilla/mozilla-notifiers.cpp: * embed/mozilla/mozilla-notifiers.h: * embed/mozilla/mozilla-x509-cert.cpp: * embed/mozilla/mozilla-x509-cert.h: * lib/ephy-gui.c: * lib/ephy-gui.h: * lib/ephy-langs.c: * m4/gecko.m4: * src/ephy-window.c: (sync_tab_security): * src/prefs-dialog.c: (prefs_dialog_init): Drop support for gecko 1.7.
Diffstat (limited to 'embed/mozilla/EphyContentPolicy.cpp')
-rw-r--r--embed/mozilla/EphyContentPolicy.cpp121
1 files changed, 13 insertions, 108 deletions
diff --git a/embed/mozilla/EphyContentPolicy.cpp b/embed/mozilla/EphyContentPolicy.cpp
index a78005b85..7c811d3e8 100644
--- a/embed/mozilla/EphyContentPolicy.cpp
+++ b/embed/mozilla/EphyContentPolicy.cpp
@@ -20,22 +20,11 @@
*/
#include "mozilla-config.h"
-
#include "config.h"
-#include "EphyContentPolicy.h"
-#include "EphyUtils.h"
-
-#include "ephy-embed-shell.h"
-#include "ephy-embed-single.h"
-#include "eel-gconf-extensions.h"
-#include "ephy-adblock-manager.h"
-#include "ephy-debug.h"
+#include <nsStringAPI.h>
#include <nsCOMPtr.h>
-#undef MOZILLA_INTERNAL_API
-#include <nsEmbedString.h>
-#define MOZILLA_INTERNAL_API 1
#include <nsIDOMAbstractView.h>
#include <nsIDOMDocument.h>
#include <nsIDOMDocumentView.h>
@@ -43,6 +32,16 @@
#include <nsIDOMWindow.h>
#include <nsIURI.h>
+#include "eel-gconf-extensions.h"
+#include "ephy-adblock-manager.h"
+#include "ephy-debug.h"
+#include "ephy-embed-shell.h"
+#include "ephy-embed-single.h"
+
+#include "EphyUtils.h"
+
+#include "EphyContentPolicy.h"
+
#define CONF_LOCKDOWN_DISABLE_UNSAFE_PROTOCOLS "/apps/epiphany/lockdown/disable_unsafe_protocols"
#define CONF_LOCKDOWN_ADDITIONAL_SAFE_PROTOCOLS "/apps/epiphany/lockdown/additional_safe_protocols"
@@ -106,7 +105,6 @@ EphyContentPolicy::GetEmbedFromContext (nsISupports *aContext)
return embed;
}
-#if MOZ_NSICONTENTPOLICY_VARIANT == 2
NS_IMETHODIMP
EphyContentPolicy::ShouldLoad(PRUint32 aContentType,
nsIURI *aContentLocation,
@@ -132,7 +130,7 @@ EphyContentPolicy::ShouldLoad(PRUint32 aContentType,
if (isHttps) return NS_OK;
/* is this url allowed ? */
- nsEmbedCString contentSpec;
+ nsCString contentSpec;
aContentLocation->GetSpec (contentSpec);
EphyAdBlockManager *adblock_manager =
@@ -174,7 +172,7 @@ EphyContentPolicy::ShouldLoad(PRUint32 aContentType,
if (strcmp (contentSpec.get(), "about:blank") == 0) return NS_OK;
- nsEmbedCString contentScheme;
+ nsCString contentScheme;
aContentLocation->GetScheme (contentScheme);
/* first general lockdown check */
@@ -199,96 +197,3 @@ EphyContentPolicy::ShouldProcess(PRUint32 aContentType,
*aDecision = nsIContentPolicy::ACCEPT;
return NS_OK;
}
-
-#else
-
-/* boolean shouldLoad (in PRInt32 contentType, in nsIURI contentLocation, in nsISupports ctxt, in nsIDOMWindow window); */
-NS_IMETHODIMP EphyContentPolicy::ShouldLoad(PRInt32 aContentType,
- nsIURI *aContentLocation,
- nsISupports *aContext,
- nsIDOMWindow *aWindow,
- PRBool *_retval)
-{
- NS_ENSURE_ARG (aContentLocation);
- NS_ENSURE_ARG_POINTER (_retval);
-
- *_retval = PR_TRUE;
-
- PRBool isHttps = PR_FALSE;
- aContentLocation->SchemeIs ("https", &isHttps);
- if (isHttps) return NS_OK;
-
- /* We have to always allow these, else forms and scrollbars break */
- PRBool isChrome = PR_FALSE, isResource = PR_FALSE;
- aContentLocation->SchemeIs ("chrome", &isChrome);
- aContentLocation->SchemeIs ("resource", &isResource);
- if (isChrome || isResource) return NS_OK;
-
- nsEmbedCString contentSpec;
- aContentLocation->GetSpec (contentSpec);
-
- EphyAdBlockManager *adblock_manager =
- EPHY_ADBLOCK_MANAGER (ephy_embed_shell_get_adblock_manager (embed_shell));
-
- /* try to remap 1.7 types to 1.8 */
- static struct {PRBool should_block; PRUint32 remap;} kBlockType[nsIContentPolicy::DOCUMENT + 1] = {
- {PR_TRUE /* TYPE_OTHER */, 1},
- {PR_TRUE /* TYPE_SCRIPT */,2},
- {PR_TRUE /* TYPE_IMAGE */, 3},
- {PR_FALSE /* TYPE_STYLESHEET */, 4},
- {PR_TRUE /* TYPE_OBJECT */, 5},
- {PR_TRUE /* TYPE_SUBDOCUMENT */, 7},
- {PR_TRUE /* TYPE_CONTROL_TAG */, 1},
- {PR_TRUE /* TYPE_RAW_URL */, 1},
- {PR_FALSE /* TYPE_DOCUMENT */, 6}
- };
-
- PRUint32 indexPolicy = aContentType < G_N_ELEMENTS (kBlockType) ? aContentType : 1;
- if (kBlockType[indexPolicy].should_block &&
- !ephy_adblock_manager_should_load (adblock_manager,
- contentSpec.get (),
- AdUriCheckType (kBlockType[indexPolicy].remap)))
- {
- *_retval = PR_FALSE;
-
- GtkWidget *embed = GetEmbedFromContext (aContext);
-
- if (embed)
- {
- g_signal_emit_by_name (embed, "content-blocked", contentSpec.get ());
- }
- return NS_OK;
- }
-
- PRBool isHttp = PR_FALSE;
- aContentLocation->SchemeIs ("http", &isHttp);
- if (isHttp) return NS_OK;
-
- if (strcmp (contentSpec.get(), "about:blank") == 0) return NS_OK;
-
- nsEmbedCString contentScheme;
- aContentLocation->GetScheme (contentScheme);
-
- /* first general lockdown check */
- if (mLocked &&
- !g_slist_find_custom (mSafeProtocols, contentScheme.get(), (GCompareFunc) strcmp))
- {
- *_retval = PR_FALSE;
- }
- return NS_OK;
-}
-
-/* boolean shouldProcess (in PRInt32 contentType, in nsIURI documentLocation, in nsISupports ctxt, in nsIDOMWindow window); */
-NS_IMETHODIMP EphyContentPolicy::ShouldProcess(PRInt32 contentType,
- nsIURI *documentLocation,
- nsISupports *ctxt,
- nsIDOMWindow *window,
- PRBool *_retval)
-{
- /* This is never called. */
- LOG ("ShouldProcess: this is quite unexpected!");
-
- *_retval = PR_TRUE;
- return NS_OK;
-}
-#endif /* MOZ_NSICONTENTPOLICY_VARIANT == 2 */