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
This commit is contained in:
mlm%netscape.com
1998-09-25 22:01:25 +00:00
parent 8a333e014d
commit c4e91102b0
4 changed files with 82 additions and 13 deletions

View File

@@ -25,6 +25,7 @@ gui.h
imap.h
intl_csi.h
itapefs.h
jscookie.h
libcnv.h
libc_r.h
libevent.h

View File

@@ -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 <roeber@netscape.com>, 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_ */

View File

@@ -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);

View File

@@ -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___ */