aboutsummaryrefslogtreecommitdiffstats
path: root/embed/mozilla/EphyPromptService.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/EphyPromptService.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/EphyPromptService.cpp')
-rw-r--r--embed/mozilla/EphyPromptService.cpp81
1 files changed, 42 insertions, 39 deletions
diff --git a/embed/mozilla/EphyPromptService.cpp b/embed/mozilla/EphyPromptService.cpp
index 4f3d1446c..ceed6e0ab 100644
--- a/embed/mozilla/EphyPromptService.cpp
+++ b/embed/mozilla/EphyPromptService.cpp
@@ -21,40 +21,25 @@
#include "mozilla-config.h"
#include "config.h"
-#include "EphyPromptService.h"
-#include "AutoJSContextStack.h"
-
-#include <nsCOMPtr.h>
-#include <nsIDOMWindow.h>
-#undef MOZILLA_INTERNAL_API
-#include <nsEmbedString.h>
-#define MOZILLA_INTERNAL_API 1
-
-#if 0
-#include <nsIPrincipal.h>
-#include <nsIScriptSecurityManager.h>
-#include <nsIServiceManager.h>
-#endif
-
-#if 0
-#include "AutoEventQueue.h"
-#endif
-
-#include "EphyUtils.h"
-
#include <glib.h>
#include <glib-object.h>
#include <glib/gi18n.h>
#include <gtk/gtk.h>
+#include <nsStringAPI.h>
+
+#include <nsCOMPtr.h>
+#include <nsIDOMWindow.h>
+#include <nsServiceManagerUtils.h>
+
#include "ephy-embed-shell.h"
#include "ephy-gui.h"
#include "ephy-debug.h"
-#ifndef HAVE_GECKO_1_8
-typedef nsEmbedString nsDependentString;
-typedef nsEmbedCString nsDependentCString;
-#endif
+#include "AutoJSContextStack.h"
+#include "EphyUtils.h"
+
+#include "EphyPromptService.h"
#define TIMEOUT 1000 /* ms */
#define TIMEOUT_DATA_KEY "timeout"
@@ -377,7 +362,7 @@ Prompter::AddEntry (const char *aLabel,
if (aValue)
{
- nsEmbedCString cValue;
+ nsCString cValue;
NS_UTF16ToCString (nsDependentString(aValue),
NS_CSTRING_ENCODING_UTF8, cValue);
@@ -402,7 +387,7 @@ Prompter::GetText (PRUint32 aNum,
const char *text = gtk_entry_get_text (GTK_ENTRY (mEntries[aNum]));
if (!text) return;
- nsEmbedString value;
+ nsString value;
NS_CStringToUTF16 (nsDependentCString (text),
NS_CSTRING_ENCODING_UTF8, value);
@@ -421,7 +406,7 @@ Prompter::AddSelect (PRUint32 aCount,
/* FIXME: use "" instead in this case? */
if (!aList[i] || !aList[i][0]) continue;
- nsEmbedCString cData;
+ nsCString cData;
NS_UTF16ToCString (nsDependentString(aList[i]), NS_CSTRING_ENCODING_UTF8, cData);
gtk_combo_box_append_text (GTK_COMBO_BOX (mCombo), cData.get());
@@ -544,18 +529,24 @@ Prompter::Show ()
PRBool
Prompter::IsCalledFromScript()
{
- /* FIXME: implement me! */
#if 0
+ nsCOMPtr<nsIXPConnect> xpconnect (do_GetService (nsIXPConnect::GetCID()));
+ NS_ENSURE_TRUE (xpconnect, PR_FALSE);
+
nsresult rv;
- nsCOMPtr<nsIScriptSecurityManager> securityManager =
- do_GetService(NS_SCRIPTSECURITYMANAGER_CONTRACTID, &rv);
+ nsCOMPtr<nsIXPCNativeCallContext> ncc;
+ rv = xpconnect->GetCurrentNativeCallContext (getter_AddRefs (ncc));
NS_ENSURE_SUCCESS (rv, PR_FALSE);
- nsCOMPtr<nsIPrincipal> principal;
- rv = securityManager->GetSubjectPrincipal (getter_AddRefs (principal));
+ if (!ncc) return PR_FALSE;
- g_print ("rv=%x mPrincipal=%p\n", rv, (void*)principal.get());
- return NS_SUCCEEDED (rv) && principal.get();
+ JSContext *cx = nsnull;
+ rv = ncc->GetJSContext (&cx);
+ g_print ("GetJSContext rv=%x, cx=%p\n", rv, cx);
+
+ NS_ENSURE_SUCCESS (rv, PR_FALSE);
+
+ return cx != nsnull;
#endif
return PR_FALSE;
}
@@ -563,14 +554,26 @@ Prompter::IsCalledFromScript()
void
Prompter::PerformScriptAbortion()
{
- /* FIXME: implement me! */
#if 0
+ /* FIXME: can we only stop the calling script, not all scripts in the context? */
+
+ nsCOMPtr<nsIXPConnect> xpconnect (do_GetService (nsIXPConnect::GetCID()));
+ NS_ENSURE_TRUE (xpconnect, );
+
nsresult rv;
- nsCOMPtr<nsIScriptSecurityManager> securityManager =
- do_GetService(NS_SCRIPTSECURITYMANAGER_CONTRACTID, &rv);
+ nsCOMPtr<nsIXPCNativeCallContext> ncc;
+ rv = xpconnect->GetCurrentNativeCallContext (getter_AddRefs (ncc));
+ NS_ENSURE_SUCCESS (rv, );
+ NS_ENSURE_TRUE (ncc, );
+
+ JSContext *cx = nsnull;
+ rv = ncc->GetJSContext (&cx);
+ g_print ("GetJSContext rv=%x, cx=%p\n", rv, cx);
NS_ENSURE_SUCCESS (rv, );
+ NS_ENSURE_TRUE (cx, );
- securityManager->DisableCapability ("javascript.enabled");
+ g_print ("Would now disable scripts\n");
+// MozillaPrivate::SetScriptsEnabled (cx, PR_FALSE, PR_FALSE);
#endif
}