From c4e91102b09fbeea64049096e65a6409f030c699 Mon Sep 17 00:00:00 2001 From: "mlm%netscape.com" Date: Fri, 25 Sep 1998 22:01:25 +0000 Subject: [PATCH] Branch landing: Multithreading libmocha in mozilla. - Add jscookie.h - Move JSCF_ function to mocha thread for thread safety. - Add functions to libevent.h to deal with multiple window groups. - Add functions to libmocha.h to deal with multiple window groups. git-svn-id: svn://10.0.0.236/trunk@11076 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/include/MANIFEST | 1 + mozilla/include/jscookie.h | 62 ++++++++++++++++++++++++++++++++++++++ mozilla/include/libevent.h | 9 +++++- mozilla/include/libmocha.h | 23 +++++++------- 4 files changed, 82 insertions(+), 13 deletions(-) create mode 100644 mozilla/include/jscookie.h diff --git a/mozilla/include/MANIFEST b/mozilla/include/MANIFEST index ceec58d8e0d..52e31546cf1 100644 --- a/mozilla/include/MANIFEST +++ b/mozilla/include/MANIFEST @@ -25,6 +25,7 @@ gui.h imap.h intl_csi.h itapefs.h +jscookie.h libcnv.h libc_r.h libevent.h diff --git a/mozilla/include/jscookie.h b/mozilla/include/jscookie.h new file mode 100644 index 00000000000..fc522cfb9fd --- /dev/null +++ b/mozilla/include/jscookie.h @@ -0,0 +1,62 @@ +/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- + * + * The contents of this file are subject to the Netscape Public License + * Version 1.0 (the "NPL"); you may not use this file except in + * compliance with the NPL. You may obtain a copy of the NPL at + * http://www.mozilla.org/NPL/ + * + * Software distributed under the NPL is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL + * for the specific language governing rights and limitations under the + * NPL. + * + * The Initial Developer of this code under the NPL is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All Rights + * Reserved. + */ +/* + jscookie.h -- javascript reflection of cookies for filters. + Created: Frederick G.M. Roeber , 12-Jul-97. + Adopted: Judson Valeski, 1997 + */ + +#ifndef _JSCOOKIE_H_ +#define _JSCOOKIE_H_ + +typedef enum { + JSCF_accept, + JSCF_reject, + JSCF_ask, + JSCF_whatever, + JSCF_error +} + JSCFResult; + +typedef struct { + char *path_from_header; + char *host_from_header; + char *name_from_header; + char *cookie_from_header; + time_t expires; + char *url; + Bool secure; + Bool domain; + Bool prompt; /* the preference */ + NET_CookieBehaviorEnum preference; +} + JSCFCookieData; + +extern JSCFResult JSCF_Execute( + MWContext *mwcontext, + const char *script_name, + JSCFCookieData *data, + Bool *data_changed + ); + +/* runs the garbage collector on the filter context. Probably a good + idea to call on completion of NET_GetURL or something. */ +extern void JSCF_Cleanup(void); + +#endif /* _JSCOOKIE_H_ */ + diff --git a/mozilla/include/libevent.h b/mozilla/include/libevent.h index af8129af744..411906572eb 100644 --- a/mozilla/include/libevent.h +++ b/mozilla/include/libevent.h @@ -34,11 +34,14 @@ #include "shist.h" #include "fe_proto.h" #include "lo_ele.h" +#include "jscookie.h" NSPR_BEGIN_EXTERN_C extern PREventQueue * mozilla_event_queue; +typedef struct WindowGroup LMWindowGroup; + /* * XXX - should we use the same event values as layer events? */ @@ -514,7 +517,7 @@ ET_PostPrompt(MWContext* context, const char* szMessage, extern MWContext * ET_PostNewWindow(MWContext* context, URL_Struct * pUrl, - char * szName, Chrome * pChrome); + char * szName, Chrome * pChrome, LMWindowGroup *grp); extern void ET_PostUpdateChrome(MWContext* context, Chrome * pChrome); @@ -747,6 +750,10 @@ ET_RestoreLayerState(MWContext *context, int32 layer_id, extern int32 ET_npl_RefreshPluginList(MWContext* context, XP_Bool refreshInstances); +extern JSCFResult +ET_JSCFExecute(MWContext *context, const char *script_name, + JSCFCookieData *data, Bool *data_changed); + extern JSBool ET_HandlePref(JSContext * cx, uint argc, jsval * argv, jsval * rval); diff --git a/mozilla/include/libmocha.h b/mozilla/include/libmocha.h index dea5a18341e..956446e341e 100644 --- a/mozilla/include/libmocha.h +++ b/mozilla/include/libmocha.h @@ -222,15 +222,14 @@ typedef void (PR_CALLBACK *JSLockReleaseFunc)(void * data); -#ifdef OJI -extern JSBool PR_CALLBACK LM_LockJS(char **errp); -#else -extern void PR_CALLBACK LM_LockJS(void); -#endif +extern JSBool PR_CALLBACK LM_LockJS(MWContext *mwc, char **errp); +extern void PR_CALLBACK LM_UnlockJS(MWContext *mwc); +extern JSBool PR_CALLBACK LM_AttemptLockJS(MWContext *mwc, + JSLockReleaseFunc fn, void * data); +extern JSBool PR_CALLBACK LM_ClearAttemptLockJS(MWContext *mwc, + JSLockReleaseFunc fn, + void * data); -extern void PR_CALLBACK LM_UnlockJS(void); -extern JSBool PR_CALLBACK LM_AttemptLockJS(JSLockReleaseFunc fn, void * data); -extern JSBool PR_CALLBACK LM_ClearAttemptLockJS(JSLockReleaseFunc fn, void * data); extern PRBool PR_CALLBACK LM_HandOffJSLock(PRThread * oldOwner, PRThread *newOwner); @@ -239,7 +238,7 @@ LM_HandOffJSLock(PRThread * oldOwner, PRThread *newOwner); * context who is holding the JS lock */ extern void LM_JSLockSetContext(MWContext * context); -extern MWContext * LM_JSLockGetContext(void); +extern MWContext * LM_JSLockGetContext(MWContext *mwc); /* * Enable/disable for Mocha-in-the-client. @@ -564,6 +563,9 @@ LM_GetJSPrincipalsFromJavaCaller(JSContext *cx, void *principalsArray); extern JSPrincipals * LM_RegisterPrincipals(MochaDecoder *decoder, JSPrincipals *principals, char *name, char *src); + +extern JSContext *LM_GetCrippledContext(void); + /* * JavaScript Debugger support */ @@ -586,9 +588,6 @@ LM_JamSourceIntoJSDebug( const char *filename, #endif -extern JSContext* -LM_GetCrippledContext(void); - NSPR_END_EXTERN_C #endif /* libmocha_h___ */