Bug 911020 - Introduce js/TypeDecls.h, which holds very commonly used type declarations from the JS engine. r=luke.

--HG--
extra : rebase_source : 008ef689989f93b46627b8be8608bdbc544ca3a2
This commit is contained in:
Nicholas Nethercote 2013-08-27 19:59:14 -07:00
parent 592aaedd9e
commit d74157039d
110 changed files with 190 additions and 377 deletions

View File

@ -8,7 +8,6 @@
#include "nsISerializable.idl"
%{C++
struct JSContext;
struct JSPrincipals;
#include "nsCOMPtr.h"
#include "nsTArray.h"

View File

@ -18,13 +18,10 @@
#include "pldhash.h"
#include "plstr.h"
#include "nsIScriptExternalNameSet.h"
#include "js/TypeDecls.h"
#include <stdint.h>
namespace JS {
template <typename T> class Handle;
template <typename T> class MutableHandle;
}
class nsIDocShell;
class nsString;
class nsIClassInfo;

View File

@ -18,6 +18,7 @@
#include <ieeefp.h>
#endif
#include "js/TypeDecls.h"
#include "js/RootingAPI.h"
#include "mozilla/Assertions.h"
#include "mozilla/GuardObjects.h"
@ -92,7 +93,6 @@ class nsTextFragment;
class nsViewportInfo;
class nsWrapperCache;
struct JSContext;
struct JSPropertyDescriptor;
struct JSRuntime;
struct nsIntMargin;
@ -103,10 +103,6 @@ template<class K, class V> class nsDataHashtable;
template<class K, class V> class nsRefPtrHashtable;
template<class T> class nsReadingIterator;
namespace JS {
class Value;
} // namespace JS
namespace mozilla {
class ErrorResult;
class Selection;

View File

@ -19,6 +19,7 @@
#include "mozilla/ErrorResult.h"
#include "mozilla/MemoryReporting.h"
#include "mozilla/dom/EventTarget.h" // for base class
#include "js/TypeDecls.h" // for Handle, Value, JSObject, JSContext
// Including 'windows.h' will #define GetClassInfo to something else.
#ifdef XP_WIN
@ -67,11 +68,6 @@ template<typename T> class Optional;
} // namespace dom
} // namespace mozilla
namespace JS {
class Value;
template<typename T> class Handle;
}
#define NODE_FLAG_BIT(n_) (1U << (WRAPPER_CACHE_FLAGS_BITS_USED + (n_)))
enum {

View File

@ -108,8 +108,6 @@ StructuredCloneData UnpackClonedMessageDataForChild(const ClonedMessageData& aDa
} // namespace mozilla
class nsAXPCNativeCallContext;
struct JSContext;
class JSObject;
struct nsMessageListenerInfo
{

View File

@ -8,10 +8,9 @@
#include "nsIContent.h" // for use in inline function (ParentChainChanged)
#include "nsIMutationObserver.h" // for use in inline function (ParentChainChanged)
#include "js/TypeDecls.h"
struct CharacterDataChangeInfo;
struct JSContext;
class JSObject;
class nsIVariant;
class nsIDOMNode;
class nsIDOMUserDataHandler;

View File

@ -9,12 +9,7 @@
#include "WebGLTypes.h"
#include "nsISupports.h"
#include "nsString.h"
struct JSContext;
class JSObject;
namespace JS {
template <typename T> class Handle;
}
#include "js/TypeDecls.h"
namespace mozilla {

View File

@ -18,12 +18,11 @@
#include "mozilla/dom/EventBinding.h"
#include "nsIScriptGlobalObject.h"
#include "Units.h"
#include "js/TypeDecls.h"
class nsIContent;
class nsIDOMEventTarget;
class nsPresContext;
struct JSContext;
class JSObject;
namespace mozilla {
namespace dom {

View File

@ -8,9 +8,8 @@
#include "nsIDOMHTMLCollection.h"
#include "nsWrapperCache.h"
#include "js/TypeDecls.h"
struct JSContext;
class JSObject;
class nsINode;
class nsString;
template<class> class nsTArray;

View File

@ -9,9 +9,7 @@
#include "nsIDOMValidityState.h"
#include "nsIConstraintValidation.h"
#include "nsWrapperCache.h"
class JSObject;
struct JSContext;
#include "js/TypeDecls.h"
namespace mozilla {
namespace dom {

View File

@ -14,9 +14,7 @@
#include "nsAutoPtr.h"
#include "nsTArray.h"
#include "AudioContext.h"
struct JSContext;
class JSObject;
#include "js/TypeDecls.h"
namespace mozilla {

View File

@ -17,6 +17,7 @@
#include "nsDOMEventTargetHelper.h"
#include "nsHashKeys.h"
#include "nsTHashtable.h"
#include "js/TypeDecls.h"
// X11 has a #define for CurrentTime. Unbelievable :-(.
// See content/media/DOMMediaStream.h for more fun!
@ -24,8 +25,6 @@
#undef CurrentTime
#endif
struct JSContext;
class JSObject;
class nsPIDOMWindow;
namespace mozilla {

View File

@ -16,8 +16,7 @@
#include "AudioContext.h"
#include "PannerNode.h"
#include "WebAudioUtils.h"
struct JSContext;
#include "js/TypeDecls.h"
namespace mozilla {

View File

@ -15,8 +15,7 @@
#include "AudioNode.h"
#include "mozilla/dom/TypedArray.h"
#include "WebAudioUtils.h"
struct JSContext;
#include "js/TypeDecls.h"
namespace mozilla {

View File

@ -10,14 +10,13 @@
#include "nsCycleCollectionParticipant.h"
#include "nsString.h"
#include "nsWrapperCache.h"
#include "js/TypeDecls.h"
#include "mozilla/Attributes.h"
#include "mozilla/ErrorResult.h"
#include "EnableWebSpeechRecognitionCheck.h"
struct JSContext;
namespace mozilla {
namespace dom {

View File

@ -9,6 +9,7 @@
#include "nsCOMPtr.h"
#include "nsCycleCollectionParticipant.h"
#include "nsWrapperCache.h"
#include "js/TypeDecls.h"
#include "mozilla/Attributes.h"
#include "mozilla/dom/BindingUtils.h"
@ -16,8 +17,6 @@
#include "EnableWebSpeechRecognitionCheck.h"
#include "SpeechGrammar.h"
struct JSContext;
namespace mozilla {
namespace dom {

View File

@ -12,6 +12,7 @@
#include "nsString.h"
#include "nsWrapperCache.h"
#include "nsTArray.h"
#include "js/TypeDecls.h"
#include "nsIDOMNavigatorUserMedia.h"
#include "nsITimer.h"
@ -30,7 +31,6 @@
#include "mozilla/dom/SpeechRecognitionError.h"
struct JSContext;
class nsIDOMWindow;
namespace mozilla {

View File

@ -10,13 +10,12 @@
#include "nsString.h"
#include "nsWrapperCache.h"
#include "nsAutoPtr.h"
#include "js/TypeDecls.h"
#include "mozilla/Attributes.h"
#include "EnableWebSpeechRecognitionCheck.h"
struct JSContext;
namespace mozilla {
namespace dom {

View File

@ -11,14 +11,13 @@
#include "nsWrapperCache.h"
#include "nsAutoPtr.h"
#include "nsTArray.h"
#include "js/TypeDecls.h"
#include "mozilla/Attributes.h"
#include "EnableWebSpeechRecognitionCheck.h"
#include "SpeechRecognitionAlternative.h"
struct JSContext;
namespace mozilla {
namespace dom {

View File

@ -10,14 +10,13 @@
#include "nsWrapperCache.h"
#include "nsAutoPtr.h"
#include "nsTArray.h"
#include "js/TypeDecls.h"
#include "mozilla/Attributes.h"
#include "EnableWebSpeechRecognitionCheck.h"
#include "SpeechRecognitionResult.h"
struct JSContext;
namespace mozilla {
namespace dom {

View File

@ -10,12 +10,12 @@
#include "nsString.h"
#include "nsWrapperCache.h"
#include "nsRefPtrHashtable.h"
#include "js/TypeDecls.h"
#include "EnableSpeechSynthesisCheck.h"
#include "SpeechSynthesisUtterance.h"
#include "SpeechSynthesisVoice.h"
struct JSContext;
class nsIDOMWindow;
namespace mozilla {

View File

@ -9,12 +9,11 @@
#include "nsCOMPtr.h"
#include "nsDOMEventTargetHelper.h"
#include "nsString.h"
#include "js/TypeDecls.h"
#include "EnableSpeechSynthesisCheck.h"
#include "nsSpeechTask.h"
struct JSContext;
namespace mozilla {
namespace dom {

View File

@ -9,12 +9,11 @@
#include "nsCOMPtr.h"
#include "nsString.h"
#include "nsWrapperCache.h"
#include "js/TypeDecls.h"
#include "EnableSpeechSynthesisCheck.h"
#include "nsISpeechService.h"
struct JSContext;
namespace mozilla {
namespace dom {

View File

@ -15,6 +15,7 @@
#include "nsTArray.h"
#include "nsCycleCollectionParticipant.h"
#include "nsISupportsImpl.h"
#include "js/TypeDecls.h"
class nsXBLPrototypeBinding;
class nsIContent;
@ -31,8 +32,6 @@ class XBLChildrenElement;
}
class nsAnonymousContentList;
struct JSContext;
class JSObject;
// *********************************************************************/
// The XBLBinding class

View File

@ -15,8 +15,8 @@
#include "nsIWeakReference.h"
#include "nsIScriptGlobalObject.h"
#include "nsCycleCollectionParticipant.h"
#include "js/TypeDecls.h"
class JSObject;
class nsIDOMEvent;
class nsIContent;
class nsIDOMUIEvent;
@ -26,10 +26,6 @@ class nsIObjectInputStream;
class nsIObjectOutputStream;
class nsXBLPrototypeBinding;
namespace JS {
template <typename T> class MutableHandle;
}
namespace mozilla {
namespace dom {
class EventTarget;

View File

@ -9,11 +9,7 @@
#include "nsIObjectInputStream.h"
#include "nsIObjectOutputStream.h"
#include "nsINameSpaceManager.h"
namespace JS {
template <typename T> class Handle;
template <typename T> class MutableHandle;
}
#include "js/TypeDecls.h"
typedef uint8_t XBLBindingSerializeDetails;

View File

@ -25,6 +25,8 @@
#include "mozilla/Attributes.h"
#include "js/TypeDecls.h"
class nsIRDFResource;
class nsIRDFService;
class nsPIWindowRoot;
@ -40,7 +42,6 @@ class nsIXULPrototypeScript;
#include "nsURIHashKey.h"
#include "nsInterfaceHashtable.h"
class JSObject;
struct JSTracer;
struct PRLogModuleInfo;

View File

@ -9,9 +9,9 @@
#include "nsIAtom.idl"
%{ C++
#include "js/TypeDecls.h"
class nsPresContext;
class nsIPresShell;
struct JSContext;
%}
/**

View File

@ -8,8 +8,7 @@
#include "nsISupports.h"
#include "nsIScriptObjectPrincipal.h"
class JSObject;
#include "js/TypeDecls.h"
#define NS_IGLOBALOBJECT_IID \
{ 0x8503e9a9, 0x530, 0x4b26, \

View File

@ -10,11 +10,11 @@
#include "nsISupports.h"
#include "nsEvent.h"
#include "nsIGlobalObject.h"
#include "js/TypeDecls.h"
class nsIScriptContext;
class nsScriptErrorEvent;
class nsIScriptGlobalObject;
class JSObject;
// A helper function for nsIScriptGlobalObject implementations to use
// when handling a script error. Generally called by the global when a context

View File

@ -7,10 +7,8 @@
#define nsIScriptTimeoutHandler_h___
#include "nsTArray.h"
#include "js/TypeDecls.h"
namespace JS {
class Value;
} // namespace JS
namespace mozilla {
namespace dom {
class Function;

View File

@ -12,10 +12,10 @@
#include "nsIWeakReferenceUtils.h"
#include "nsWrapperCache.h"
#include "nsCycleCollectionParticipant.h"
#include "js/TypeDecls.h"
class nsIURI;
class nsIDocShell;
struct JSContext;
class nsIDocShellLoadInfo;
//*****************************************************************************

View File

@ -14,12 +14,12 @@
#include "nsAutoPtr.h"
#include "nsTArray.h"
#include "mozilla/dom/EventTarget.h"
#include "js/TypeDecls.h"
#define DOM_WINDOW_DESTROYED_TOPIC "dom-window-destroyed"
#define DOM_WINDOW_FROZEN_TOPIC "dom-window-frozen"
#define DOM_WINDOW_THAWED_TOPIC "dom-window-thawed"
class JSObject;
class nsIArray;
class nsIContent;
class nsIDocShell;
@ -33,10 +33,6 @@ class nsPIWindowRoot;
class nsXBLPrototypeHandler;
struct nsTimeout;
namespace JS {
template<typename> class Handle;
}
namespace mozilla {
namespace dom {
class AudioContext;

View File

@ -13,7 +13,6 @@
class nsPIDOMWindow;
class nsIControllers;
class nsIController;
struct JSContext;
#define NS_IWINDOWROOT_IID \
{ 0x3f71f50c, 0xa7e0, 0x43bc, \

View File

@ -12,11 +12,10 @@
#include "nsDOMNavigationTiming.h"
#include "nsContentUtils.h"
#include "nsIDOMWindow.h"
#include "js/TypeDecls.h"
class nsITimedChannel;
class nsPerformance;
class JSObject;
struct JSContext;
// Script "performance.timing" object
class nsPerformanceTiming MOZ_FINAL : public nsWrapperCache

View File

@ -13,8 +13,6 @@
#include "js/RootingAPI.h"
struct JSTracer;
class JSObject;
struct JSContext;
class XPCWrappedNativeScope;
namespace mozilla {

View File

@ -23,8 +23,6 @@
#include "nsTArray.h"
#include "nsAutoPtr.h" // for nsRefPtr member variables
struct JSContext;
class JSObject;
class nsWrapperCache;
// nsGlobalWindow implements nsWrapperCache, but doesn't always use it. Don't

View File

@ -9,13 +9,7 @@
#ifndef mozilla_dom_Date_h
#define mozilla_dom_Date_h
class JSObject;
struct JSContext;
namespace JS {
class Value;
template<typename> class MutableHandle;
} // namespace JS
#include "js/TypeDecls.h"
namespace mozilla {
namespace dom {

View File

@ -18,8 +18,6 @@
#include "nsStringGlue.h"
#include "mozilla/Assertions.h"
struct JSContext;
namespace mozilla {
namespace dom {

View File

@ -8,9 +8,7 @@
#define mozilla_dom_bluetooth_bluetoothutils_h__
#include "BluetoothCommon.h"
struct JSContext;
class JSObject;
#include "js/TypeDecls.h"
BEGIN_BLUETOOTH_NAMESPACE

View File

@ -10,9 +10,7 @@
#include "mozilla/ErrorResult.h"
#include "nsDOMEventTargetHelper.h"
#include "nsICellBroadcastProvider.h"
class JSObject;
struct JSContext;
#include "js/TypeDecls.h"
class nsPIDOMWindow;

View File

@ -5,10 +5,6 @@
#include "domstubs.idl"
%{ C++
struct JSContext;
%}
[scriptable, uuid(55226663-fe68-48ba-addf-08e32eaab569)]
interface nsIDOMHistory : nsISupports
{

View File

@ -11,7 +11,7 @@ interface nsIVariant;
interface nsIDocument;
%{C++
struct JSContext;
#include "js/TypeDecls.h"
%}
/**

View File

@ -8,6 +8,7 @@
%{C++
#include "nsEvent.h"
#include "mozilla/dom/Nullable.h"
#include "js/TypeDecls.h"
using mozilla::dom::Nullable;
@ -20,7 +21,6 @@ class EventTarget;
class nsPresContext;
class nsEventChainPreVisitor;
class nsEventChainPostVisitor;
struct JSContext;
class nsEventListenerManager;
%}

View File

@ -13,7 +13,7 @@ interface nsIScriptGlobalObject;
[ptr] native JSContext(JSContext);
%{C++
namespace JS { class Value; }
#include "js/TypeDecls.h"
%}
/**

View File

@ -22,10 +22,9 @@
#include "nsITabParent.h"
#include "nsWeakReference.h"
#include "Units.h"
#include "js/TypeDecls.h"
struct gfxMatrix;
struct JSContext;
class JSObject;
class mozIApplication;
class nsFrameLoader;
class nsIURI;

View File

@ -11,8 +11,6 @@
{ 0x41a77ec8, 0xfd86, 0x409e, { 0xae, 0xa9, 0xaf, 0x2c, 0xa4, 0x07, 0xef, 0x8e } }
class nsITCPServerSocketInternal;
struct JSContext;
struct JSObject;
namespace mozilla {
namespace dom {

View File

@ -10,9 +10,6 @@
#include "nsCOMPtr.h"
#include "nsIDOMTCPSocket.h"
struct JSContext;
struct JSObject;
namespace mozilla {
namespace dom {

View File

@ -6,13 +6,12 @@
#include "nsITCPSocketChild.h"
#include "nsCycleCollectionParticipant.h"
#include "nsCOMPtr.h"
#include "js/TypeDecls.h"
#define TCPSOCKETCHILD_CID \
{ 0xa589d96f, 0x7e09, 0x4edf, { 0xa0, 0x1a, 0xeb, 0x49, 0x51, 0xf4, 0x2f, 0x37 } }
class nsITCPSocketInternal;
struct JSContext;
class JSObject;
namespace mozilla {
namespace dom {

View File

@ -7,9 +7,7 @@
#include "nsCycleCollectionParticipant.h"
#include "nsCOMPtr.h"
#include "nsIDOMTCPSocket.h"
struct JSContext;
class JSObject;
#include "js/TypeDecls.h"
#define TCPSOCKETPARENT_CID \
{ 0x4e7246c6, 0xa8b3, 0x426d, { 0x9c, 0x17, 0x76, 0xda, 0xb1, 0xe1, 0xe1, 0x4a } }

View File

@ -16,6 +16,7 @@
#include "nsInterfaceHashtable.h"
#include "nsHashKeys.h"
#include <prinrval.h>
#include "js/TypeDecls.h"
#ifdef MOZ_WIDGET_ANDROID
#include "nsAutoPtr.h"
#include "nsIRunnable.h"
@ -30,8 +31,6 @@ class SharedPluginTexture;
#include "mozilla/TimeStamp.h"
#include "mozilla/PluginLibrary.h"
class JSObject;
class nsPluginStreamListenerPeer; // browser-initiated stream class
class nsNPAPIPluginStreamListener; // plugin-initiated stream class
class nsIPluginInstanceOwner;

View File

@ -15,8 +15,7 @@
#include "nsWrapperCache.h"
#include "nsAutoPtr.h"
#include "nsPIDOMWindow.h"
struct JSContext;
#include "js/TypeDecls.h"
namespace mozilla {
namespace dom {

View File

@ -12,8 +12,7 @@
#include "mozilla/dom/BindingDeclarations.h"
#include "nsCycleCollectionParticipant.h"
#include "nsWrapperCache.h"
struct JSContext;
#include "js/TypeDecls.h"
namespace mozilla {
namespace dom {

View File

@ -14,8 +14,7 @@
#include "nsCycleCollectionParticipant.h"
#include "nsWrapperCache.h"
#include "mozilla/dom/Nullable.h"
struct JSContext;
#include "js/TypeDecls.h"
////////////////////////////////////////////////////
// nsGeoPositionCoords

View File

@ -17,6 +17,7 @@
#include "nsIPromptFactory.h"
#include "nsPIWindowWatcher.h"
#include "nsTArray.h"
#include "js/TypeDecls.h"
class nsIURI;
class nsIDocShellTreeItem;
@ -26,8 +27,6 @@ class nsString;
class nsWatcherWindowEnumerator;
class nsIScriptContext;
class nsPromptService;
struct JSContext;
class JSObject;
struct nsWatcherWindowEntry;
struct SizeSpec;

View File

@ -11,12 +11,10 @@
#include "mozilla/ipc/PTestShellParent.h"
#include "mozilla/ipc/PTestShellCommandParent.h"
#include "js/TypeDecls.h"
#include "nsAutoJSValHolder.h"
#include "nsStringGlue.h"
struct JSContext;
class JSObject;
namespace mozilla {
namespace ipc {

View File

@ -16,9 +16,8 @@
#include "nsStringGlue.h"
#include "nsJSPrincipals.h"
#include "nsContentUtils.h"
#include "js/TypeDecls.h"
struct JSContext;
class JSObject;
struct JSPrincipals;
namespace mozilla {

View File

@ -11,12 +11,7 @@
#include "mozilla/Attributes.h"
class JSFunction;
class JSObject;
class JSScript;
class JSString;
namespace JS { class Value; }
#include "js/TypeDecls.h"
namespace JS {

View File

@ -38,9 +38,6 @@
#include "js/RootingAPI.h"
#include "js/Value.h"
struct JSContext;
class JSObject;
/* Typedef for native functions called by the JS VM. */
typedef bool
(* JSNative)(JSContext *cx, unsigned argc, JS::Value *vp);

View File

@ -9,11 +9,11 @@
#ifndef js_Class_h
#define js_Class_h
#include "jspubtd.h"
#include "jstypes.h"
#include "js/CallArgs.h"
#include "js/Id.h"
#include "js/TypeDecls.h"
/*
* A JSClass acts as a vtable for JS objects that allows JSAPI clients to
@ -24,18 +24,6 @@
class JSFreeOp;
namespace JS {
template <typename T> class Handle;
template <typename T> class MutableHandle;
class Value;
typedef JS::Handle<JSObject*> HandleObject;
typedef JS::Handle<jsid> HandleId;
typedef JS::Handle<JS::Value> HandleValue;
typedef JS::MutableHandle<JSObject*> MutableHandleObject;
typedef JS::MutableHandle<JS::Value> MutableHandleValue;
}
namespace js {
class Class;

View File

@ -7,14 +7,24 @@
#ifndef js_Id_h
#define js_Id_h
// A jsid is an identifier for a property or method of an object which is
// either a 31-bit signed integer, interned string or object.
//
// Also, there is an additional jsid value, JSID_VOID, which does not occur in
// JS scripts but may be used to indicate the absence of a valid jsid. A void
// jsid is not a valid id and only arises as an exceptional API return value,
// such as in JS_NextProperty. Embeddings must not pass JSID_VOID into JSAPI
// entry points expecting a jsid and do not need to handle JSID_VOID in hooks
// receiving a jsid except when explicitly noted in the API contract.
//
// A jsid is not implicitly convertible to or from a jsval; JS_ValueToId or
// JS_IdToValue must be used instead.
#include "jstypes.h"
#include "js/IdForward.h"
#include "js/TypeDecls.h"
#include "js/Utility.h"
class JSObject;
class JSString;
#ifdef JS_USE_JSID_STRUCT_TYPES
struct jsid
{

View File

@ -1,55 +0,0 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* vim: set ts=8 sts=4 et sw=4 tw=99:
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef js_IdForward_h
#define js_IdForward_h
#include <stddef.h>
// A jsid is an identifier for a property or method of an object which is
// either a 31-bit signed integer, interned string or object.
//
// Also, there is an additional jsid value, JSID_VOID, which does not occur in
// JS scripts but may be used to indicate the absence of a valid jsid. A void
// jsid is not a valid id and only arises as an exceptional API return value,
// such as in JS_NextProperty. Embeddings must not pass JSID_VOID into JSAPI
// entry points expecting a jsid and do not need to handle JSID_VOID in hooks
// receiving a jsid except when explicitly noted in the API contract.
//
// A jsid is not implicitly convertible to or from a jsval; JS_ValueToId or
// JS_IdToValue must be used instead.
//
// In release builds, jsid is defined to be an integral type. This
// prevents many bugs from being caught at compile time. E.g.:
//
// jsid id = ...
// if (id) // error
// ...
//
// size_t n = id; // error
//
// To catch more errors, jsid is given a struct type in C++ debug builds.
// Struct assignment and (in C++) operator== allow correct code to be mostly
// oblivious to the change. This feature can be explicitly disabled in debug
// builds by defining JS_NO_JSVAL_JSID_STRUCT_TYPES.
//
// Note: if jsid was always a struct, we could just forward declare it in
// places where its declaration is needed. But the fact that it's a typedef in
// non-debug builds prevents that. So we have this file, which is morally
// equivalent to a forward declaration, and should be included by any file that
// uses jsid but doesn't need its definition.
#if defined(DEBUG) && !defined(JS_NO_JSVAL_JSID_STRUCT_TYPES)
# define JS_USE_JSID_STRUCT_TYPES
#endif
#ifdef JS_USE_JSID_STRUCT_TYPES
struct jsid;
#else
typedef ptrdiff_t jsid;
#endif
#endif /* js_IdForward_h */

View File

@ -14,7 +14,7 @@
#include "jsbytecode.h"
#include "js/CallArgs.h"
#include "js/IdForward.h"
#include "js/TypeDecls.h"
class JSAtom;
class JSFreeOp;

View File

@ -13,7 +13,6 @@
#include "js/Utility.h"
struct JSRuntime;
class JSScript;
namespace js {

View File

@ -9,10 +9,9 @@
#ifndef js_PropertyKey_h
#define js_PropertyKey_h
#include "js/TypeDecls.h"
#include "js/Value.h"
struct JSContext;
namespace JS {
class PropertyKey;

View File

@ -12,7 +12,7 @@
#include "jspubtd.h"
#include "js/IdForward.h"
#include "js/TypeDecls.h"
#include "js/Utility.h"
/*
@ -98,7 +98,6 @@
namespace js {
class Module;
class ScriptSourceObject;
template <typename T>
@ -144,9 +143,6 @@ namespace JS {
template <typename T> class Rooted;
template <typename T> class Handle;
template <typename T> class MutableHandle;
/* This is exposing internal state of the GC for inlining purposes. */
JS_FRIEND_API(bool) isGCEnabled();
@ -467,15 +463,6 @@ class MOZ_NONHEAP_CLASS Handle : public js::HandleBase<T>
void operator=(S v) MOZ_DELETE;
};
typedef Handle<JSObject*> HandleObject;
typedef Handle<js::Module*> HandleModule;
typedef Handle<js::ScriptSourceObject *> HandleScriptSource;
typedef Handle<JSFunction*> HandleFunction;
typedef Handle<JSScript*> HandleScript;
typedef Handle<JSString*> HandleString;
typedef Handle<jsid> HandleId;
typedef Handle<Value> HandleValue;
/*
* Similar to a handle, but the underlying storage can be changed. This is
* useful for outparams.
@ -527,13 +514,6 @@ class MOZ_STACK_CLASS MutableHandle : public js::MutableHandleBase<T>
void operator=(MutableHandle other) MOZ_DELETE;
};
typedef MutableHandle<JSObject*> MutableHandleObject;
typedef MutableHandle<JSFunction*> MutableHandleFunction;
typedef MutableHandle<JSScript*> MutableHandleScript;
typedef MutableHandle<JSString*> MutableHandleString;
typedef MutableHandle<jsid> MutableHandleId;
typedef MutableHandle<Value> MutableHandleValue;
#ifdef JSGC_GENERATIONAL
JS_PUBLIC_API(void) HeapCellPostBarrier(js::gc::Cell **cellp);
JS_PUBLIC_API(void) HeapCellRelocate(js::gc::Cell **cellp);
@ -803,8 +783,6 @@ class Rooted<JSStableString *>;
#endif
typedef Rooted<JSObject*> RootedObject;
typedef Rooted<js::Module*> RootedModule;
typedef Rooted<js::ScriptSourceObject *> RootedScriptSource;
typedef Rooted<JSFunction*> RootedFunction;
typedef Rooted<JSScript*> RootedScript;
typedef Rooted<JSString*> RootedString;

View File

@ -11,17 +11,12 @@
#include "jstypes.h"
struct JSContext;
class JSObject;
#include "js/TypeDecls.h"
struct JSRuntime;
struct JSStructuredCloneReader;
struct JSStructuredCloneWriter;
namespace JS {
template <typename T> class Handle;
class Value;
}
// API for the HTML5 internal structured cloning algorithm.
// Read structured data from the reader r. This hook is used to read a value

81
js/public/TypeDecls.h Normal file
View File

@ -0,0 +1,81 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* vim: set ts=8 sts=4 et sw=4 tw=99:
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
// This file contains public type declarations that are used *frequently*. If
// it doesn't occur at least 10 times in Gecko, it probably shouldn't be in
// here.
//
// It includes only:
// - forward declarations of structs and classes;
// - typedefs;
// - enums (maybe).
// It does *not* contain any struct or class definitions.
#ifndef js_TypeDecls_h
#define js_TypeDecls_h
#include <stddef.h>
#include <stdint.h>
struct JSContext;
class JSFunction;
class JSObject;
class JSScript;
class JSString;
// In release builds, jsid is defined to be an integral type. This
// prevents many bugs from being caught at compile time. E.g.:
//
// jsid id = ...
// if (id) // error
// ...
//
// size_t n = id; // error
//
// To catch more errors, jsid is given a struct type in C++ debug builds.
// Struct assignment and (in C++) operator== allow correct code to be mostly
// oblivious to the change. This feature can be explicitly disabled in debug
// builds by defining JS_NO_JSVAL_JSID_STRUCT_TYPES.
//
#if defined(DEBUG) && !defined(JS_NO_JSVAL_JSID_STRUCT_TYPES)
# define JS_USE_JSID_STRUCT_TYPES
#endif
#ifdef JS_USE_JSID_STRUCT_TYPES
struct jsid;
#else
typedef ptrdiff_t jsid;
#endif
#ifdef WIN32
typedef wchar_t jschar;
#else
typedef uint16_t jschar;
#endif
namespace JS {
class Value;
template <typename T> class Handle;
template <typename T> class MutableHandle;
typedef Handle<JSFunction*> HandleFunction;
typedef Handle<jsid> HandleId;
typedef Handle<JSObject*> HandleObject;
typedef Handle<JSScript*> HandleScript;
typedef Handle<JSString*> HandleString;
typedef Handle<Value> HandleValue;
typedef MutableHandle<JSFunction*> MutableHandleFunction;
typedef MutableHandle<jsid> MutableHandleId;
typedef MutableHandle<JSObject*> MutableHandleObject;
typedef MutableHandle<JSScript*> MutableHandleScript;
typedef MutableHandle<JSString*> MutableHandleString;
typedef MutableHandle<Value> MutableHandleValue;
} // namespace JS
#endif /* js_TypeDecls_h */

View File

@ -10,8 +10,6 @@
#include <stdint.h>
#include <stdio.h>
class JSScript;
namespace JS {
class CompileOptions;
}

View File

@ -11,9 +11,6 @@
#include "js/RootingAPI.h"
struct JSContext;
class JSObject;
/*
* The Intl module specified by standard ECMA-402,
* ECMAScript Internationalization API Specification.
@ -26,7 +23,6 @@ class JSObject;
extern JSObject *
js_InitIntlClass(JSContext *cx, js::HandleObject obj);
namespace js {
/*

View File

@ -10,6 +10,10 @@
using namespace js;
namespace js {
typedef Rooted<Module*> RootedModule;
}
Class Module::class_ = {
"Module",
JSCLASS_HAS_RESERVED_SLOTS(2) | JSCLASS_IS_ANONYMOUS,

View File

@ -188,7 +188,7 @@ frontend::CompileScript(ExclusiveContext *cx, LifoAlloc *alloc, HandleObject sco
if (options.filename && !ss->setFilename(cx, options.filename))
return NULL;
JS::RootedScriptSource sourceObject(cx, ScriptSourceObject::create(cx, ss));
RootedScriptSource sourceObject(cx, ScriptSourceObject::create(cx, ss));
if (!sourceObject)
return NULL;
@ -416,7 +416,7 @@ frontend::CompileLazyFunction(JSContext *cx, LazyScript *lazy, const jschar *cha
return false;
RootedObject enclosingScope(cx, lazy->enclosingScope());
JS::RootedScriptSource sourceObject(cx, lazy->sourceObject());
RootedScriptSource sourceObject(cx, lazy->sourceObject());
JS_ASSERT(sourceObject);
Rooted<JSScript*> script(cx, JSScript::Create(cx, enclosingScope, false,
@ -468,7 +468,7 @@ CompileFunctionBody(JSContext *cx, MutableHandleFunction fun, CompileOptions opt
return false;
if (options.filename && !ss->setFilename(cx, options.filename))
return false;
JS::RootedScriptSource sourceObject(cx, ScriptSourceObject::create(cx, ss));
RootedScriptSource sourceObject(cx, ScriptSourceObject::create(cx, ss));
if (!sourceObject)
return false;
SourceCompressionTask sct(cx);

View File

@ -7,7 +7,7 @@
#ifndef frontend_NameFunctions_h
#define frontend_NameFunctions_h
struct JSContext;
#include "js/TypeDecls.h"
namespace js {
namespace frontend {

View File

@ -9,13 +9,7 @@
#include "gc/Barrier.h"
#include "jit/IonCode.h"
extern "C" {
struct JSContext;
class JSFunction;
class JSObject;
class JSScript;
}
#include "js/TypeDecls.h"
class JSAtom;
class JSLinearString;

View File

@ -24,6 +24,7 @@ typedef JS::Handle<Shape*> HandleShape;
typedef JS::Handle<types::TypeObject*> HandleTypeObject;
typedef JS::Handle<JSAtom*> HandleAtom;
typedef JS::Handle<PropertyName*> HandlePropertyName;
typedef JS::Handle<js::ScriptSourceObject*> HandleScriptSource;
typedef JS::MutableHandle<Shape*> MutableHandleShape;
typedef JS::MutableHandle<JSAtom*> MutableHandleAtom;
@ -32,6 +33,7 @@ typedef JS::Rooted<Shape*> RootedShape;
typedef JS::Rooted<types::TypeObject*> RootedTypeObject;
typedef JS::Rooted<JSAtom*> RootedAtom;
typedef JS::Rooted<PropertyName*> RootedPropertyName;
typedef Rooted<js::ScriptSourceObject*> RootedScriptSource;
} /* namespace js */

View File

@ -14,9 +14,6 @@
#include "jit/Registers.h"
#include "jit/shared/Assembler-shared.h"
class JSFunction;
class JSScript;
namespace js {
class LockedJSContext;

View File

@ -19,8 +19,6 @@ namespace JSC {
class ExecutablePool;
}
class JSScript;
namespace js {
class AsmJSModule;

View File

@ -20,9 +20,6 @@
#include "jit/IonFrameIterator.h"
#include "jit/Registers.h"
class JSFunction;
class JSScript;
namespace js {
namespace jit {

View File

@ -9,7 +9,7 @@
#include <stdio.h>
class JSScript;
#include "js/TypeDecls.h"
namespace js {
namespace jit {

View File

@ -11,8 +11,6 @@
#include "jit/IonMacroAssembler.h"
class JSScript;
namespace js {
namespace jit {

View File

@ -9,10 +9,9 @@
#ifndef jsalloc_h
#define jsalloc_h
#include "js/TypeDecls.h"
#include "js/Utility.h"
struct JSContext;
namespace js {
class ContextFriendFields;

View File

@ -11,8 +11,6 @@
#include "jscompartment.h"
class JSScript;
namespace js {
namespace analyze {

View File

@ -4637,7 +4637,6 @@ using JS::CallNonGenericMethod;
using JS::Rooted;
using JS::RootedObject;
using JS::RootedModule;
using JS::RootedFunction;
using JS::RootedScript;
using JS::RootedString;
@ -4646,7 +4645,6 @@ using JS::RootedValue;
using JS::Handle;
using JS::HandleObject;
using JS::HandleModule;
using JS::HandleFunction;
using JS::HandleScript;
using JS::HandleString;

View File

@ -14,15 +14,7 @@
#include "jstypes.h"
#include "js/RootingAPI.h"
extern "C" {
class JSObject;
struct JSContext;
}
namespace JS {
class Value;
}
#include "js/TypeDecls.h"
extern JSObject *
js_InitDateClass(JSContext *cx, JS::HandleObject obj);

View File

@ -21,7 +21,6 @@
class JSAtom;
struct JSCompartment;
class JSFunction;
class JSFlatString;
class JSLinearString;

View File

@ -18,8 +18,6 @@
#include "gc/Barrier.h"
#include "js/Utility.h"
class JSScript;
namespace js {
class TypeRepresentation;

View File

@ -42,8 +42,6 @@ extern const char js_isFinite_str[];
extern const char js_parseFloat_str[];
extern const char js_parseInt_str[];
class JSString;
/*
* When base == 10, this function implements ToString() as specified by
* ECMA-262-5 section 9.8.1; but note that it handles integers specially for

View File

@ -15,9 +15,8 @@
#include "jsprototypes.h"
#include "jstypes.h"
#include "jsversion.h" // #include here so it's seen everywhere
#include "js/IdForward.h"
#include "js/TypeDecls.h"
#if defined(JSGC_ROOT_ANALYSIS) || defined(JSGC_USE_EXACT_ROOTING) || defined(DEBUG)
# define JSGC_TRACK_EXACT_ROOTS
@ -25,12 +24,6 @@
namespace JS {
/*
* Allow headers to reference JS::Value without #including the whole jsapi.h.
* Unfortunately, typedefs (hence jsval) cannot be declared.
*/
class Value;
class AutoIdVector;
class CallArgs;
@ -46,12 +39,6 @@ struct Zone;
} /* namespace JS */
#ifdef WIN32
typedef wchar_t jschar;
#else
typedef uint16_t jschar;
#endif
/*
* Run-time version enumeration. For compile-time version checking, please use
* the JS_HAS_* macros in jsversion.h, or use MOZJS_MAJOR_VERSION,
@ -150,7 +137,6 @@ typedef enum {
typedef struct JSClass JSClass;
typedef struct JSCompartment JSCompartment;
typedef struct JSConstDoubleSpec JSConstDoubleSpec;
typedef struct JSContext JSContext;
typedef struct JSCrossCompartmentCall JSCrossCompartmentCall;
typedef struct JSErrorReport JSErrorReport;
typedef struct JSExceptionState JSExceptionState;
@ -170,11 +156,7 @@ typedef struct JSStructuredCloneWriter JSStructuredCloneWriter;
typedef struct JSTracer JSTracer;
class JSFlatString;
class JSFunction;
class JSObject;
class JSScript;
class JSStableString; // long story
class JSString;
#ifdef JS_THREADSAFE
typedef struct PRCallOnceType JSCallOnceType;

View File

@ -546,7 +546,7 @@ js::XDRScript(XDRState<mode> *xdr, HandleObject enclosingScope, HandleScript enc
options.setVersion(version_)
.setNoScriptRval(!!(scriptBits & (1 << NoScriptRval)))
.setSelfHostingMode(!!(scriptBits & (1 << SelfHosted)));
JS::RootedScriptSource sourceObject(cx);
RootedScriptSource sourceObject(cx);
if (scriptBits & (1 << OwnSource)) {
ScriptSource *ss = cx->new_<ScriptSource>(xdr->originPrincipals());
if (!ss)
@ -962,7 +962,7 @@ ScriptSourceObject::create(ExclusiveContext *cx, ScriptSource *source)
RootedObject object(cx, NewObjectWithGivenProto(cx, &class_, NULL, cx->global()));
if (!object)
return NULL;
JS::RootedScriptSource sourceObject(cx, &object->as<ScriptSourceObject>());
RootedScriptSource sourceObject(cx, &object->as<ScriptSourceObject>());
sourceObject->setSlot(SOURCE_SLOT, PrivateValue(source));
source->incref();
return sourceObject;
@ -1610,7 +1610,7 @@ JSScript::initCompartment(ExclusiveContext *cx)
JSScript *
JSScript::Create(ExclusiveContext *cx, HandleObject enclosingScope, bool savedCallerFun,
const CompileOptions &options, unsigned staticLevel,
JS::HandleScriptSource sourceObject, uint32_t bufStart, uint32_t bufEnd)
HandleScriptSource sourceObject, uint32_t bufStart, uint32_t bufEnd)
{
JS_ASSERT(bufStart <= bufEnd);
@ -2291,7 +2291,7 @@ js::CloneScript(JSContext *cx, HandleObject enclosingScope, HandleFunction fun,
.setVersion(src->getVersion());
/* Make sure we clone the script source object with the script */
JS::RootedScriptSource sourceObject(cx, ScriptSourceObject::create(cx, src->scriptSource()));
RootedScriptSource sourceObject(cx, ScriptSourceObject::create(cx, src->scriptSource()));
if (!sourceObject)
return NULL;

View File

@ -20,6 +20,7 @@
#include "jsopcode.h"
#include "gc/Barrier.h"
#include "gc/Rooting.h"
#include "vm/Shape.h"
namespace js {
@ -630,7 +631,7 @@ class JSScript : public js::gc::Cell
static JSScript *Create(js::ExclusiveContext *cx,
js::HandleObject enclosingScope, bool savedCallerFun,
const JS::CompileOptions &options, unsigned staticLevel,
JS::HandleScriptSource sourceObject, uint32_t sourceStart,
js::HandleScriptSource sourceObject, uint32_t sourceStart,
uint32_t sourceEnd);
void initCompartment(js::ExclusiveContext *cx);

View File

@ -20,9 +20,6 @@
#include "js/Utility.h"
/* Forward declarations. */
struct JSContext;
static JS_ALWAYS_INLINE void *
js_memcpy(void *dst_, const void *src_, size_t len)
{

View File

@ -68,7 +68,6 @@ EXPORTS.js += [
'../public/HashTable.h',
'../public/HeapAPI.h',
'../public/Id.h',
'../public/IdForward.h',
'../public/LegacyIntTypes.h',
'../public/MemoryMetrics.h',
'../public/OldDebugAPI.h',
@ -77,6 +76,7 @@ EXPORTS.js += [
'../public/RequiredDefines.h',
'../public/RootingAPI.h',
'../public/StructuredClone.h',
'../public/TypeDecls.h',
'../public/Utility.h',
'../public/Value.h',
'../public/Vector.h',

View File

@ -2859,7 +2859,7 @@ DebuggerScript_getSource(JSContext *cx, unsigned argc, Value *vp)
THIS_DEBUGSCRIPT_SCRIPT(cx, argc, vp, "(get source)", args, obj, script);
Debugger *dbg = Debugger::fromChildJSObject(obj);
JS::RootedScriptSource source(cx, script->sourceObject());
RootedScriptSource source(cx, script->sourceObject());
RootedObject sourceObject(cx, dbg->wrapSource(cx, source));
if (!sourceObject)
return false;
@ -3624,7 +3624,7 @@ Class DebuggerSource_class = {
};
JSObject *
Debugger::newDebuggerSource(JSContext *cx, JS::HandleScriptSource source)
Debugger::newDebuggerSource(JSContext *cx, HandleScriptSource source)
{
assertSameCompartment(cx, object.get());
@ -3640,7 +3640,7 @@ Debugger::newDebuggerSource(JSContext *cx, JS::HandleScriptSource source)
}
JSObject *
Debugger::wrapSource(JSContext *cx, JS::HandleScriptSource source)
Debugger::wrapSource(JSContext *cx, HandleScriptSource source)
{
assertSameCompartment(cx, object.get());
JS_ASSERT(cx->compartment() != source->compartment());
@ -3704,7 +3704,7 @@ DebuggerSource_checkThis(JSContext *cx, const CallArgs &args, const char *fnname
RootedObject obj(cx, DebuggerSource_checkThis(cx, args, fnname)); \
if (!obj) \
return false; \
JS::RootedScriptSource sourceObject(cx, GetSourceReferent(obj)); \
RootedScriptSource sourceObject(cx, GetSourceReferent(obj)); \
if (!sourceObject) \
return false;

View File

@ -365,7 +365,7 @@ class Debugger : private mozilla::LinkedListElement<Debugger>
* Allocate and initialize a Debugger.Source instance whose referent is
* |source|.
*/
JSObject *newDebuggerSource(JSContext *cx, JS::HandleScriptSource source);
JSObject *newDebuggerSource(JSContext *cx, js::HandleScriptSource source);
/*
* Receive a "new script" event from the engine. A new script was compiled
@ -528,7 +528,7 @@ class Debugger : private mozilla::LinkedListElement<Debugger>
* needed. The context |cx| must be in the debugger compartment; |source|
* must be a script source object in a debuggee compartment.
*/
JSObject *wrapSource(JSContext *cx, JS::HandleScriptSource source);
JSObject *wrapSource(JSContext *cx, js::HandleScriptSource source);
private:
Debugger(const Debugger &) MOZ_DELETE;

View File

@ -232,7 +232,7 @@ GlobalObject::initFunctionAndObjectClasses(JSContext *cx)
js_free(source);
return NULL;
}
JS::RootedScriptSource sourceObject(cx, ScriptSourceObject::create(cx, ss));
RootedScriptSource sourceObject(cx, ScriptSourceObject::create(cx, ss));
if (!sourceObject)
return NULL;
ss->setSource(source, sourceLen);

View File

@ -103,8 +103,6 @@
* from a signal handler when the JIT code is executing.
*/
class JSFunction;
namespace js {
class ProfileEntry;

View File

@ -93,8 +93,6 @@
* a single BaseShape.
*/
class JSObject;
namespace js {
class Bindings;

View File

@ -18,7 +18,6 @@
#endif
#include "js/OldDebugAPI.h"
struct JSContext;
struct JSCompartment;
struct JSGenerator;

View File

@ -25,7 +25,6 @@ class JSExtensibleString;
class JSExternalString;
class JSInlineString;
class JSStableString;
class JSString;
class JSRope;
namespace js {

View File

@ -20,10 +20,8 @@
#include "js/Vector.h"
struct JSContext;
struct JSRuntime;
struct JSCompartment;
class JSScript;
namespace js {

Some files were not shown because too many files have changed in this diff Show More