DOM: getting rid of JS_GetContextPrivate wherever possible. Use static parent links where we can. When we do need to find this info about the caller we call a function that knows how to get that info rather than inline calls to JS_GetContextPrivate. This is all required for calling DOM objects on non-DOM JSContexts as we do via xpconnect. XPConnect: basic refactoring work to disassociate wrappers from the JSContext that was active when the wrapper was constructed. This allows for calling into wrapped JS objects on the right JSContext and for proper grouping of wrapped native objects so that they can share proto objects. This also allows for better sharing of objects and lays the foundations for threadsafety and interface flattening. Also, xpconnect tests are reorganized and improved. fixes bugs: 13419, 17736, 17746, 17952, 22086 r=vidur r=mccabe r=norris r=cbegle a=chofmann git-svn-id: svn://10.0.0.236/trunk@56202 18797224-902f-48f8-a5cc-f745e15eee43
93 lines
2.8 KiB
Plaintext
93 lines
2.8 KiB
Plaintext
/* -*- 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.1 (the "License"); you may not use this file
|
|
* except in compliance with the License. You may obtain a copy of
|
|
* the License at http://www.mozilla.org/NPL/
|
|
*
|
|
* Software distributed under the License is distributed on an "AS
|
|
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
|
* implied. See the License for the specific language governing
|
|
* rights and limitations under the License.
|
|
*
|
|
* The Original Code is mozilla.org code.
|
|
*
|
|
* The Initial Developer of the Original Code is Netscape
|
|
* Communications Corporation. Portions created by Netscape are
|
|
* Copyright (C) 1999 Netscape Communications Corporation. All
|
|
* Rights Reserved.
|
|
*
|
|
* Contributor(s):
|
|
*/
|
|
|
|
#include "nsISupports.idl"
|
|
#include "nsIPrincipal.idl"
|
|
|
|
%{C++
|
|
#include "jspubtd.h"
|
|
%}
|
|
[ptr] native JSContextPtr(JSContext);
|
|
|
|
interface nsIURI;
|
|
|
|
[uuid(58df5780-8006-11d2-bd91-00805f8ae3f4)]
|
|
interface nsIScriptSecurityManager : nsISupports
|
|
{
|
|
/**
|
|
* Checks whether the currently executing script can access the given
|
|
* property.
|
|
*
|
|
* @param cx The current active JavaScript context
|
|
* @param obj The object that is being accessed
|
|
* @param prop The ordinal of the property being accessed (see nsDOMPropEnums.h)
|
|
* @param isWrite True if write access is being attempted
|
|
* @return True if access is granted
|
|
*/
|
|
boolean CheckScriptAccess(in JSContextPtr cx, in voidStar obj,
|
|
in long prop, in boolean isWrite);
|
|
|
|
/**
|
|
* Check that the script with context "cx" can load "uri".
|
|
*
|
|
* Will return error code NS_ERROR_DOM_BAD_URI if the load request
|
|
* should be denied.
|
|
*/
|
|
void CheckLoadURIFromScript(in JSContextPtr cx, in nsIURI uri);
|
|
|
|
/**
|
|
* Check that content from "from" can load "uri".
|
|
*
|
|
* Will return error code NS_ERROR_DOM_BAD_URI if the load request
|
|
* should be denied.
|
|
*/
|
|
void CheckLoadURI(in nsIURI from, in nsIURI uri);
|
|
|
|
/**
|
|
* Return the principal of the innermost frame of the currently
|
|
* executing script. Will return null if there is no script
|
|
* currently executing.
|
|
*/
|
|
nsIPrincipal GetSubjectPrincipal();
|
|
|
|
nsIPrincipal GetSystemPrincipal();
|
|
|
|
nsIPrincipal GetCodebasePrincipal(in nsIURI aURI);
|
|
|
|
boolean CanExecuteScripts(in nsIPrincipal principal);
|
|
|
|
boolean CanExecuteFunction(in voidStar jsFunction);
|
|
|
|
boolean IsCapabilityEnabled(in string capability);
|
|
|
|
void EnableCapability(in string capability);
|
|
|
|
void RevertCapability(in string capability);
|
|
|
|
void DisableCapability(in string capability);
|
|
};
|
|
|
|
%{C++
|
|
#define NS_SCRIPTSECURITYMANAGER_PROGID "component://netscape/scriptsecuritymanager"
|
|
#define NS_SCRIPTSECURITYMANAGER_CLASSNAME "scriptsecuritymanager"
|
|
%}
|