[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] /srv/bzr/gnash/trunk r9951: Cleanups on the cookie code.
From: |
Sandro Santilli |
Subject: |
[Gnash-commit] /srv/bzr/gnash/trunk r9951: Cleanups on the cookie code. Still #if 0'ed out (due to linking errors) |
Date: |
Tue, 07 Oct 2008 09:26:12 +0200 |
User-agent: |
Bazaar (1.5) |
------------------------------------------------------------
revno: 9951
committer: Sandro Santilli <address@hidden>
branch nick: trunk
timestamp: Tue 2008-10-07 09:26:12 +0200
message:
Cleanups on the cookie code. Still #if 0'ed out (due to linking errors)
but now dumps the cookie file in its own method and has code prepared
to unlink it.
modified:
plugin/plugin.cpp
plugin/plugin.h
=== modified file 'plugin/plugin.cpp'
--- a/plugin/plugin.cpp 2008-10-07 07:05:35 +0000
+++ b/plugin/plugin.cpp 2008-10-07 07:26:12 +0000
@@ -427,6 +427,9 @@
}
// TODO: unlink the cookie jar
+ if ( ! _cookieFile.empty() ) {
+ cout << " ~nsPluginInstance: file " << _cookieFile << " should be
unlinked!" << endl;
+ }
}
/// \brief Initialize an instance of the plugin object
@@ -845,56 +848,29 @@
#endif // GNASH_XPI_PLUGIN
void
-nsPluginInstance::startProc(Window win)
+nsPluginInstance::dumpCookies()
{
- string procname;
- char *gnash_env = std::getenv("GNASH_PLAYER");
-#ifdef GNASH_XPI_PLUGIN
- if (getHome(procname) >= 0)
- ;
- else
-#endif // def GNASH_XPI_PLUGIN
- if (gnash_env == NULL) {
- procname = GNASHBINDIR;
- procname += "/gtk-gnash";
- }
- else
- {
- procname = gnash_env;
- }
-
- const char* pageurl = getCurrentPageURL();
- if (!pageurl)
- {
- cout << "Could not get current page URL!" << endl;
- }
-
- struct stat procstats;
-
- // See if the file actually exists, otherwise we can't spawn it
- if (stat(procname.c_str(), &procstats) == -1)
- {
- cout << "Invalid path to standalone executable: " << procname
<< endl;
- return;
- }
-
-//Disabled till we get the file removed on plugin instance exit
+ if ( ! _cookieFile.empty() ) {
+ cout << " dumpCookies: file " << _cookieFile << " should be
unlinked!" << endl;
+ }
+ _cookieFile.clear();
+
+// Linking problems...
//#ifdef HAVE_XPCOM
-#if 0 // {
-
+#if 0
cout << "[XPCOM] trying to dump cookies" << endl;
nsCOMPtr<nsISimpleEnumerator> cookie_e;
nsresult rv = cookieManager->GetEnumerator(getter_AddRefs(cookie_e));
- char *cookiefile = NULL;
+ //char *cookiefile = NULL;
if(NS_SUCCEEDED(rv)) {
PRBool res = FALSE;
ofstream fout;
mode_t oldmask = umask(0077);
while(!res) {
- char *tmpname = tmpnam(NULL);
+ char *tmpname = tmpnam("gnash-cookies");
fout.open(tmpname, ios::out | ios::trunc);
if(!fout.is_open()) {
cout << "not opened!!" << endl;
@@ -904,7 +880,7 @@
cout << "opened cookie store: " << tmpname <<
endl;
}
res = TRUE;
- cookiefile = tmpname;
+ _cookieFile = tmpname; // assign ?
}
umask(oldmask);
@@ -981,7 +957,45 @@
} else {
cout << "[XPCOM] WARNING: Cookie feature disabled" << endl;
}
-#endif // HAVE_XPCOM }
+#endif // HAVE_XPCOM
+
+}
+
+void
+nsPluginInstance::startProc(Window win)
+{
+ string procname;
+ char *gnash_env = std::getenv("GNASH_PLAYER");
+#ifdef GNASH_XPI_PLUGIN
+ if (getHome(procname) >= 0)
+ ;
+ else
+#endif // def GNASH_XPI_PLUGIN
+ if (gnash_env == NULL) {
+ procname = GNASHBINDIR;
+ procname += "/gtk-gnash";
+ }
+ else
+ {
+ procname = gnash_env;
+ }
+
+ const char* pageurl = getCurrentPageURL();
+ if (!pageurl)
+ {
+ cout << "Could not get current page URL!" << endl;
+ }
+
+ struct stat procstats;
+
+ // See if the file actually exists, otherwise we can't spawn it
+ if (stat(procname.c_str(), &procstats) == -1)
+ {
+ cout << "Invalid path to standalone executable: " << procname
<< endl;
+ return;
+ }
+
+ dumpCookies();
// 0 For reading, 1 for writing.
int p2c_pipe[2];
=== modified file 'plugin/plugin.h'
--- a/plugin/plugin.h 2008-04-04 13:23:44 +0000
+++ b/plugin/plugin.h 2008-10-07 07:26:12 +0000
@@ -114,6 +114,11 @@
// @@ this should likely replace the _options element below
std::map<std::string, std::string> _params;
+ /// Dump current session cookies to a file,
+ /// setting _cookieFile to its name (or clear
+ /// it on failure).
+ void dumpCookies();
+
NPP _instance;
Window _window;
std::string _swf_url;
@@ -130,6 +135,9 @@
/// Name of the plugin instance element in the dom
std::string _name;
+ /// Cookie file
+ std::string _cookieFile;
+
const char* getCurrentPageURL() const;
};
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] /srv/bzr/gnash/trunk r9951: Cleanups on the cookie code. Still #if 0'ed out (due to linking errors),
Sandro Santilli <=