This commit is contained in:
Phil Ringnalda 2013-06-21 19:45:59 -07:00
Родитель 3beaf32f9a dd2ca8137b
Коммит 8fc8ce4788
169 изменённых файлов: 2984 добавлений и 3576 удалений

Просмотреть файл

@ -372,8 +372,8 @@ private:
bool SubjectIsPrivileged(); bool SubjectIsPrivileged();
static JSBool static JSBool
CheckObjectAccess(JSContext *cx, JSHandleObject obj, CheckObjectAccess(JSContext *cx, JS::Handle<JSObject*> obj,
JSHandleId id, JSAccessMode mode, JS::Handle<jsid> id, JSAccessMode mode,
JS::MutableHandle<JS::Value> vp); JS::MutableHandle<JS::Value> vp);
// Decides, based on CSP, whether or not eval() and stuff can be executed. // Decides, based on CSP, whether or not eval() and stuff can be executed.

Просмотреть файл

@ -484,8 +484,8 @@ nsScriptSecurityManager::ContentSecurityPolicyPermitsJSAction(JSContext *cx)
JSBool JSBool
nsScriptSecurityManager::CheckObjectAccess(JSContext *cx, JSHandleObject obj, nsScriptSecurityManager::CheckObjectAccess(JSContext *cx, JS::Handle<JSObject*> obj,
JSHandleId id, JSAccessMode mode, JS::Handle<jsid> id, JSAccessMode mode,
JS::MutableHandle<JS::Value> vp) JS::MutableHandle<JS::Value> vp)
{ {
// Get the security manager // Get the security manager

Просмотреть файл

@ -114,8 +114,8 @@ typedef CallbackObjectHolder<NodeFilter, nsIDOMNodeFilter> NodeFilterHolder;
} // namespace mozilla } // namespace mozilla
#define NS_IDOCUMENT_IID \ #define NS_IDOCUMENT_IID \
{ 0x308f8444, 0x7679, 0x445a, \ { 0x62cca591, 0xa030, 0x4117, \
{ 0xa6, 0xcc, 0xb9, 0x5c, 0x61, 0xff, 0xe2, 0x66 } } { 0x9b, 0x80, 0xdc, 0xd3, 0x66, 0xbb, 0xb5, 0x9 } }
// Flag for AddStyleSheet(). // Flag for AddStyleSheet().
#define NS_STYLESHEET_FROM_CATALOG (1 << 0) #define NS_STYLESHEET_FROM_CATALOG (1 << 0)
@ -770,13 +770,6 @@ public:
return mStyleAttrStyleSheet; return mStyleAttrStyleSheet;
} }
/**
* Get/set the object from which a document can get a script context
* and scope. This is the context within which all scripts (during
* document creation and during event handling) will run. Note that
* this is the *inner* window object.
*/
virtual nsIScriptGlobalObject* GetScriptGlobalObject() const = 0;
virtual void SetScriptGlobalObject(nsIScriptGlobalObject* aGlobalObject) = 0; virtual void SetScriptGlobalObject(nsIScriptGlobalObject* aGlobalObject) = 0;
/** /**
@ -1475,8 +1468,7 @@ public:
{ {
NS_PRECONDITION(!GetShell() && NS_PRECONDITION(!GetShell() &&
!nsCOMPtr<nsISupports>(GetContainer()) && !nsCOMPtr<nsISupports>(GetContainer()) &&
!GetWindow() && !GetWindow(),
!GetScriptGlobalObject(),
"Shouldn't set mDisplayDocument on documents that already " "Shouldn't set mDisplayDocument on documents that already "
"have a presentation or a docshell or a window"); "have a presentation or a docshell or a window");
NS_PRECONDITION(aDisplayDocument != this, "Should be different document"); NS_PRECONDITION(aDisplayDocument != this, "Should be different document");

Просмотреть файл

@ -308,7 +308,7 @@ nsContentSink::ProcessHeaderData(nsIAtom* aHeader, const nsAString& aValue,
NS_ENSURE_TRUE(codebaseURI, rv); NS_ENSURE_TRUE(codebaseURI, rv);
nsCOMPtr<nsIPrompt> prompt; nsCOMPtr<nsIPrompt> prompt;
nsCOMPtr<nsIDOMWindow> window = do_QueryInterface(mDocument->GetScriptGlobalObject()); nsCOMPtr<nsIDOMWindow> window = do_QueryInterface(mDocument->GetWindow());
if (window) { if (window) {
window->GetPrompter(getter_AddRefs(prompt)); window->GetPrompter(getter_AddRefs(prompt));
} }

Просмотреть файл

@ -6100,10 +6100,10 @@ nsContentUtils::IsPatternMatching(nsAString& aValue, nsAString& aPattern,
nsIDocument* aDocument) nsIDocument* aDocument)
{ {
NS_ASSERTION(aDocument, "aDocument should be a valid pointer (not null)"); NS_ASSERTION(aDocument, "aDocument should be a valid pointer (not null)");
NS_ENSURE_TRUE(aDocument->GetScriptGlobalObject(), true); nsCOMPtr<nsIScriptGlobalObject> sgo = do_QueryInterface(aDocument->GetWindow());
NS_ENSURE_TRUE(sgo, true);
AutoPushJSContext cx(aDocument->GetScriptGlobalObject()-> AutoPushJSContext cx(sgo->GetContext()->GetNativeContext());
GetContext()->GetNativeContext());
NS_ENSURE_TRUE(cx, true); NS_ENSURE_TRUE(cx, true);
// The pattern has to match the entire value. // The pattern has to match the entire value.

Просмотреть файл

@ -12,6 +12,14 @@
#include "mozilla/Attributes.h" #include "mozilla/Attributes.h"
#include <algorithm> #include <algorithm>
#define NS_DOMMULTIPARTBLOB_CID { 0x47bf0b43, 0xf37e, 0x49ef, \
{ 0x81, 0xa0, 0x18, 0xba, 0xc0, 0x57, 0xb5, 0xcc } }
#define NS_DOMMULTIPARTBLOB_CONTRACTID "@mozilla.org/dom/multipart-blob;1"
#define NS_DOMMULTIPARTFILE_CID { 0xc3361f77, 0x60d1, 0x4ea9, \
{ 0x94, 0x96, 0xdf, 0x5d, 0x6f, 0xcd, 0xd7, 0x8f } }
#define NS_DOMMULTIPARTFILE_CONTRACTID "@mozilla.org/dom/multipart-file;1"
class nsDOMMultipartFile : public nsDOMFile, class nsDOMMultipartFile : public nsDOMFile,
public nsIJSNativeInitializer public nsIJSNativeInitializer
{ {

Просмотреть файл

@ -4078,28 +4078,6 @@ nsDocument::FirstAdditionalAuthorSheet()
return mAdditionalSheets[eAuthorSheet].SafeObjectAt(0); return mAdditionalSheets[eAuthorSheet].SafeObjectAt(0);
} }
nsIScriptGlobalObject*
nsDocument::GetScriptGlobalObject() const
{
// If we're going away, we've already released the reference to our
// ScriptGlobalObject. We can, however, try to obtain it for the
// caller through our docshell.
// We actually need to start returning the docshell's script global
// object as soon as nsDocumentViewer::Close has called
// RemovedFromDocShell on us.
if (mRemovedFromDocShell) {
nsCOMPtr<nsIInterfaceRequestor> requestor =
do_QueryReferent(mDocumentContainer);
if (requestor) {
nsCOMPtr<nsIScriptGlobalObject> globalObject = do_GetInterface(requestor);
return globalObject;
}
}
return mScriptGlobalObject;
}
nsIGlobalObject* nsIGlobalObject*
nsDocument::GetScopeObject() const nsDocument::GetScopeObject() const
{ {
@ -4270,14 +4248,25 @@ nsPIDOMWindow *
nsDocument::GetWindowInternal() const nsDocument::GetWindowInternal() const
{ {
MOZ_ASSERT(!mWindow, "This should not be called when mWindow is not null!"); MOZ_ASSERT(!mWindow, "This should not be called when mWindow is not null!");
// Let's use mScriptGlobalObject. Even if the document is already removed from
nsCOMPtr<nsPIDOMWindow> win(do_QueryInterface(GetScriptGlobalObject())); // the docshell, the outer window might be still obtainable from the it.
nsCOMPtr<nsPIDOMWindow> win;
if (!win) { if (mRemovedFromDocShell) {
return nullptr; nsCOMPtr<nsIInterfaceRequestor> requestor =
do_QueryReferent(mDocumentContainer);
if (requestor) {
// The docshell returns the outer window we are done.
win = do_GetInterface(requestor);
}
} else {
win = do_QueryInterface(mScriptGlobalObject);
if (win) {
// mScriptGlobalObject is always the inner window, let's get the outer.
win = win->GetOuterWindow();
}
} }
return win->GetOuterWindow(); return win;
} }
nsScriptLoader* nsScriptLoader*
@ -7111,7 +7100,7 @@ nsDocument::IsScriptEnabled()
nsCOMPtr<nsIScriptSecurityManager> sm(do_GetService(NS_SCRIPTSECURITYMANAGER_CONTRACTID)); nsCOMPtr<nsIScriptSecurityManager> sm(do_GetService(NS_SCRIPTSECURITYMANAGER_CONTRACTID));
NS_ENSURE_TRUE(sm, false); NS_ENSURE_TRUE(sm, false);
nsIScriptGlobalObject* globalObject = GetScriptGlobalObject(); nsCOMPtr<nsIScriptGlobalObject> globalObject = do_QueryInterface(GetWindow());
NS_ENSURE_TRUE(globalObject, false); NS_ENSURE_TRUE(globalObject, false);
nsIScriptContext *scriptContext = globalObject->GetContext(); nsIScriptContext *scriptContext = globalObject->GetContext();
@ -8123,7 +8112,7 @@ nsDocument::MutationEventDispatched(nsINode* aTarget)
} }
nsCOMPtr<nsPIDOMWindow> window; nsCOMPtr<nsPIDOMWindow> window;
window = do_QueryInterface(GetScriptGlobalObject()); window = do_QueryInterface(GetWindow());
if (window && if (window &&
!window->HasMutationListeners(NS_EVENT_BITS_MUTATION_SUBTREEMODIFIED)) { !window->HasMutationListeners(NS_EVENT_BITS_MUTATION_SUBTREEMODIFIED)) {
mSubtreeModifiedTargets.Clear(); mSubtreeModifiedTargets.Clear();
@ -11275,7 +11264,7 @@ nsIDocument::WrapObject(JSContext *aCx, JS::Handle<JSObject*> aScope)
return nullptr; return nullptr;
} }
nsCOMPtr<nsPIDOMWindow> win = do_QueryInterface(GetScriptGlobalObject()); nsCOMPtr<nsPIDOMWindow> win = do_QueryInterface(GetInnerWindow());
if (!win) { if (!win) {
// No window, nothing else to do here // No window, nothing else to do here
return obj; return obj;

Просмотреть файл

@ -640,12 +640,6 @@ public:
return mChannel; return mChannel;
} }
/**
* Set the object from which a document can get a script context.
* This is the context within which all scripts (during document
* creation and during event handling) will run.
*/
virtual nsIScriptGlobalObject* GetScriptGlobalObject() const MOZ_OVERRIDE;
virtual void SetScriptGlobalObject(nsIScriptGlobalObject* aGlobalObject) MOZ_OVERRIDE; virtual void SetScriptGlobalObject(nsIScriptGlobalObject* aGlobalObject) MOZ_OVERRIDE;
virtual void SetScriptHandlingObject(nsIScriptGlobalObject* aScriptObject) MOZ_OVERRIDE; virtual void SetScriptHandlingObject(nsIScriptGlobalObject* aScriptObject) MOZ_OVERRIDE;

Просмотреть файл

@ -1797,7 +1797,7 @@ nsFrameLoader::GetWindowDimensions(nsRect& aRect)
} }
nsCOMPtr<nsIWebNavigation> parentAsWebNav = nsCOMPtr<nsIWebNavigation> parentAsWebNav =
do_GetInterface(doc->GetScriptGlobalObject()); do_GetInterface(doc->GetWindow());
if (!parentAsWebNav) { if (!parentAsWebNav) {
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
@ -1973,7 +1973,7 @@ nsFrameLoader::TryRemoteBrowser()
} }
nsCOMPtr<nsIWebNavigation> parentAsWebNav = nsCOMPtr<nsIWebNavigation> parentAsWebNav =
do_GetInterface(doc->GetScriptGlobalObject()); do_GetInterface(doc->GetWindow());
if (!parentAsWebNav) { if (!parentAsWebNav) {
return false; return false;

Просмотреть файл

@ -603,7 +603,7 @@ nsObjectLoadingContent::IsSupportedDocument(const nsCString& aMimeType)
nsCOMPtr<nsIWebNavigation> webNav; nsCOMPtr<nsIWebNavigation> webNav;
nsIDocument* currentDoc = thisContent->GetCurrentDoc(); nsIDocument* currentDoc = thisContent->GetCurrentDoc();
if (currentDoc) { if (currentDoc) {
webNav = do_GetInterface(currentDoc->GetScriptGlobalObject()); webNav = do_GetInterface(currentDoc->GetWindow());
} }
uint32_t supported; uint32_t supported;
@ -3187,8 +3187,8 @@ nsObjectLoadingContent::TeardownProtoChain()
} }
bool bool
nsObjectLoadingContent::DoNewResolve(JSContext* aCx, JSHandleObject aObject, nsObjectLoadingContent::DoNewResolve(JSContext* aCx, JS::Handle<JSObject*> aObject,
JSHandleId aId, unsigned aFlags, JS::Handle<jsid> aId, unsigned aFlags,
JS::MutableHandle<JSObject*> aObjp) JS::MutableHandle<JSObject*> aObjp)
{ {
// We don't resolve anything; we just try to make sure we're instantiated // We don't resolve anything; we just try to make sure we're instantiated

Просмотреть файл

@ -148,7 +148,7 @@ class nsObjectLoadingContent : public nsImageLoadingContent
void TeardownProtoChain(); void TeardownProtoChain();
// Helper for WebIDL newResolve // Helper for WebIDL newResolve
bool DoNewResolve(JSContext* aCx, JSHandleObject aObject, JSHandleId aId, bool DoNewResolve(JSContext* aCx, JS::Handle<JSObject*> aObject, JS::Handle<jsid> aId,
unsigned aFlags, JS::MutableHandle<JSObject*> aObjp); unsigned aFlags, JS::MutableHandle<JSObject*> aObjp);
// WebIDL API // WebIDL API

Просмотреть файл

@ -273,7 +273,7 @@ nsScriptLoader::StartLoad(nsScriptLoadRequest *aRequest, const nsAString &aType,
nsCOMPtr<nsILoadGroup> loadGroup = mDocument->GetDocumentLoadGroup(); nsCOMPtr<nsILoadGroup> loadGroup = mDocument->GetDocumentLoadGroup();
nsCOMPtr<nsPIDOMWindow> window(do_QueryInterface(mDocument->GetScriptGlobalObject())); nsCOMPtr<nsPIDOMWindow> window(do_QueryInterface(mDocument->GetWindow()));
if (!window) { if (!window) {
return NS_ERROR_NULL_POINTER; return NS_ERROR_NULL_POINTER;
} }
@ -430,7 +430,8 @@ nsScriptLoader::ProcessScriptElement(nsIScriptElement *aElement)
// For now though, if JS is disabled we assume every language is // For now though, if JS is disabled we assume every language is
// disabled. // disabled.
// XXX is this different from the mDocument->IsScriptEnabled() call? // XXX is this different from the mDocument->IsScriptEnabled() call?
nsIScriptGlobalObject *globalObject = mDocument->GetScriptGlobalObject(); nsCOMPtr<nsIScriptGlobalObject> globalObject =
do_QueryInterface(mDocument->GetWindow());
if (!globalObject) { if (!globalObject) {
return false; return false;
} }

Просмотреть файл

@ -889,10 +889,11 @@ HTMLCanvasElement::InvalidateCanvasContent(const gfx::Rect* damageRect)
* invalidating a canvas will feed into heuristics and cause JIT code to be * invalidating a canvas will feed into heuristics and cause JIT code to be
* kept around longer, for smoother animations. * kept around longer, for smoother animations.
*/ */
nsIScriptGlobalObject *scope = OwnerDoc()->GetScriptGlobalObject(); nsCOMPtr<nsIGlobalObject> global =
if (scope) { do_QueryInterface(OwnerDoc()->GetInnerWindow());
JSObject *obj = scope->GetGlobalJSObject();
if (obj) { if (global) {
if (JSObject *obj = global->GetGlobalJSObject()) {
js::NotifyAnimationActivity(obj); js::NotifyAnimationActivity(obj);
} }
} }

Просмотреть файл

@ -81,8 +81,7 @@ ImageListener::OnStartRequest(nsIRequest* request, nsISupports *ctxt)
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
} }
nsCOMPtr<nsPIDOMWindow> domWindow = nsCOMPtr<nsPIDOMWindow> domWindow = imgDoc->GetWindow();
do_QueryInterface(imgDoc->GetScriptGlobalObject());
NS_ENSURE_TRUE(domWindow, NS_ERROR_UNEXPECTED); NS_ENSURE_TRUE(domWindow, NS_ERROR_UNEXPECTED);
// Do a ShouldProcess check to see whether to keep loading the image. // Do a ShouldProcess check to see whether to keep loading the image.

Просмотреть файл

@ -1321,7 +1321,8 @@ IsScriptEnabled(nsIDocument *aDoc, nsIDocShell *aContainer)
{ {
NS_ENSURE_TRUE(aDoc && aContainer, true); NS_ENSURE_TRUE(aDoc && aContainer, true);
nsCOMPtr<nsIScriptGlobalObject> globalObject = aDoc->GetScriptGlobalObject(); nsCOMPtr<nsIScriptGlobalObject> globalObject =
do_QueryInterface(aDoc->GetWindow());
// Getting context is tricky if the document hasn't had its // Getting context is tricky if the document hasn't had its
// GlobalObject set yet // GlobalObject set yet

Просмотреть файл

@ -1172,7 +1172,8 @@ nsBindingManager::GetBindingImplementation(nsIContent* aContent, REFNSIID aIID,
nsIDocument* doc = aContent->OwnerDoc(); nsIDocument* doc = aContent->OwnerDoc();
nsIScriptGlobalObject *global = doc->GetScriptGlobalObject(); nsCOMPtr<nsIScriptGlobalObject> global =
do_QueryInterface(doc->GetWindow());
if (!global) if (!global)
return NS_NOINTERFACE; return NS_NOINTERFACE;

Просмотреть файл

@ -1254,7 +1254,7 @@ nsXBLBinding::AllowScripts()
return false; return false;
} }
nsIScriptGlobalObject* global = doc->GetScriptGlobalObject(); nsCOMPtr<nsIScriptGlobalObject> global = do_QueryInterface(doc->GetWindow());
if (!global) { if (!global) {
return false; return false;
} }

Просмотреть файл

@ -118,23 +118,23 @@ nsXBLDocGlobalObject::doCheckAccess(JSContext *cx, JS::Handle<JSObject*> obj,
} }
static JSBool static JSBool
nsXBLDocGlobalObject_getProperty(JSContext *cx, JSHandleObject obj, nsXBLDocGlobalObject_getProperty(JSContext *cx, JS::Handle<JSObject*> obj,
JSHandleId id, JS::MutableHandle<JS::Value> vp) JS::Handle<jsid> id, JS::MutableHandle<JS::Value> vp)
{ {
return nsXBLDocGlobalObject:: return nsXBLDocGlobalObject::
doCheckAccess(cx, obj, id, nsIXPCSecurityManager::ACCESS_GET_PROPERTY); doCheckAccess(cx, obj, id, nsIXPCSecurityManager::ACCESS_GET_PROPERTY);
} }
static JSBool static JSBool
nsXBLDocGlobalObject_setProperty(JSContext *cx, JSHandleObject obj, nsXBLDocGlobalObject_setProperty(JSContext *cx, JS::Handle<JSObject*> obj,
JSHandleId id, JSBool strict, JS::MutableHandle<JS::Value> vp) JS::Handle<jsid> id, JSBool strict, JS::MutableHandle<JS::Value> vp)
{ {
return nsXBLDocGlobalObject:: return nsXBLDocGlobalObject::
doCheckAccess(cx, obj, id, nsIXPCSecurityManager::ACCESS_SET_PROPERTY); doCheckAccess(cx, obj, id, nsIXPCSecurityManager::ACCESS_SET_PROPERTY);
} }
static JSBool static JSBool
nsXBLDocGlobalObject_checkAccess(JSContext *cx, JSHandleObject obj, JSHandleId id, nsXBLDocGlobalObject_checkAccess(JSContext *cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id,
JSAccessMode mode, JS::MutableHandle<JS::Value> vp) JSAccessMode mode, JS::MutableHandle<JS::Value> vp)
{ {
uint32_t translated; uint32_t translated;
@ -163,7 +163,7 @@ nsXBLDocGlobalObject_finalize(JSFreeOp *fop, JSObject *obj)
} }
static JSBool static JSBool
nsXBLDocGlobalObject_resolve(JSContext *cx, JS::HandleObject obj, JS::HandleId id) nsXBLDocGlobalObject_resolve(JSContext *cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id)
{ {
JSBool did_resolve = JS_FALSE; JSBool did_resolve = JS_FALSE;
return JS_ResolveStandardClass(cx, obj, id, &did_resolve); return JS_ResolveStandardClass(cx, obj, id, &did_resolve);

Просмотреть файл

@ -195,7 +195,8 @@ InstallXBLField(JSContext* cx,
MOZ_ASSERT(field); MOZ_ASSERT(field);
// This mirrors code in nsXBLProtoImpl::InstallImplementation // This mirrors code in nsXBLProtoImpl::InstallImplementation
nsIScriptGlobalObject* global = xblNode->OwnerDoc()->GetScriptGlobalObject(); nsCOMPtr<nsIScriptGlobalObject> global =
do_QueryInterface(xblNode->OwnerDoc()->GetWindow());
if (!global) { if (!global) {
return true; return true;
} }

Просмотреть файл

@ -281,7 +281,8 @@ nsXBLProtoImplAnonymousMethod::Execute(nsIContent* aBoundElement)
// nsXBLProtoImpl::InstallImplementation does. // nsXBLProtoImpl::InstallImplementation does.
nsIDocument* document = aBoundElement->OwnerDoc(); nsIDocument* document = aBoundElement->OwnerDoc();
nsIScriptGlobalObject* global = document->GetScriptGlobalObject(); nsCOMPtr<nsIScriptGlobalObject> global =
do_QueryInterface(document->GetWindow());
if (!global) { if (!global) {
return NS_OK; return NS_OK;
} }

Просмотреть файл

@ -454,7 +454,7 @@ nsXBLPrototypeHandler::DispatchXBLCommand(EventTarget* aTarget, nsIDOMEvent* aEv
if (!doc) if (!doc)
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
privateWindow = do_QueryInterface(doc->GetScriptGlobalObject()); privateWindow = doc->GetWindow();
if (!privateWindow) if (!privateWindow)
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
} }

Просмотреть файл

@ -97,7 +97,7 @@ already_AddRefed<nsPIWindowRoot>
nsXULCommandDispatcher::GetWindowRoot() nsXULCommandDispatcher::GetWindowRoot()
{ {
if (mDocument) { if (mDocument) {
nsCOMPtr<nsPIDOMWindow> window(do_QueryInterface(mDocument->GetScriptGlobalObject())); nsCOMPtr<nsPIDOMWindow> window(mDocument->GetWindow());
if (window) { if (window) {
return window->GetTopWindowRoot(); return window->GetTopWindowRoot();
} }

Просмотреть файл

@ -945,9 +945,9 @@ XULContentSinkImpl::OpenScript(const PRUnichar** aAttributes,
// Don't process scripts that aren't known // Don't process scripts that aren't known
if (langID != nsIProgrammingLanguage::UNKNOWN) { if (langID != nsIProgrammingLanguage::UNKNOWN) {
nsIScriptGlobalObject* globalObject = nullptr; // borrowed reference nsCOMPtr<nsIScriptGlobalObject> globalObject;
if (doc) if (doc)
globalObject = doc->GetScriptGlobalObject(); globalObject = do_QueryInterface(doc->GetWindow());
nsRefPtr<nsXULPrototypeScript> script = nsRefPtr<nsXULPrototypeScript> script =
new nsXULPrototypeScript(aLineNumber, version); new nsXULPrototypeScript(aLineNumber, version);
if (! script) if (! script)

Просмотреть файл

@ -103,7 +103,7 @@ nsXULPDGlobalObject_finalize(JSFreeOp *fop, JSObject *obj)
JSBool JSBool
nsXULPDGlobalObject_resolve(JSContext *cx, JS::HandleObject obj, JS::HandleId id) nsXULPDGlobalObject_resolve(JSContext *cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id)
{ {
JSBool did_resolve = JS_FALSE; JSBool did_resolve = JS_FALSE;

Просмотреть файл

@ -1371,7 +1371,8 @@ nsXULTemplateBuilder::InitHTMLTemplateRoot()
if (! doc) if (! doc)
return NS_ERROR_UNEXPECTED; return NS_ERROR_UNEXPECTED;
nsIScriptGlobalObject *global = doc->GetScriptGlobalObject(); nsCOMPtr<nsIScriptGlobalObject> global =
do_QueryInterface(doc->GetWindow());
if (! global) if (! global)
return NS_ERROR_UNEXPECTED; return NS_ERROR_UNEXPECTED;

Просмотреть файл

@ -2601,8 +2601,8 @@ static JSClass sGlobalScopePolluterClass = {
// static // static
JSBool JSBool
nsWindowSH::GlobalScopePolluterGetProperty(JSContext *cx, JSHandleObject obj, nsWindowSH::GlobalScopePolluterGetProperty(JSContext *cx, JS::Handle<JSObject*> obj,
JSHandleId id, JS::MutableHandle<JS::Value> vp) JS::Handle<jsid> id, JS::MutableHandle<JS::Value> vp)
{ {
// Someone is accessing a element by referencing its name/id in the // Someone is accessing a element by referencing its name/id in the
// global scope, do a security check to make sure that's ok. // global scope, do a security check to make sure that's ok.
@ -2624,7 +2624,7 @@ nsWindowSH::GlobalScopePolluterGetProperty(JSContext *cx, JSHandleObject obj,
// Gets a subframe. // Gets a subframe.
static JSBool static JSBool
ChildWindowGetter(JSContext *cx, JSHandleObject obj, JSHandleId id, ChildWindowGetter(JSContext *cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id,
JS::MutableHandle<JS::Value> vp) JS::MutableHandle<JS::Value> vp)
{ {
MOZ_ASSERT(JSID_IS_STRING(id)); MOZ_ASSERT(JSID_IS_STRING(id));
@ -2661,8 +2661,8 @@ GetDocument(JSObject *obj)
// static // static
JSBool JSBool
nsWindowSH::GlobalScopePolluterNewResolve(JSContext *cx, JSHandleObject obj, nsWindowSH::GlobalScopePolluterNewResolve(JSContext *cx, JS::Handle<JSObject*> obj,
JSHandleId id, unsigned flags, JS::Handle<jsid> id, unsigned flags,
JS::MutableHandle<JSObject*> objp) JS::MutableHandle<JSObject*> objp)
{ {
if (!JSID_IS_STRING(id)) { if (!JSID_IS_STRING(id)) {
@ -3108,7 +3108,8 @@ static const IDBConstant sIDBConstants[] = {
}; };
static JSBool static JSBool
IDBConstantGetter(JSContext *cx, JSHandleObject obj, JSHandleId id, JS::MutableHandle<JS::Value> vp) IDBConstantGetter(JSContext *cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id,
JS::MutableHandle<JS::Value> vp)
{ {
JSString *idstr = JSID_TO_STRING(id); JSString *idstr = JSID_TO_STRING(id);
unsigned index; unsigned index;
@ -4244,7 +4245,7 @@ LocationSetterGuts(JSContext *cx, JSObject *obj, jsval *vp)
template<class Interface> template<class Interface>
static JSBool static JSBool
LocationSetter(JSContext *cx, JSHandleObject obj, JSHandleId id, JSBool strict, LocationSetter(JSContext *cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JSBool strict,
JS::MutableHandle<JS::Value> vp) JS::MutableHandle<JS::Value> vp)
{ {
nsresult rv = LocationSetterGuts<Interface>(cx, obj, vp.address()); nsresult rv = LocationSetterGuts<Interface>(cx, obj, vp.address());
@ -4257,8 +4258,8 @@ LocationSetter(JSContext *cx, JSHandleObject obj, JSHandleId id, JSBool strict,
} }
static JSBool static JSBool
LocationSetterUnwrapper(JSContext *cx, JSHandleObject obj_, JSHandleId id, JSBool strict, LocationSetterUnwrapper(JSContext *cx, JS::Handle<JSObject*> obj_, JS::Handle<jsid> id,
JS::MutableHandle<JS::Value> vp) JSBool strict, JS::MutableHandle<JS::Value> vp)
{ {
JS::RootedObject obj(cx, obj_); JS::RootedObject obj(cx, obj_);
@ -5616,8 +5617,8 @@ nsHTMLDocumentSH::GetDocumentAllNodeList(JSContext *cx,
} }
JSBool JSBool
nsHTMLDocumentSH::DocumentAllGetProperty(JSContext *cx, JSHandleObject obj_, nsHTMLDocumentSH::DocumentAllGetProperty(JSContext *cx, JS::Handle<JSObject*> obj_,
JSHandleId id, JS::MutableHandle<JS::Value> vp) JS::Handle<jsid> id, JS::MutableHandle<JS::Value> vp)
{ {
JS::Rooted<JSObject*> obj(cx, obj_); JS::Rooted<JSObject*> obj(cx, obj_);
@ -5713,8 +5714,9 @@ nsHTMLDocumentSH::DocumentAllGetProperty(JSContext *cx, JSHandleObject obj_,
} }
JSBool JSBool
nsHTMLDocumentSH::DocumentAllNewResolve(JSContext *cx, JSHandleObject obj, JSHandleId id, nsHTMLDocumentSH::DocumentAllNewResolve(JSContext *cx, JS::Handle<JSObject*> obj,
unsigned flags, JS::MutableHandle<JSObject*> objp) JS::Handle<jsid> id, unsigned flags,
JS::MutableHandle<JSObject*> objp)
{ {
JS::RootedValue v(cx); JS::RootedValue v(cx);

Просмотреть файл

@ -343,11 +343,11 @@ public:
NS_IMETHOD OuterObject(nsIXPConnectWrappedNative *wrapper, JSContext * cx, NS_IMETHOD OuterObject(nsIXPConnectWrappedNative *wrapper, JSContext * cx,
JSObject * obj, JSObject * *_retval) MOZ_OVERRIDE; JSObject * obj, JSObject * *_retval) MOZ_OVERRIDE;
static JSBool GlobalScopePolluterNewResolve(JSContext *cx, JSHandleObject obj, static JSBool GlobalScopePolluterNewResolve(JSContext *cx, JS::Handle<JSObject*> obj,
JSHandleId id, unsigned flags, JS::Handle<jsid> id, unsigned flags,
JS::MutableHandle<JSObject*> objp); JS::MutableHandle<JSObject*> objp);
static JSBool GlobalScopePolluterGetProperty(JSContext *cx, JSHandleObject obj, static JSBool GlobalScopePolluterGetProperty(JSContext *cx, JS::Handle<JSObject*> obj,
JSHandleId id, JS::MutableHandle<JS::Value> vp); JS::Handle<jsid> id, JS::MutableHandle<JS::Value> vp);
static JSBool InvalidateGlobalScopePolluter(JSContext *cx, static JSBool InvalidateGlobalScopePolluter(JSContext *cx,
JS::Handle<JSObject*> obj); JS::Handle<JSObject*> obj);
static nsresult InstallGlobalScopePolluter(JSContext *cx, static nsresult InstallGlobalScopePolluter(JSContext *cx,
@ -576,9 +576,9 @@ protected:
nsDocument *doc, nsDocument *doc,
nsContentList **nodeList); nsContentList **nodeList);
public: public:
static JSBool DocumentAllGetProperty(JSContext *cx, JSHandleObject obj, JSHandleId id, static JSBool DocumentAllGetProperty(JSContext *cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id,
JS::MutableHandle<JS::Value> vp); JS::MutableHandle<JS::Value> vp);
static JSBool DocumentAllNewResolve(JSContext *cx, JSHandleObject obj, JSHandleId id, static JSBool DocumentAllNewResolve(JSContext *cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id,
unsigned flags, JS::MutableHandle<JSObject*> objp); unsigned flags, JS::MutableHandle<JSObject*> objp);
static void ReleaseDocument(JSFreeOp *fop, JSObject *obj); static void ReleaseDocument(JSFreeOp *fop, JSObject *obj);
static JSBool CallToGetPropMapper(JSContext *cx, unsigned argc, jsval *vp); static JSBool CallToGetPropMapper(JSContext *cx, unsigned argc, jsval *vp);

Просмотреть файл

@ -8074,11 +8074,7 @@ nsGlobalWindow::GetPrivateParent()
if (!doc) if (!doc)
return nullptr; // This is ok, just means a null parent. return nullptr; // This is ok, just means a null parent.
nsIScriptGlobalObject *globalObject = doc->GetScriptGlobalObject(); return doc->GetWindow();
if (!globalObject)
return nullptr; // This is ok, just means a null parent.
parent = do_QueryInterface(globalObject);
} }
if (parent) { if (parent) {

Просмотреть файл

@ -1319,7 +1319,7 @@ nsJSContext::CompileScript(const PRUnichar* aText,
NS_ENSURE_ARG_POINTER(aPrincipal); NS_ENSURE_ARG_POINTER(aPrincipal);
JSContext* cx = mContext; AutoPushJSContext cx(mContext);
JSAutoRequest ar(cx); JSAutoRequest ar(cx);
JS::Rooted<JSObject*> scopeObject(mContext, GetNativeGlobal()); JS::Rooted<JSObject*> scopeObject(mContext, GetNativeGlobal());
xpc_UnmarkGrayObject(scopeObject); xpc_UnmarkGrayObject(scopeObject);

Просмотреть файл

@ -655,7 +655,7 @@ TryPreserveWrapper(JSObject* obj)
// Can only be called with the immediate prototype of the instance object. Can // Can only be called with the immediate prototype of the instance object. Can
// only be called on the prototype of an object known to be a DOM instance. // only be called on the prototype of an object known to be a DOM instance.
JSBool JSBool
InstanceClassHasProtoAtDepth(JSHandleObject protoObject, uint32_t protoID, InstanceClassHasProtoAtDepth(JS::Handle<JSObject*> protoObject, uint32_t protoID,
uint32_t depth) uint32_t depth)
{ {
const DOMClass* domClass = static_cast<DOMClass*>( const DOMClass* domClass = static_cast<DOMClass*>(
@ -1755,7 +1755,7 @@ InterfaceHasInstance(JSContext* cx, JS::Handle<JSObject*> obj,
} }
JSBool JSBool
InterfaceHasInstance(JSContext* cx, JSHandleObject obj, JS::MutableHandle<JS::Value> vp, InterfaceHasInstance(JSContext* cx, JS::Handle<JSObject*> obj, JS::MutableHandle<JS::Value> vp,
JSBool* bp) JSBool* bp)
{ {
if (!vp.isObject()) { if (!vp.isObject()) {

Просмотреть файл

@ -928,7 +928,7 @@ TryPreserveWrapper(JSObject* obj);
// Can only be called with the immediate prototype of the instance object. Can // Can only be called with the immediate prototype of the instance object. Can
// only be called on the prototype of an object known to be a DOM instance. // only be called on the prototype of an object known to be a DOM instance.
JSBool JSBool
InstanceClassHasProtoAtDepth(JSHandleObject protoObject, uint32_t protoID, InstanceClassHasProtoAtDepth(JS::Handle<JSObject*> protoObject, uint32_t protoID,
uint32_t depth); uint32_t depth);
// Only set allowNativeWrapper to false if you really know you need it, if in // Only set allowNativeWrapper to false if you really know you need it, if in
@ -1970,7 +1970,7 @@ InterfaceHasInstance(JSContext* cx, JS::Handle<JSObject*> obj,
JS::Handle<JSObject*> instance, JS::Handle<JSObject*> instance,
JSBool* bp); JSBool* bp);
JSBool JSBool
InterfaceHasInstance(JSContext* cx, JSHandleObject obj, JS::MutableHandle<JS::Value> vp, InterfaceHasInstance(JSContext* cx, JS::Handle<JSObject*> obj, JS::MutableHandle<JS::Value> vp,
JSBool* bp); JSBool* bp);
// Helper for lenient getters/setters to report to console. If this // Helper for lenient getters/setters to report to console. If this

Просмотреть файл

@ -930,8 +930,8 @@ class CGAddPropertyHook(CGAbstractClassHook):
A hook for addProperty, used to preserve our wrapper from GC. A hook for addProperty, used to preserve our wrapper from GC.
""" """
def __init__(self, descriptor): def __init__(self, descriptor):
args = [Argument('JSContext*', 'cx'), Argument('JSHandleObject', 'obj'), args = [Argument('JSContext*', 'cx'), Argument('JS::Handle<JSObject*>', 'obj'),
Argument('JSHandleId', 'id'), Argument('JS::MutableHandle<JS::Value>', 'vp')] Argument('JS::Handle<jsid>', 'id'), Argument('JS::MutableHandle<JS::Value>', 'vp')]
CGAbstractClassHook.__init__(self, descriptor, ADDPROPERTY_HOOK_NAME, CGAbstractClassHook.__init__(self, descriptor, ADDPROPERTY_HOOK_NAME,
'JSBool', args) 'JSBool', args)
@ -1187,7 +1187,7 @@ class CGNamedConstructors(CGThing):
class CGClassHasInstanceHook(CGAbstractStaticMethod): class CGClassHasInstanceHook(CGAbstractStaticMethod):
def __init__(self, descriptor): def __init__(self, descriptor):
args = [Argument('JSContext*', 'cx'), Argument('JSHandleObject', 'obj'), args = [Argument('JSContext*', 'cx'), Argument('JS::Handle<JSObject*>', 'obj'),
Argument('JS::MutableHandle<JS::Value>', 'vp'), Argument('JSBool*', 'bp')] Argument('JS::MutableHandle<JS::Value>', 'vp'), Argument('JSBool*', 'bp')]
CGAbstractStaticMethod.__init__(self, descriptor, HASINSTANCE_HOOK_NAME, CGAbstractStaticMethod.__init__(self, descriptor, HASINSTANCE_HOOK_NAME,
'JSBool', args) 'JSBool', args)
@ -5206,7 +5206,7 @@ class CGSpecializedMethod(CGAbstractStaticMethod):
def __init__(self, descriptor, method): def __init__(self, descriptor, method):
self.method = method self.method = method
name = CppKeywords.checkMethodName(method.identifier.name) name = CppKeywords.checkMethodName(method.identifier.name)
args = [Argument('JSContext*', 'cx'), Argument('JSHandleObject', 'obj'), args = [Argument('JSContext*', 'cx'), Argument('JS::Handle<JSObject*>', 'obj'),
Argument('%s*' % descriptor.nativeType, 'self'), Argument('%s*' % descriptor.nativeType, 'self'),
Argument('const JSJitMethodCallArgs&', 'args')] Argument('const JSJitMethodCallArgs&', 'args')]
CGAbstractStaticMethod.__init__(self, descriptor, name, 'bool', args) CGAbstractStaticMethod.__init__(self, descriptor, name, 'bool', args)
@ -5252,8 +5252,8 @@ class CGNewResolveHook(CGAbstractBindingMethod):
""" """
def __init__(self, descriptor): def __init__(self, descriptor):
self._needNewResolve = descriptor.interface.getExtendedAttribute("NeedNewResolve") self._needNewResolve = descriptor.interface.getExtendedAttribute("NeedNewResolve")
args = [Argument('JSContext*', 'cx'), Argument('JSHandleObject', 'obj_'), args = [Argument('JSContext*', 'cx'), Argument('JS::Handle<JSObject*>', 'obj_'),
Argument('JSHandleId', 'id'), Argument('unsigned', 'flags'), Argument('JS::Handle<jsid>', 'id'), Argument('unsigned', 'flags'),
Argument('JS::MutableHandle<JSObject*>', 'objp')] Argument('JS::MutableHandle<JSObject*>', 'objp')]
# Our "self" is actually the callee in this case, not the thisval. # Our "self" is actually the callee in this case, not the thisval.
CGAbstractBindingMethod.__init__( CGAbstractBindingMethod.__init__(
@ -5343,7 +5343,7 @@ class CGSpecializedGetter(CGAbstractStaticMethod):
self.attr = attr self.attr = attr
name = 'get_' + attr.identifier.name name = 'get_' + attr.identifier.name
args = [ Argument('JSContext*', 'cx'), args = [ Argument('JSContext*', 'cx'),
Argument('JSHandleObject', 'obj'), Argument('JS::Handle<JSObject*>', 'obj'),
Argument('%s*' % descriptor.nativeType, 'self'), Argument('%s*' % descriptor.nativeType, 'self'),
Argument('JSJitGetterCallArgs', 'args') ] Argument('JSJitGetterCallArgs', 'args') ]
CGAbstractStaticMethod.__init__(self, descriptor, name, "bool", args) CGAbstractStaticMethod.__init__(self, descriptor, name, "bool", args)
@ -5431,7 +5431,7 @@ class CGSpecializedSetter(CGAbstractStaticMethod):
self.attr = attr self.attr = attr
name = 'set_' + attr.identifier.name name = 'set_' + attr.identifier.name
args = [ Argument('JSContext*', 'cx'), args = [ Argument('JSContext*', 'cx'),
Argument('JSHandleObject', 'obj'), Argument('JS::Handle<JSObject*>', 'obj'),
Argument('%s*' % descriptor.nativeType, 'self'), Argument('%s*' % descriptor.nativeType, 'self'),
Argument('JSJitSetterCallArgs', 'args')] Argument('JSJitSetterCallArgs', 'args')]
CGAbstractStaticMethod.__init__(self, descriptor, name, "bool", args) CGAbstractStaticMethod.__init__(self, descriptor, name, "bool", args)

Просмотреть файл

@ -36,7 +36,7 @@ DefineStaticJSVals(JSContext* cx)
int HandlerFamily; int HandlerFamily;
js::DOMProxyShadowsResult js::DOMProxyShadowsResult
DOMProxyShadows(JSContext* cx, JSHandleObject proxy, JSHandleId id) DOMProxyShadows(JSContext* cx, JS::Handle<JSObject*> proxy, JS::Handle<jsid> id)
{ {
JS::Value v = js::GetProxyExtra(proxy, JSPROXYSLOT_EXPANDO); JS::Value v = js::GetProxyExtra(proxy, JSPROXYSLOT_EXPANDO);
if (v.isObject()) { if (v.isObject()) {

Просмотреть файл

@ -1205,8 +1205,6 @@ policies and contribution forms [3].
this_obj.complete(); this_obj.complete();
} }
}); });
this.set_timeout();
} }
Tests.prototype.setup = function(func, properties) Tests.prototype.setup = function(func, properties)

Просмотреть файл

@ -54,7 +54,7 @@ nsresult
ConvertCloneReadInfosToArrayInternal( ConvertCloneReadInfosToArrayInternal(
JSContext* aCx, JSContext* aCx,
nsTArray<StructuredCloneReadInfo>& aReadInfos, nsTArray<StructuredCloneReadInfo>& aReadInfos,
jsval* aResult) JS::MutableHandle<JS::Value> aResult)
{ {
JS::Rooted<JSObject*> array(aCx, JS_NewArrayObject(aCx, 0, nullptr)); JS::Rooted<JSObject*> array(aCx, JS_NewArrayObject(aCx, 0, nullptr));
if (!array) { if (!array) {
@ -73,7 +73,7 @@ ConvertCloneReadInfosToArrayInternal(
StructuredCloneReadInfo& readInfo = aReadInfos[index]; StructuredCloneReadInfo& readInfo = aReadInfos[index];
JS::Rooted<JS::Value> val(aCx); JS::Rooted<JS::Value> val(aCx);
if (!IDBObjectStore::DeserializeValue(aCx, readInfo, val.address())) { if (!IDBObjectStore::DeserializeValue(aCx, readInfo, &val)) {
NS_WARNING("Failed to decode!"); NS_WARNING("Failed to decode!");
return NS_ERROR_DOM_DATA_CLONE_ERR; return NS_ERROR_DOM_DATA_CLONE_ERR;
} }
@ -85,7 +85,7 @@ ConvertCloneReadInfosToArrayInternal(
} }
} }
*aResult = OBJECT_TO_JSVAL(array); aResult.setObject(*array);
return NS_OK; return NS_OK;
} }
@ -112,18 +112,18 @@ HelperBase::~HelperBase()
nsresult nsresult
HelperBase::WrapNative(JSContext* aCx, HelperBase::WrapNative(JSContext* aCx,
nsISupports* aNative, nsISupports* aNative,
jsval* aResult) JS::MutableHandle<JS::Value> aResult)
{ {
NS_ASSERTION(aCx, "Null context!"); NS_ASSERTION(aCx, "Null context!");
NS_ASSERTION(aNative, "Null pointer!"); NS_ASSERTION(aNative, "Null pointer!");
NS_ASSERTION(aResult, "Null pointer!"); NS_ASSERTION(aResult.address(), "Null pointer!");
NS_ASSERTION(mRequest, "Null request!"); NS_ASSERTION(mRequest, "Null request!");
JS::Rooted<JSObject*> global(aCx, mRequest->GetParentObject()); JS::Rooted<JSObject*> global(aCx, mRequest->GetParentObject());
NS_ASSERTION(global, "This should never be null!"); NS_ASSERTION(global, "This should never be null!");
nsresult rv = nsresult rv =
nsContentUtils::WrapNative(aCx, global, aNative, aResult); nsContentUtils::WrapNative(aCx, global, aNative, aResult.address());
NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR); NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
return NS_OK; return NS_OK;
@ -533,11 +533,11 @@ AsyncConnectionHelper::OnError()
nsresult nsresult
AsyncConnectionHelper::GetSuccessResult(JSContext* aCx, AsyncConnectionHelper::GetSuccessResult(JSContext* aCx,
jsval* aVal) JS::MutableHandle<JS::Value> aVal)
{ {
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!"); NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
*aVal = JSVAL_VOID; aVal.setUndefined();
return NS_OK; return NS_OK;
} }
@ -612,10 +612,10 @@ nsresult
AsyncConnectionHelper::ConvertToArrayAndCleanup( AsyncConnectionHelper::ConvertToArrayAndCleanup(
JSContext* aCx, JSContext* aCx,
nsTArray<StructuredCloneReadInfo>& aReadInfos, nsTArray<StructuredCloneReadInfo>& aReadInfos,
jsval* aResult) JS::MutableHandle<JS::Value> aResult)
{ {
NS_ASSERTION(aCx, "Null context!"); NS_ASSERTION(aCx, "Null context!");
NS_ASSERTION(aResult, "Null pointer!"); NS_ASSERTION(aResult.address(), "Null pointer!");
nsresult rv = ConvertCloneReadInfosToArrayInternal(aCx, aReadInfos, aResult); nsresult rv = ConvertCloneReadInfosToArrayInternal(aCx, aReadInfos, aResult);

Просмотреть файл

@ -41,7 +41,7 @@ public:
virtual nsresult GetResultCode() = 0; virtual nsresult GetResultCode() = 0;
virtual nsresult GetSuccessResult(JSContext* aCx, virtual nsresult GetSuccessResult(JSContext* aCx,
jsval* aVal) = 0; JS::MutableHandle<JS::Value> aVal) = 0;
IDBRequest* GetRequest() const IDBRequest* GetRequest() const
{ {
@ -61,7 +61,7 @@ protected:
*/ */
nsresult WrapNative(JSContext* aCx, nsresult WrapNative(JSContext* aCx,
nsISupports* aNative, nsISupports* aNative,
jsval* aResult); JS::MutableHandle<JS::Value> aResult);
/** /**
* Gives the subclass a chance to release any objects that must be released * Gives the subclass a chance to release any objects that must be released
@ -201,7 +201,7 @@ protected:
* accesses the result property of the request. * accesses the result property of the request.
*/ */
virtual nsresult GetSuccessResult(JSContext* aCx, virtual nsresult GetSuccessResult(JSContext* aCx,
jsval* aVal) MOZ_OVERRIDE; JS::MutableHandle<JS::Value> aVal) MOZ_OVERRIDE;
/** /**
* Gives the subclass a chance to release any objects that must be released * Gives the subclass a chance to release any objects that must be released
@ -216,7 +216,7 @@ protected:
static nsresult ConvertToArrayAndCleanup( static nsresult ConvertToArrayAndCleanup(
JSContext* aCx, JSContext* aCx,
nsTArray<StructuredCloneReadInfo>& aReadInfos, nsTArray<StructuredCloneReadInfo>& aReadInfos,
jsval* aResult); JS::MutableHandle<JS::Value> aResult);
/** /**
* This should only be called by AutoSetCurrentTransaction. * This should only be called by AutoSetCurrentTransaction.

Просмотреть файл

@ -88,7 +88,7 @@ public:
MOZ_OVERRIDE; MOZ_OVERRIDE;
virtual nsresult GetSuccessResult(JSContext* aCx, virtual nsresult GetSuccessResult(JSContext* aCx,
jsval* aVal) MOZ_OVERRIDE; JS::MutableHandle<JS::Value> aVal) MOZ_OVERRIDE;
virtual void ReleaseMainThreadObjects() MOZ_OVERRIDE; virtual void ReleaseMainThreadObjects() MOZ_OVERRIDE;
@ -607,7 +607,7 @@ IDBCursor::GetValue(JSContext* aCx,
} }
JS::Rooted<JS::Value> val(aCx); JS::Rooted<JS::Value> val(aCx);
if (!IDBObjectStore::DeserializeValue(aCx, mCloneReadInfo, val.address())) { if (!IDBObjectStore::DeserializeValue(aCx, mCloneReadInfo, &val)) {
return NS_ERROR_DOM_DATA_CLONE_ERR; return NS_ERROR_DOM_DATA_CLONE_ERR;
} }
@ -1004,12 +1004,12 @@ ContinueHelper::DoDatabaseWork(mozIStorageConnection* aConnection)
nsresult nsresult
ContinueHelper::GetSuccessResult(JSContext* aCx, ContinueHelper::GetSuccessResult(JSContext* aCx,
jsval* aVal) JS::MutableHandle<JS::Value> aVal)
{ {
UpdateCursorState(); UpdateCursorState();
if (mKey.IsUnset()) { if (mKey.IsUnset()) {
*aVal = JSVAL_NULL; aVal.setNull();
} }
else { else {
nsresult rv = WrapNative(aCx, mCursor, aVal); nsresult rv = WrapNative(aCx, mCursor, aVal);

Просмотреть файл

@ -118,7 +118,7 @@ public:
nsresult DoDatabaseWork(mozIStorageConnection* aConnection); nsresult DoDatabaseWork(mozIStorageConnection* aConnection);
nsresult GetSuccessResult(JSContext* aCx, nsresult GetSuccessResult(JSContext* aCx,
jsval* aVal); JS::MutableHandle<JS::Value> aVal);
void ReleaseMainThreadObjects() void ReleaseMainThreadObjects()
{ {
mFileInfo = nullptr; mFileInfo = nullptr;
@ -1016,7 +1016,7 @@ CreateFileHelper::DoDatabaseWork(mozIStorageConnection* aConnection)
nsresult nsresult
CreateFileHelper::GetSuccessResult(JSContext* aCx, CreateFileHelper::GetSuccessResult(JSContext* aCx,
jsval* aVal) JS::MutableHandle<JS::Value> aVal)
{ {
nsRefPtr<IDBFileHandle> fileHandle = nsRefPtr<IDBFileHandle> fileHandle =
IDBFileHandle::Create(mDatabase, mName, mType, mFileInfo.forget()); IDBFileHandle::Create(mDatabase, mName, mType, mFileInfo.forget());

Просмотреть файл

@ -85,7 +85,7 @@ public:
MOZ_OVERRIDE; MOZ_OVERRIDE;
virtual nsresult GetSuccessResult(JSContext* aCx, virtual nsresult GetSuccessResult(JSContext* aCx,
jsval* aVal) MOZ_OVERRIDE; JS::MutableHandle<JS::Value> aVal) MOZ_OVERRIDE;
virtual void ReleaseMainThreadObjects() MOZ_OVERRIDE; virtual void ReleaseMainThreadObjects() MOZ_OVERRIDE;
@ -126,7 +126,7 @@ public:
MOZ_OVERRIDE; MOZ_OVERRIDE;
virtual nsresult GetSuccessResult(JSContext* aCx, virtual nsresult GetSuccessResult(JSContext* aCx,
jsval* aVal) MOZ_OVERRIDE; JS::MutableHandle<JS::Value> aVal) MOZ_OVERRIDE;
virtual void ReleaseMainThreadObjects() MOZ_OVERRIDE; virtual void ReleaseMainThreadObjects() MOZ_OVERRIDE;
@ -159,7 +159,7 @@ public:
MOZ_OVERRIDE; MOZ_OVERRIDE;
virtual nsresult GetSuccessResult(JSContext* aCx, virtual nsresult GetSuccessResult(JSContext* aCx,
jsval* aVal) MOZ_OVERRIDE; JS::MutableHandle<JS::Value> aVal) MOZ_OVERRIDE;
virtual nsresult virtual nsresult
PackArgumentsForParentProcess(IndexRequestParams& aParams) MOZ_OVERRIDE; PackArgumentsForParentProcess(IndexRequestParams& aParams) MOZ_OVERRIDE;
@ -198,7 +198,7 @@ public:
MOZ_OVERRIDE; MOZ_OVERRIDE;
virtual nsresult GetSuccessResult(JSContext* aCx, virtual nsresult GetSuccessResult(JSContext* aCx,
jsval* aVal) MOZ_OVERRIDE; JS::MutableHandle<JS::Value> aVal) MOZ_OVERRIDE;
virtual void ReleaseMainThreadObjects() MOZ_OVERRIDE; virtual void ReleaseMainThreadObjects() MOZ_OVERRIDE;
@ -238,7 +238,7 @@ public:
MOZ_OVERRIDE; MOZ_OVERRIDE;
virtual nsresult GetSuccessResult(JSContext* aCx, virtual nsresult GetSuccessResult(JSContext* aCx,
jsval* aVal) MOZ_OVERRIDE; JS::MutableHandle<JS::Value> aVal) MOZ_OVERRIDE;
virtual void ReleaseMainThreadObjects() MOZ_OVERRIDE; virtual void ReleaseMainThreadObjects() MOZ_OVERRIDE;
@ -320,7 +320,7 @@ public:
MOZ_OVERRIDE; MOZ_OVERRIDE;
virtual nsresult GetSuccessResult(JSContext* aCx, virtual nsresult GetSuccessResult(JSContext* aCx,
jsval* aVal) MOZ_OVERRIDE; JS::MutableHandle<JS::Value> aVal) MOZ_OVERRIDE;
virtual void ReleaseMainThreadObjects() MOZ_OVERRIDE; virtual void ReleaseMainThreadObjects() MOZ_OVERRIDE;
@ -1177,14 +1177,9 @@ GetKeyHelper::DoDatabaseWork(mozIStorageConnection* /* aConnection */)
nsresult nsresult
GetKeyHelper::GetSuccessResult(JSContext* aCx, GetKeyHelper::GetSuccessResult(JSContext* aCx,
jsval* aVal) JS::MutableHandle<JS::Value> aVal)
{ {
JS::Rooted<JS::Value> value(aCx); return mKey.ToJSVal(aCx, aVal);
nsresult rv = mKey.ToJSVal(aCx, &value);
if (NS_SUCCEEDED(rv)) {
*aVal = value;
}
return rv;
} }
void void
@ -1309,7 +1304,7 @@ GetHelper::DoDatabaseWork(mozIStorageConnection* /* aConnection */)
nsresult nsresult
GetHelper::GetSuccessResult(JSContext* aCx, GetHelper::GetSuccessResult(JSContext* aCx,
jsval* aVal) JS::MutableHandle<JS::Value> aVal)
{ {
bool result = IDBObjectStore::DeserializeValue(aCx, mCloneReadInfo, aVal); bool result = IDBObjectStore::DeserializeValue(aCx, mCloneReadInfo, aVal);
@ -1488,7 +1483,7 @@ GetAllKeysHelper::DoDatabaseWork(mozIStorageConnection* /* aConnection */)
nsresult nsresult
GetAllKeysHelper::GetSuccessResult(JSContext* aCx, GetAllKeysHelper::GetSuccessResult(JSContext* aCx,
jsval* aVal) JS::MutableHandle<JS::Value> aVal)
{ {
NS_ASSERTION(mKeys.Length() <= mLimit, "Too many results!"); NS_ASSERTION(mKeys.Length() <= mLimit, "Too many results!");
@ -1525,7 +1520,7 @@ GetAllKeysHelper::GetSuccessResult(JSContext* aCx,
} }
} }
*aVal = OBJECT_TO_JSVAL(array); aVal.setObject(*array);
return NS_OK; return NS_OK;
} }
@ -1665,7 +1660,7 @@ GetAllHelper::DoDatabaseWork(mozIStorageConnection* /* aConnection */)
nsresult nsresult
GetAllHelper::GetSuccessResult(JSContext* aCx, GetAllHelper::GetSuccessResult(JSContext* aCx,
jsval* aVal) JS::MutableHandle<JS::Value> aVal)
{ {
NS_ASSERTION(mCloneReadInfos.Length() <= mLimit, "Too many results!"); NS_ASSERTION(mCloneReadInfos.Length() <= mLimit, "Too many results!");
@ -2005,7 +2000,7 @@ OpenKeyCursorHelper::EnsureCursor()
nsresult nsresult
OpenKeyCursorHelper::GetSuccessResult(JSContext* aCx, OpenKeyCursorHelper::GetSuccessResult(JSContext* aCx,
jsval* aVal) JS::MutableHandle<JS::Value> aVal)
{ {
nsresult rv = EnsureCursor(); nsresult rv = EnsureCursor();
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);
@ -2015,7 +2010,7 @@ OpenKeyCursorHelper::GetSuccessResult(JSContext* aCx,
NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR); NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
} }
else { else {
*aVal = JSVAL_VOID; aVal.setUndefined();
} }
return NS_OK; return NS_OK;
@ -2554,9 +2549,9 @@ CountHelper::DoDatabaseWork(mozIStorageConnection* aConnection)
nsresult nsresult
CountHelper::GetSuccessResult(JSContext* aCx, CountHelper::GetSuccessResult(JSContext* aCx,
jsval* aVal) JS::MutableHandle<JS::Value> aVal)
{ {
*aVal = JS_NumberValue(static_cast<double>(mCount)); aVal.setNumber(static_cast<double>(mCount));
return NS_OK; return NS_OK;
} }

Просмотреть файл

@ -171,7 +171,7 @@ public:
MOZ_OVERRIDE; MOZ_OVERRIDE;
virtual nsresult GetSuccessResult(JSContext* aCx, virtual nsresult GetSuccessResult(JSContext* aCx,
jsval* aVal) MOZ_OVERRIDE; JS::MutableHandle<JS::Value> aVal) MOZ_OVERRIDE;
virtual void ReleaseMainThreadObjects() MOZ_OVERRIDE; virtual void ReleaseMainThreadObjects() MOZ_OVERRIDE;
@ -215,7 +215,7 @@ public:
MOZ_OVERRIDE; MOZ_OVERRIDE;
virtual nsresult GetSuccessResult(JSContext* aCx, virtual nsresult GetSuccessResult(JSContext* aCx,
jsval* aVal) MOZ_OVERRIDE; JS::MutableHandle<JS::Value> aVal) MOZ_OVERRIDE;
virtual void ReleaseMainThreadObjects() MOZ_OVERRIDE; virtual void ReleaseMainThreadObjects() MOZ_OVERRIDE;
@ -252,7 +252,7 @@ public:
MOZ_OVERRIDE; MOZ_OVERRIDE;
virtual nsresult GetSuccessResult(JSContext* aCx, virtual nsresult GetSuccessResult(JSContext* aCx,
jsval* aVal) MOZ_OVERRIDE; JS::MutableHandle<JS::Value> aVal) MOZ_OVERRIDE;
virtual nsresult virtual nsresult
PackArgumentsForParentProcess(ObjectStoreRequestParams& aParams) MOZ_OVERRIDE; PackArgumentsForParentProcess(ObjectStoreRequestParams& aParams) MOZ_OVERRIDE;
@ -309,7 +309,7 @@ public:
MOZ_OVERRIDE; MOZ_OVERRIDE;
virtual nsresult GetSuccessResult(JSContext* aCx, virtual nsresult GetSuccessResult(JSContext* aCx,
jsval* aVal) MOZ_OVERRIDE; JS::MutableHandle<JS::Value> aVal) MOZ_OVERRIDE;
virtual void ReleaseMainThreadObjects() MOZ_OVERRIDE; virtual void ReleaseMainThreadObjects() MOZ_OVERRIDE;
@ -415,7 +415,7 @@ public:
MOZ_OVERRIDE; MOZ_OVERRIDE;
virtual nsresult GetSuccessResult(JSContext* aCx, virtual nsresult GetSuccessResult(JSContext* aCx,
jsval* aVal) MOZ_OVERRIDE; JS::MutableHandle<JS::Value> aVal) MOZ_OVERRIDE;
virtual void ReleaseMainThreadObjects() MOZ_OVERRIDE; virtual void ReleaseMainThreadObjects() MOZ_OVERRIDE;
@ -454,7 +454,7 @@ public:
MOZ_OVERRIDE; MOZ_OVERRIDE;
virtual nsresult GetSuccessResult(JSContext* aCx, virtual nsresult GetSuccessResult(JSContext* aCx,
jsval* aVal) MOZ_OVERRIDE; JS::MutableHandle<JS::Value> aVal) MOZ_OVERRIDE;
virtual void ReleaseMainThreadObjects() MOZ_OVERRIDE; virtual void ReleaseMainThreadObjects() MOZ_OVERRIDE;
@ -1219,7 +1219,7 @@ IDBObjectStore::ClearStructuredCloneBuffer(JSAutoStructuredCloneBuffer& aBuffer)
bool bool
IDBObjectStore::DeserializeValue(JSContext* aCx, IDBObjectStore::DeserializeValue(JSContext* aCx,
StructuredCloneReadInfo& aCloneReadInfo, StructuredCloneReadInfo& aCloneReadInfo,
jsval* aValue) JS::MutableHandle<JS::Value> aValue)
{ {
NS_ASSERTION(NS_IsMainThread(), NS_ASSERTION(NS_IsMainThread(),
"Should only be deserializing on the main thread!"); "Should only be deserializing on the main thread!");
@ -1228,7 +1228,7 @@ IDBObjectStore::DeserializeValue(JSContext* aCx,
JSAutoStructuredCloneBuffer& buffer = aCloneReadInfo.mCloneBuffer; JSAutoStructuredCloneBuffer& buffer = aCloneReadInfo.mCloneBuffer;
if (!buffer.data()) { if (!buffer.data()) {
*aValue = JSVAL_VOID; aValue.setUndefined();
return true; return true;
} }
@ -1240,7 +1240,7 @@ IDBObjectStore::DeserializeValue(JSContext* aCx,
nullptr nullptr
}; };
return buffer.read(aCx, aValue, &callbacks, &aCloneReadInfo); return buffer.read(aCx, aValue.address(), &callbacks, &aCloneReadInfo);
} }
// static // static
@ -3128,18 +3128,13 @@ AddHelper::DoDatabaseWork(mozIStorageConnection* aConnection)
nsresult nsresult
AddHelper::GetSuccessResult(JSContext* aCx, AddHelper::GetSuccessResult(JSContext* aCx,
jsval* aVal) JS::MutableHandle<JS::Value> aVal)
{ {
NS_ASSERTION(!mKey.IsUnset(), "Badness!"); NS_ASSERTION(!mKey.IsUnset(), "Badness!");
mCloneWriteInfo.mCloneBuffer.clear(); mCloneWriteInfo.mCloneBuffer.clear();
JS::Rooted<JS::Value> value(aCx); return mKey.ToJSVal(aCx, aVal);
nsresult rv = mKey.ToJSVal(aCx, &value);
if (NS_SUCCEEDED(rv)) {
*aVal = value;
}
return rv;
} }
void void
@ -3296,7 +3291,7 @@ GetHelper::DoDatabaseWork(mozIStorageConnection* /* aConnection */)
nsresult nsresult
GetHelper::GetSuccessResult(JSContext* aCx, GetHelper::GetSuccessResult(JSContext* aCx,
jsval* aVal) JS::MutableHandle<JS::Value> aVal)
{ {
bool result = IDBObjectStore::DeserializeValue(aCx, mCloneReadInfo, aVal); bool result = IDBObjectStore::DeserializeValue(aCx, mCloneReadInfo, aVal);
@ -3447,9 +3442,9 @@ DeleteHelper::DoDatabaseWork(mozIStorageConnection* /*aConnection */)
nsresult nsresult
DeleteHelper::GetSuccessResult(JSContext* aCx, DeleteHelper::GetSuccessResult(JSContext* aCx,
jsval* aVal) JS::MutableHandle<JS::Value> aVal)
{ {
*aVal = JSVAL_VOID; aVal.setUndefined();
return NS_OK; return NS_OK;
} }
@ -3737,7 +3732,7 @@ OpenCursorHelper::EnsureCursor()
nsresult nsresult
OpenCursorHelper::GetSuccessResult(JSContext* aCx, OpenCursorHelper::GetSuccessResult(JSContext* aCx,
jsval* aVal) JS::MutableHandle<JS::Value> aVal)
{ {
nsresult rv = EnsureCursor(); nsresult rv = EnsureCursor();
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);
@ -3747,7 +3742,7 @@ OpenCursorHelper::GetSuccessResult(JSContext* aCx,
NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR); NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
} }
else { else {
*aVal = JSVAL_VOID; aVal.setUndefined();
} }
return NS_OK; return NS_OK;
@ -4208,7 +4203,7 @@ GetAllHelper::DoDatabaseWork(mozIStorageConnection* aConnection)
nsresult nsresult
GetAllHelper::GetSuccessResult(JSContext* aCx, GetAllHelper::GetSuccessResult(JSContext* aCx,
jsval* aVal) JS::MutableHandle<JS::Value> aVal)
{ {
NS_ASSERTION(mCloneReadInfos.Length() <= mLimit, "Too many results!"); NS_ASSERTION(mCloneReadInfos.Length() <= mLimit, "Too many results!");
@ -4431,9 +4426,9 @@ CountHelper::DoDatabaseWork(mozIStorageConnection* aConnection)
nsresult nsresult
CountHelper::GetSuccessResult(JSContext* aCx, CountHelper::GetSuccessResult(JSContext* aCx,
jsval* aVal) JS::MutableHandle<JS::Value> aVal)
{ {
*aVal = JS_NumberValue(static_cast<double>(mCount)); aVal.setNumber(static_cast<double>(mCount));
return NS_OK; return NS_OK;
} }

Просмотреть файл

@ -94,7 +94,7 @@ public:
static bool static bool
DeserializeValue(JSContext* aCx, DeserializeValue(JSContext* aCx,
StructuredCloneReadInfo& aCloneReadInfo, StructuredCloneReadInfo& aCloneReadInfo,
jsval* aValue); JS::MutableHandle<JS::Value> aValue);
static bool static bool
SerializeValue(JSContext* aCx, SerializeValue(JSContext* aCx,

Просмотреть файл

@ -120,7 +120,7 @@ IDBRequest::NotifyHelperCompleted(HelperBase* aHelper)
AssertIsRooted(); AssertIsRooted();
JS::Rooted<JS::Value> value(cx); JS::Rooted<JS::Value> value(cx);
rv = aHelper->GetSuccessResult(cx, value.address()); rv = aHelper->GetSuccessResult(cx, &value);
if (NS_FAILED(rv)) { if (NS_FAILED(rv)) {
NS_WARNING("GetSuccessResult failed!"); NS_WARNING("GetSuccessResult failed!");
} }

Просмотреть файл

@ -1444,7 +1444,7 @@ public:
NS_DECL_ISUPPORTS_INHERITED NS_DECL_ISUPPORTS_INHERITED
virtual nsresult GetSuccessResult(JSContext* aCx, virtual nsresult GetSuccessResult(JSContext* aCx,
jsval* aVal) MOZ_OVERRIDE; JS::MutableHandle<JS::Value> aVal) MOZ_OVERRIDE;
virtual nsresult virtual nsresult
OnExclusiveAccessAcquired() MOZ_OVERRIDE; OnExclusiveAccessAcquired() MOZ_OVERRIDE;
@ -1515,7 +1515,7 @@ public:
NS_DECL_ISUPPORTS_INHERITED NS_DECL_ISUPPORTS_INHERITED
nsresult GetSuccessResult(JSContext* aCx, nsresult GetSuccessResult(JSContext* aCx,
jsval* aVal); JS::MutableHandle<JS::Value> aVal);
void ReleaseMainThreadObjects() void ReleaseMainThreadObjects()
{ {
@ -2323,7 +2323,7 @@ OpenDatabaseHelper::EnsureSuccessResult()
nsresult nsresult
OpenDatabaseHelper::GetSuccessResult(JSContext* aCx, OpenDatabaseHelper::GetSuccessResult(JSContext* aCx,
jsval* aVal) JS::MutableHandle<JS::Value> aVal)
{ {
// Be careful not to load the database twice. // Be careful not to load the database twice.
if (!mDatabase) { if (!mDatabase) {
@ -2471,7 +2471,7 @@ SetVersionHelper::DoDatabaseWork(mozIStorageConnection* aConnection)
nsresult nsresult
SetVersionHelper::GetSuccessResult(JSContext* aCx, SetVersionHelper::GetSuccessResult(JSContext* aCx,
jsval* aVal) JS::MutableHandle<JS::Value> aVal)
{ {
DatabaseInfo* info = mDatabase->Info(); DatabaseInfo* info = mDatabase->Info();
info->version = mRequestedVersion; info->version = mRequestedVersion;
@ -2679,7 +2679,7 @@ DeleteDatabaseHelper::DoDatabaseWork(mozIStorageConnection* aConnection)
} }
nsresult nsresult
DeleteDatabaseHelper::GetSuccessResult(JSContext* aCx, jsval* aVal) DeleteDatabaseHelper::GetSuccessResult(JSContext* aCx, JS::MutableHandle<JS::Value> aVal)
{ {
return NS_OK; return NS_OK;
} }

Просмотреть файл

@ -105,7 +105,7 @@ protected:
nsresult StartSetVersion(); nsresult StartSetVersion();
nsresult StartDelete(); nsresult StartDelete();
virtual nsresult GetSuccessResult(JSContext* aCx, virtual nsresult GetSuccessResult(JSContext* aCx,
jsval* aVal) MOZ_OVERRIDE; JS::MutableHandle<JS::Value> aVal) MOZ_OVERRIDE;
void DispatchSuccessEvent(); void DispatchSuccessEvent();
void DispatchErrorEvent(); void DispatchErrorEvent();
virtual void ReleaseMainThreadObjects() MOZ_OVERRIDE; virtual void ReleaseMainThreadObjects() MOZ_OVERRIDE;

Просмотреть файл

@ -45,7 +45,7 @@ public:
SendResponseToChildProcess(nsresult aResultCode) MOZ_OVERRIDE; SendResponseToChildProcess(nsresult aResultCode) MOZ_OVERRIDE;
virtual nsresult virtual nsresult
GetSuccessResult(JSContext* aCx, jsval* aVal) MOZ_OVERRIDE; GetSuccessResult(JSContext* aCx, JS::MutableHandle<JS::Value> aVal) MOZ_OVERRIDE;
virtual nsresult virtual nsresult
OnSuccess() MOZ_OVERRIDE OnSuccess() MOZ_OVERRIDE
@ -96,7 +96,7 @@ public:
CreateSuccessEvent(mozilla::dom::EventTarget* aOwner) MOZ_OVERRIDE; CreateSuccessEvent(mozilla::dom::EventTarget* aOwner) MOZ_OVERRIDE;
virtual nsresult virtual nsresult
GetSuccessResult(JSContext* aCx, jsval* aVal) MOZ_OVERRIDE; GetSuccessResult(JSContext* aCx, JS::MutableHandle<JS::Value> aVal) MOZ_OVERRIDE;
}; };
class IPCDeleteDatabaseHelper : public AsyncConnectionHelper class IPCDeleteDatabaseHelper : public AsyncConnectionHelper
@ -114,7 +114,7 @@ public:
SendResponseToChildProcess(nsresult aResultCode) MOZ_OVERRIDE; SendResponseToChildProcess(nsresult aResultCode) MOZ_OVERRIDE;
virtual nsresult virtual nsresult
GetSuccessResult(JSContext* aCx, jsval* aVal) MOZ_OVERRIDE; GetSuccessResult(JSContext* aCx, JS::MutableHandle<JS::Value> aVal) MOZ_OVERRIDE;
virtual nsresult virtual nsresult
DoDatabaseWork(mozIStorageConnection* aConnection) MOZ_OVERRIDE; DoDatabaseWork(mozIStorageConnection* aConnection) MOZ_OVERRIDE;
@ -1294,7 +1294,7 @@ IPCOpenDatabaseHelper::DoDatabaseWork(mozIStorageConnection* aConnection)
} }
nsresult nsresult
IPCOpenDatabaseHelper::GetSuccessResult(JSContext* aCx, jsval* aVal) IPCOpenDatabaseHelper::GetSuccessResult(JSContext* aCx, JS::MutableHandle<JS::Value> aVal)
{ {
return WrapNative(aCx, NS_ISUPPORTS_CAST(EventTarget*, mDatabase), return WrapNative(aCx, NS_ISUPPORTS_CAST(EventTarget*, mDatabase),
aVal); aVal);
@ -1331,7 +1331,7 @@ IPCSetVersionHelper::CreateSuccessEvent(mozilla::dom::EventTarget* aOwner)
} }
nsresult nsresult
IPCSetVersionHelper::GetSuccessResult(JSContext* aCx, jsval* aVal) IPCSetVersionHelper::GetSuccessResult(JSContext* aCx, JS::MutableHandle<JS::Value> aVal)
{ {
mOpenRequest->SetTransaction(mTransaction); mOpenRequest->SetTransaction(mTransaction);
@ -1355,9 +1355,9 @@ IPCDeleteDatabaseHelper::SendResponseToChildProcess(nsresult aResultCode)
} }
nsresult nsresult
IPCDeleteDatabaseHelper::GetSuccessResult(JSContext* aCx, jsval* aVal) IPCDeleteDatabaseHelper::GetSuccessResult(JSContext* aCx, JS::MutableHandle<JS::Value> aVal)
{ {
*aVal = JSVAL_VOID; aVal.setUndefined();
return NS_OK; return NS_OK;
} }

Просмотреть файл

@ -109,28 +109,28 @@ NPClass nsJSObjWrapper::sJSObjWrapperNPClass =
}; };
static JSBool static JSBool
NPObjWrapper_AddProperty(JSContext *cx, JSHandleObject obj, JSHandleId id, JS::MutableHandle<JS::Value> vp); NPObjWrapper_AddProperty(JSContext *cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JS::MutableHandle<JS::Value> vp);
static JSBool static JSBool
NPObjWrapper_DelProperty(JSContext *cx, JSHandleObject obj, JSHandleId id, JSBool *succeeded); NPObjWrapper_DelProperty(JSContext *cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JSBool *succeeded);
static JSBool static JSBool
NPObjWrapper_SetProperty(JSContext *cx, JSHandleObject obj, JSHandleId id, JSBool strict, NPObjWrapper_SetProperty(JSContext *cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JSBool strict,
JS::MutableHandle<JS::Value> vp); JS::MutableHandle<JS::Value> vp);
static JSBool static JSBool
NPObjWrapper_GetProperty(JSContext *cx, JSHandleObject obj, JSHandleId id, JS::MutableHandle<JS::Value> vp); NPObjWrapper_GetProperty(JSContext *cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JS::MutableHandle<JS::Value> vp);
static JSBool static JSBool
NPObjWrapper_newEnumerate(JSContext *cx, JSHandleObject obj, JSIterateOp enum_op, NPObjWrapper_newEnumerate(JSContext *cx, JS::Handle<JSObject*> obj, JSIterateOp enum_op,
JS::Value *statep, jsid *idp); JS::Value *statep, jsid *idp);
static JSBool static JSBool
NPObjWrapper_NewResolve(JSContext *cx, JSHandleObject obj, JSHandleId id, unsigned flags, NPObjWrapper_NewResolve(JSContext *cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, unsigned flags,
JS::MutableHandle<JSObject*> objp); JS::MutableHandle<JSObject*> objp);
static JSBool static JSBool
NPObjWrapper_Convert(JSContext *cx, JSHandleObject obj, JSType type, JS::MutableHandle<JS::Value> vp); NPObjWrapper_Convert(JSContext *cx, JS::Handle<JSObject*> obj, JSType type, JS::MutableHandle<JS::Value> vp);
static void static void
NPObjWrapper_Finalize(JSFreeOp *fop, JSObject *obj); NPObjWrapper_Finalize(JSFreeOp *fop, JSObject *obj);
@ -171,7 +171,7 @@ typedef struct NPObjectMemberPrivate {
} NPObjectMemberPrivate; } NPObjectMemberPrivate;
static JSBool static JSBool
NPObjectMember_Convert(JSContext *cx, JSHandleObject obj, JSType type, JS::MutableHandle<JS::Value> vp); NPObjectMember_Convert(JSContext *cx, JS::Handle<JSObject*> obj, JSType type, JS::MutableHandle<JS::Value> vp);
static void static void
NPObjectMember_Finalize(JSFreeOp *fop, JSObject *obj); NPObjectMember_Finalize(JSFreeOp *fop, JSObject *obj);
@ -1108,7 +1108,7 @@ GetNPObject(JSContext *cx, JSObject *obj)
// Does not actually add a property because this is always followed by a // Does not actually add a property because this is always followed by a
// SetProperty call. // SetProperty call.
static JSBool static JSBool
NPObjWrapper_AddProperty(JSContext *cx, JSHandleObject obj, JSHandleId id, JS::MutableHandle<JS::Value> vp) NPObjWrapper_AddProperty(JSContext *cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JS::MutableHandle<JS::Value> vp)
{ {
NPObject *npobj = GetNPObject(cx, obj); NPObject *npobj = GetNPObject(cx, obj);
@ -1149,7 +1149,7 @@ NPObjWrapper_AddProperty(JSContext *cx, JSHandleObject obj, JSHandleId id, JS::M
} }
static JSBool static JSBool
NPObjWrapper_DelProperty(JSContext *cx, JSHandleObject obj, JSHandleId id, JSBool *succeeded) NPObjWrapper_DelProperty(JSContext *cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JSBool *succeeded)
{ {
NPObject *npobj = GetNPObject(cx, obj); NPObject *npobj = GetNPObject(cx, obj);
@ -1182,7 +1182,7 @@ NPObjWrapper_DelProperty(JSContext *cx, JSHandleObject obj, JSHandleId id, JSBoo
} }
static JSBool static JSBool
NPObjWrapper_SetProperty(JSContext *cx, JSHandleObject obj, JSHandleId id, JSBool strict, NPObjWrapper_SetProperty(JSContext *cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JSBool strict,
JS::MutableHandle<JS::Value> vp) JS::MutableHandle<JS::Value> vp)
{ {
NPObject *npobj = GetNPObject(cx, obj); NPObject *npobj = GetNPObject(cx, obj);
@ -1242,7 +1242,7 @@ NPObjWrapper_SetProperty(JSContext *cx, JSHandleObject obj, JSHandleId id, JSBoo
} }
static JSBool static JSBool
NPObjWrapper_GetProperty(JSContext *cx, JSHandleObject obj, JSHandleId id, JS::MutableHandle<JS::Value> vp) NPObjWrapper_GetProperty(JSContext *cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JS::MutableHandle<JS::Value> vp)
{ {
NPObject *npobj = GetNPObject(cx, obj); NPObject *npobj = GetNPObject(cx, obj);
@ -1472,7 +1472,7 @@ struct NPObjectEnumerateState {
}; };
static JSBool static JSBool
NPObjWrapper_newEnumerate(JSContext *cx, JSHandleObject obj, JSIterateOp enum_op, NPObjWrapper_newEnumerate(JSContext *cx, JS::Handle<JSObject*> obj, JSIterateOp enum_op,
JS::Value *statep, jsid *idp) JS::Value *statep, jsid *idp)
{ {
NPObject *npobj = GetNPObject(cx, obj); NPObject *npobj = GetNPObject(cx, obj);
@ -1552,7 +1552,7 @@ NPObjWrapper_newEnumerate(JSContext *cx, JSHandleObject obj, JSIterateOp enum_op
} }
static JSBool static JSBool
NPObjWrapper_NewResolve(JSContext *cx, JSHandleObject obj, JSHandleId id, unsigned flags, NPObjWrapper_NewResolve(JSContext *cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, unsigned flags,
JS::MutableHandle<JSObject*> objp) JS::MutableHandle<JSObject*> objp)
{ {
NPObject *npobj = GetNPObject(cx, obj); NPObject *npobj = GetNPObject(cx, obj);
@ -1606,7 +1606,7 @@ NPObjWrapper_NewResolve(JSContext *cx, JSHandleObject obj, JSHandleId id, unsign
} }
static JSBool static JSBool
NPObjWrapper_Convert(JSContext *cx, JSHandleObject obj, JSType hint, JS::MutableHandle<JS::Value> vp) NPObjWrapper_Convert(JSContext *cx, JS::Handle<JSObject*> obj, JSType hint, JS::MutableHandle<JS::Value> vp)
{ {
JS_ASSERT(hint == JSTYPE_NUMBER || hint == JSTYPE_STRING || hint == JSTYPE_VOID); JS_ASSERT(hint == JSTYPE_NUMBER || hint == JSTYPE_STRING || hint == JSTYPE_VOID);
@ -2026,7 +2026,7 @@ CreateNPObjectMember(NPP npp, JSContext *cx, JSObject *obj, NPObject* npobj,
} }
static JSBool static JSBool
NPObjectMember_Convert(JSContext *cx, JSHandleObject obj, JSType type, JS::MutableHandle<JS::Value> vp) NPObjectMember_Convert(JSContext *cx, JS::Handle<JSObject*> obj, JSType type, JS::MutableHandle<JS::Value> vp)
{ {
NPObjectMemberPrivate *memberPrivate = NPObjectMemberPrivate *memberPrivate =
(NPObjectMemberPrivate *)::JS_GetInstancePrivate(cx, obj, (NPObjectMemberPrivate *)::JS_GetInstancePrivate(cx, obj,

Просмотреть файл

@ -644,7 +644,7 @@ GetDocumentFromNPP(NPP npp)
static JSContext * static JSContext *
GetJSContextFromDoc(nsIDocument *doc) GetJSContextFromDoc(nsIDocument *doc)
{ {
nsIScriptGlobalObject *sgo = doc->GetScriptGlobalObject(); nsCOMPtr<nsIScriptGlobalObject> sgo = do_QueryInterface(doc->GetWindow());
NS_ENSURE_TRUE(sgo, nullptr); NS_ENSURE_TRUE(sgo, nullptr);
nsIScriptContext *scx = sgo->GetContext(); nsIScriptContext *scx = sgo->GetContext();

Просмотреть файл

@ -1618,7 +1618,8 @@ nsNPAPIPluginInstance::GetJSContext(JSContext* *outContext)
nsresult rv = mOwner->GetDocument(getter_AddRefs(document)); nsresult rv = mOwner->GetDocument(getter_AddRefs(document));
if (NS_SUCCEEDED(rv) && document) { if (NS_SUCCEEDED(rv) && document) {
nsIScriptGlobalObject *global = document->GetScriptGlobalObject(); nsCOMPtr<nsIScriptGlobalObject> global =
do_QueryInterface(document->GetWindow());
if (global) { if (global) {
nsIScriptContext *context = global->GetContext(); nsIScriptContext *context = global->GetContext();

Просмотреть файл

@ -220,7 +220,8 @@ private:
} }
static JSBool static JSBool
GetProperty(JSContext* aCx, JSHandleObject aObj, JSHandleId aIdval, JS::MutableHandle<JS::Value> aVp) GetProperty(JSContext* aCx, JS::Handle<JSObject*> aObj, JS::Handle<jsid> aIdval,
JS::MutableHandle<JS::Value> aVp)
{ {
JS_ASSERT(JSID_IS_INT(aIdval)); JS_ASSERT(JSID_IS_INT(aIdval));
@ -236,7 +237,8 @@ private:
} }
static JSBool static JSBool
GetConstant(JSContext* aCx, JSHandleObject aObj, JSHandleId idval, JS::MutableHandle<JS::Value> aVp) GetConstant(JSContext* aCx, JS::Handle<JSObject*> aObj, JS::Handle<jsid> idval,
JS::MutableHandle<JS::Value> aVp)
{ {
JS_ASSERT(JSID_IS_INT(idval)); JS_ASSERT(JSID_IS_INT(idval));
JS_ASSERT(JSID_TO_INT(idval) >= CAPTURING_PHASE && JS_ASSERT(JSID_TO_INT(idval) >= CAPTURING_PHASE &&
@ -505,7 +507,8 @@ private:
} }
static JSBool static JSBool
GetProperty(JSContext* aCx, JSHandleObject aObj, JSHandleId aIdval, JS::MutableHandle<JS::Value> aVp) GetProperty(JSContext* aCx, JS::Handle<JSObject*> aObj, JS::Handle<jsid> aIdval,
JS::MutableHandle<JS::Value> aVp)
{ {
JS_ASSERT(JSID_IS_INT(aIdval)); JS_ASSERT(JSID_IS_INT(aIdval));
@ -712,7 +715,8 @@ private:
} }
static JSBool static JSBool
GetProperty(JSContext* aCx, JSHandleObject aObj, JSHandleId aIdval, JS::MutableHandle<JS::Value> aVp) GetProperty(JSContext* aCx, JS::Handle<JSObject*> aObj, JS::Handle<jsid> aIdval,
JS::MutableHandle<JS::Value> aVp)
{ {
JS_ASSERT(JSID_IS_INT(aIdval)); JS_ASSERT(JSID_IS_INT(aIdval));
@ -891,7 +895,8 @@ private:
} }
static JSBool static JSBool
GetProperty(JSContext* aCx, JSHandleObject aObj, JSHandleId aIdval, JS::MutableHandle<JS::Value> aVp) GetProperty(JSContext* aCx, JS::Handle<JSObject*> aObj, JS::Handle<jsid> aIdval,
JS::MutableHandle<JS::Value> aVp)
{ {
JS_ASSERT(JSID_IS_INT(aIdval)); JS_ASSERT(JSID_IS_INT(aIdval));

Просмотреть файл

@ -126,7 +126,8 @@ private:
} }
static JSBool static JSBool
GetProperty(JSContext* aCx, JSHandleObject aObj, JSHandleId aIdval, JS::MutableHandle<JS::Value> aVp) GetProperty(JSContext* aCx, JS::Handle<JSObject*> aObj, JS::Handle<jsid> aIdval,
JS::MutableHandle<JS::Value> aVp)
{ {
JS_ASSERT(JSID_IS_INT(aIdval)); JS_ASSERT(JSID_IS_INT(aIdval));
@ -146,7 +147,8 @@ private:
} }
static JSBool static JSBool
GetConstant(JSContext* aCx, JSHandleObject aObj, JSHandleId idval, JS::MutableHandle<JS::Value> aVp) GetConstant(JSContext* aCx, JS::Handle<JSObject*> aObj, JS::Handle<jsid> idval,
JS::MutableHandle<JS::Value> aVp)
{ {
JS_ASSERT(JSID_IS_INT(idval)); JS_ASSERT(JSID_IS_INT(idval));
aVp.set(INT_TO_JSVAL(JSID_TO_INT(idval))); aVp.set(INT_TO_JSVAL(JSID_TO_INT(idval)));

Просмотреть файл

@ -113,7 +113,8 @@ private:
} }
static JSBool static JSBool
GetSize(JSContext* aCx, JSHandleObject aObj, JSHandleId aIdval, JS::MutableHandle<JS::Value> aVp) GetSize(JSContext* aCx, JS::Handle<JSObject*> aObj, JS::Handle<jsid> aIdval,
JS::MutableHandle<JS::Value> aVp)
{ {
nsIDOMBlob* blob = GetInstancePrivate(aCx, aObj, "size"); nsIDOMBlob* blob = GetInstancePrivate(aCx, aObj, "size");
if (!blob) { if (!blob) {
@ -132,7 +133,8 @@ private:
} }
static JSBool static JSBool
GetType(JSContext* aCx, JSHandleObject aObj, JSHandleId aIdval, JS::MutableHandle<JS::Value> aVp) GetType(JSContext* aCx, JS::Handle<JSObject*> aObj, JS::Handle<jsid> aIdval,
JS::MutableHandle<JS::Value> aVp)
{ {
nsIDOMBlob* blob = GetInstancePrivate(aCx, aObj, "type"); nsIDOMBlob* blob = GetInstancePrivate(aCx, aObj, "type");
if (!blob) { if (!blob) {
@ -302,7 +304,8 @@ private:
} }
static JSBool static JSBool
GetMozFullPath(JSContext* aCx, JSHandleObject aObj, JSHandleId aIdval, JS::MutableHandle<JS::Value> aVp) GetMozFullPath(JSContext* aCx, JS::Handle<JSObject*> aObj, JS::Handle<jsid> aIdval,
JS::MutableHandle<JS::Value> aVp)
{ {
nsIDOMFile* file = GetInstancePrivate(aCx, aObj, "mozFullPath"); nsIDOMFile* file = GetInstancePrivate(aCx, aObj, "mozFullPath");
if (!file) { if (!file) {
@ -328,7 +331,8 @@ private:
} }
static JSBool static JSBool
GetName(JSContext* aCx, JSHandleObject aObj, JSHandleId aIdval, JS::MutableHandle<JS::Value> aVp) GetName(JSContext* aCx, JS::Handle<JSObject*> aObj, JS::Handle<jsid> aIdval,
JS::MutableHandle<JS::Value> aVp)
{ {
nsIDOMFile* file = GetInstancePrivate(aCx, aObj, "name"); nsIDOMFile* file = GetInstancePrivate(aCx, aObj, "name");
if (!file) { if (!file) {
@ -350,7 +354,8 @@ private:
} }
static JSBool static JSBool
GetLastModifiedDate(JSContext* aCx, JSHandleObject aObj, JSHandleId aIdval, JS::MutableHandle<JS::Value> aVp) GetLastModifiedDate(JSContext* aCx, JS::Handle<JSObject*> aObj, JS::Handle<jsid> aIdval,
JS::MutableHandle<JS::Value> aVp)
{ {
nsIDOMFile* file = GetInstancePrivate(aCx, aObj, "lastModifiedDate"); nsIDOMFile* file = GetInstancePrivate(aCx, aObj, "lastModifiedDate");
if (!file) { if (!file) {

Просмотреть файл

@ -115,7 +115,8 @@ private:
} }
static JSBool static JSBool
GetProperty(JSContext* aCx, JSHandleObject aObj, JSHandleId aIdval, JS::MutableHandle<JS::Value> aVp) GetProperty(JSContext* aCx, JS::Handle<JSObject*> aObj, JS::Handle<jsid> aIdval,
JS::MutableHandle<JS::Value> aVp)
{ {
JSClass* classPtr = JS_GetClass(aObj); JSClass* classPtr = JS_GetClass(aObj);
if (classPtr != &sClass) { if (classPtr != &sClass) {

Просмотреть файл

@ -129,7 +129,8 @@ private:
} }
static JSBool static JSBool
GetProperty(JSContext* aCx, JSHandleObject aObj, JSHandleId aIdval, JS::MutableHandle<JS::Value> aVp) GetProperty(JSContext* aCx, JS::Handle<JSObject*> aObj, JS::Handle<jsid> aIdval,
JS::MutableHandle<JS::Value> aVp)
{ {
JSClass* classPtr = JS_GetClass(aObj); JSClass* classPtr = JS_GetClass(aObj);
if (classPtr != &sClass) { if (classPtr != &sClass) {

Просмотреть файл

@ -117,7 +117,8 @@ private:
} }
static JSBool static JSBool
GetProperty(JSContext* aCx, JSHandleObject aObj, JSHandleId aIdval, JS::MutableHandle<JS::Value> aVp) GetProperty(JSContext* aCx, JS::Handle<JSObject*> aObj, JS::Handle<jsid> aIdval,
JS::MutableHandle<JS::Value> aVp)
{ {
JSClass* classPtr = JS_GetClass(aObj); JSClass* classPtr = JS_GetClass(aObj);
if (classPtr != &sClass) { if (classPtr != &sClass) {

Просмотреть файл

@ -912,8 +912,8 @@ BEGIN_WORKERS_NAMESPACE
// Entry point for the DOM. // Entry point for the DOM.
JSBool JSBool
ResolveWorkerClasses(JSContext* aCx, JSHandleObject aObj, JSHandleId aId, unsigned aFlags, ResolveWorkerClasses(JSContext* aCx, JS::Handle<JSObject*> aObj, JS::Handle<jsid> aId,
JS::MutableHandle<JSObject*> aObjp) unsigned aFlags, JS::MutableHandle<JSObject*> aObjp)
{ {
AssertIsOnMainThread(); AssertIsOnMainThread();

Просмотреть файл

@ -175,7 +175,8 @@ private:
~Worker(); ~Worker();
static JSBool static JSBool
GetEventListener(JSContext* aCx, JSHandleObject aObj, JSHandleId aIdval, JS::MutableHandle<JS::Value> aVp) GetEventListener(JSContext* aCx, JS::Handle<JSObject*> aObj, JS::Handle<jsid> aIdval,
JS::MutableHandle<JS::Value> aVp)
{ {
JS_ASSERT(JSID_IS_INT(aIdval)); JS_ASSERT(JSID_IS_INT(aIdval));
JS_ASSERT(JSID_TO_INT(aIdval) >= 0 && JSID_TO_INT(aIdval) < STRING_COUNT); JS_ASSERT(JSID_TO_INT(aIdval) >= 0 && JSID_TO_INT(aIdval) < STRING_COUNT);
@ -199,8 +200,8 @@ private:
} }
static JSBool static JSBool
SetEventListener(JSContext* aCx, JSHandleObject aObj, JSHandleId aIdval, JSBool aStrict, SetEventListener(JSContext* aCx, JS::Handle<JSObject*> aObj, JS::Handle<jsid> aIdval,
JS::MutableHandle<JS::Value> aVp) JSBool aStrict, JS::MutableHandle<JS::Value> aVp)
{ {
JS_ASSERT(JSID_IS_INT(aIdval)); JS_ASSERT(JSID_IS_INT(aIdval));
JS_ASSERT(JSID_TO_INT(aIdval) >= 0 && JSID_TO_INT(aIdval) < STRING_COUNT); JS_ASSERT(JSID_TO_INT(aIdval) >= 0 && JSID_TO_INT(aIdval) < STRING_COUNT);

Просмотреть файл

@ -142,7 +142,8 @@ protected:
private: private:
static JSBool static JSBool
GetEventListener(JSContext* aCx, JSHandleObject aObj, JSHandleId aIdval, JS::MutableHandle<JS::Value> aVp) GetEventListener(JSContext* aCx, JS::Handle<JSObject*> aObj, JS::Handle<jsid> aIdval,
JS::MutableHandle<JS::Value> aVp)
{ {
JS_ASSERT(JSID_IS_INT(aIdval)); JS_ASSERT(JSID_IS_INT(aIdval));
JS_ASSERT(JSID_TO_INT(aIdval) >= 0 && JSID_TO_INT(aIdval) < STRING_COUNT); JS_ASSERT(JSID_TO_INT(aIdval) >= 0 && JSID_TO_INT(aIdval) < STRING_COUNT);
@ -168,8 +169,8 @@ private:
} }
static JSBool static JSBool
SetEventListener(JSContext* aCx, JSHandleObject aObj, JSHandleId aIdval, JSBool aStrict, SetEventListener(JSContext* aCx, JS::Handle<JSObject*> aObj, JS::Handle<jsid> aIdval,
JS::MutableHandle<JS::Value> aVp) JSBool aStrict, JS::MutableHandle<JS::Value> aVp)
{ {
JS_ASSERT(JSID_IS_INT(aIdval)); JS_ASSERT(JSID_IS_INT(aIdval));
JS_ASSERT(JSID_TO_INT(aIdval) >= 0 && JSID_TO_INT(aIdval) < STRING_COUNT); JS_ASSERT(JSID_TO_INT(aIdval) >= 0 && JSID_TO_INT(aIdval) < STRING_COUNT);
@ -209,7 +210,8 @@ private:
} }
static JSBool static JSBool
GetSelf(JSContext* aCx, JSHandleObject aObj, JSHandleId aIdval, JS::MutableHandle<JS::Value> aVp) GetSelf(JSContext* aCx, JS::Handle<JSObject*> aObj, JS::Handle<jsid> aIdval,
JS::MutableHandle<JS::Value> aVp)
{ {
if (!GetInstancePrivate(aCx, aObj, "self")) { if (!GetInstancePrivate(aCx, aObj, "self")) {
return false; return false;
@ -220,7 +222,8 @@ private:
} }
static JSBool static JSBool
GetLocation(JSContext* aCx, JSHandleObject aObj, JSHandleId aIdval, JS::MutableHandle<JS::Value> aVp) GetLocation(JSContext* aCx, JS::Handle<JSObject*> aObj, JS::Handle<jsid> aIdval,
JS::MutableHandle<JS::Value> aVp)
{ {
WorkerGlobalScope* scope = WorkerGlobalScope* scope =
GetInstancePrivate(aCx, aObj, sProperties[SLOT_location].name); GetInstancePrivate(aCx, aObj, sProperties[SLOT_location].name);
@ -309,7 +312,8 @@ private:
} }
static JSBool static JSBool
GetOnErrorListener(JSContext* aCx, JSHandleObject aObj, JSHandleId aIdval, JS::MutableHandle<JS::Value> aVp) GetOnErrorListener(JSContext* aCx, JS::Handle<JSObject*> aObj, JS::Handle<jsid> aIdval,
JS::MutableHandle<JS::Value> aVp)
{ {
const char* name = sEventStrings[STRING_onerror]; const char* name = sEventStrings[STRING_onerror];
WorkerGlobalScope* scope = GetInstancePrivate(aCx, aObj, name); WorkerGlobalScope* scope = GetInstancePrivate(aCx, aObj, name);
@ -340,7 +344,7 @@ private:
} }
static JSBool static JSBool
SetOnErrorListener(JSContext* aCx, JSHandleObject aObj, JSHandleId aIdval, SetOnErrorListener(JSContext* aCx, JS::Handle<JSObject*> aObj, JS::Handle<jsid> aIdval,
JSBool aStrict, JS::MutableHandle<JS::Value> aVp) JSBool aStrict, JS::MutableHandle<JS::Value> aVp)
{ {
const char* name = sEventStrings[STRING_onerror]; const char* name = sEventStrings[STRING_onerror];
@ -383,7 +387,8 @@ private:
} }
static JSBool static JSBool
GetNavigator(JSContext* aCx, JSHandleObject aObj, JSHandleId aIdval, JS::MutableHandle<JS::Value> aVp) GetNavigator(JSContext* aCx, JS::Handle<JSObject*> aObj, JS::Handle<jsid> aIdval,
JS::MutableHandle<JS::Value> aVp)
{ {
WorkerGlobalScope* scope = WorkerGlobalScope* scope =
GetInstancePrivate(aCx, aObj, sProperties[SLOT_navigator].name); GetInstancePrivate(aCx, aObj, sProperties[SLOT_navigator].name);
@ -732,7 +737,8 @@ private:
using EventTarget::SetEventListener; using EventTarget::SetEventListener;
static JSBool static JSBool
GetEventListener(JSContext* aCx, JSHandleObject aObj, JSHandleId aIdval, JS::MutableHandle<JS::Value> aVp) GetEventListener(JSContext* aCx, JS::Handle<JSObject*> aObj, JS::Handle<jsid> aIdval,
JS::MutableHandle<JS::Value> aVp)
{ {
JS_ASSERT(JSID_IS_INT(aIdval)); JS_ASSERT(JSID_IS_INT(aIdval));
JS_ASSERT(JSID_TO_INT(aIdval) >= 0 && JSID_TO_INT(aIdval) < STRING_COUNT); JS_ASSERT(JSID_TO_INT(aIdval) >= 0 && JSID_TO_INT(aIdval) < STRING_COUNT);
@ -758,8 +764,8 @@ private:
} }
static JSBool static JSBool
SetEventListener(JSContext* aCx, JSHandleObject aObj, JSHandleId aIdval, JSBool aStrict, SetEventListener(JSContext* aCx, JS::Handle<JSObject*> aObj, JS::Handle<jsid> aIdval,
JS::MutableHandle<JS::Value> aVp) JSBool aStrict, JS::MutableHandle<JS::Value> aVp)
{ {
JS_ASSERT(JSID_IS_INT(aIdval)); JS_ASSERT(JSID_IS_INT(aIdval));
JS_ASSERT(JSID_TO_INT(aIdval) >= 0 && JSID_TO_INT(aIdval) < STRING_COUNT); JS_ASSERT(JSID_TO_INT(aIdval) >= 0 && JSID_TO_INT(aIdval) < STRING_COUNT);
@ -812,7 +818,7 @@ private:
} }
static JSBool static JSBool
Resolve(JSContext* aCx, JS::HandleObject aObj, JS::HandleId aId, unsigned aFlags, Resolve(JSContext* aCx, JS::Handle<JSObject*> aObj, JS::Handle<jsid> aId, unsigned aFlags,
JS::MutableHandle<JSObject*> aObjp) JS::MutableHandle<JSObject*> aObjp)
{ {
JSBool resolved; JSBool resolved;

Просмотреть файл

@ -165,7 +165,7 @@ struct JSSettings
// All of these are implemented in RuntimeService.cpp // All of these are implemented in RuntimeService.cpp
JSBool JSBool
ResolveWorkerClasses(JSContext* aCx, JSHandleObject aObj, JSHandleId aId, ResolveWorkerClasses(JSContext* aCx, JS::Handle<JSObject*> aObj, JS::Handle<jsid> aId,
unsigned aFlags, JS::MutableHandle<JSObject*> aObjp); unsigned aFlags, JS::MutableHandle<JSObject*> aObjp);
void void

Просмотреть файл

@ -387,7 +387,7 @@ jsval_to_nsString(JSContext* cx, jsid from, nsString* to)
} }
/*static*/ JSBool /*static*/ JSBool
ObjectWrapperParent::CPOW_AddProperty(JSContext *cx, JSHandleObject obj, JSHandleId id, ObjectWrapperParent::CPOW_AddProperty(JSContext *cx, HandleObject obj, HandleId id,
MutableHandleValue vp) MutableHandleValue vp)
{ {
CPOW_LOG(("Calling CPOW_AddProperty (%s)...", CPOW_LOG(("Calling CPOW_AddProperty (%s)...",
@ -414,7 +414,7 @@ ObjectWrapperParent::CPOW_AddProperty(JSContext *cx, JSHandleObject obj, JSHandl
} }
/*static*/ JSBool /*static*/ JSBool
ObjectWrapperParent::CPOW_GetProperty(JSContext *cx, JSHandleObject obj, JSHandleId id, ObjectWrapperParent::CPOW_GetProperty(JSContext *cx, HandleObject obj, HandleId id,
MutableHandleValue vp) MutableHandleValue vp)
{ {
CPOW_LOG(("Calling CPOW_GetProperty (%s)...", CPOW_LOG(("Calling CPOW_GetProperty (%s)...",
@ -441,7 +441,7 @@ ObjectWrapperParent::CPOW_GetProperty(JSContext *cx, JSHandleObject obj, JSHandl
} }
/*static*/ JSBool /*static*/ JSBool
ObjectWrapperParent::CPOW_SetProperty(JSContext *cx, JSHandleObject obj, JSHandleId id, ObjectWrapperParent::CPOW_SetProperty(JSContext *cx, HandleObject obj, HandleId id,
JSBool strict, MutableHandleValue vp) JSBool strict, MutableHandleValue vp)
{ {
CPOW_LOG(("Calling CPOW_SetProperty (%s)...", CPOW_LOG(("Calling CPOW_SetProperty (%s)...",
@ -470,7 +470,7 @@ ObjectWrapperParent::CPOW_SetProperty(JSContext *cx, JSHandleObject obj, JSHandl
} }
/*static*/ JSBool /*static*/ JSBool
ObjectWrapperParent::CPOW_DelProperty(JSContext *cx, JSHandleObject obj, JSHandleId id, ObjectWrapperParent::CPOW_DelProperty(JSContext *cx, HandleObject obj, HandleId id,
JSBool *succeeded) JSBool *succeeded)
{ {
CPOW_LOG(("Calling CPOW_DelProperty (%s)...", CPOW_LOG(("Calling CPOW_DelProperty (%s)...",
@ -551,7 +551,7 @@ ObjectWrapperParent::NewEnumerateDestroy(JSContext* cx, jsval state)
} }
/*static*/ JSBool /*static*/ JSBool
ObjectWrapperParent::CPOW_NewEnumerate(JSContext *cx, JSHandleObject obj, ObjectWrapperParent::CPOW_NewEnumerate(JSContext *cx, HandleObject obj,
JSIterateOp enum_op, jsval *statep, JSIterateOp enum_op, jsval *statep,
jsid *idp) jsid *idp)
{ {
@ -577,7 +577,7 @@ ObjectWrapperParent::CPOW_NewEnumerate(JSContext *cx, JSHandleObject obj,
} }
/*static*/ JSBool /*static*/ JSBool
ObjectWrapperParent::CPOW_NewResolve(JSContext *cx, JSHandleObject obj, JSHandleId id, ObjectWrapperParent::CPOW_NewResolve(JSContext *cx, HandleObject obj, HandleId id,
unsigned flags, MutableHandleObject objp) unsigned flags, MutableHandleObject objp)
{ {
CPOW_LOG(("Calling CPOW_NewResolve (%s)...", CPOW_LOG(("Calling CPOW_NewResolve (%s)...",
@ -613,7 +613,7 @@ ObjectWrapperParent::CPOW_NewResolve(JSContext *cx, JSHandleObject obj, JSHandle
} }
/*static*/ JSBool /*static*/ JSBool
ObjectWrapperParent::CPOW_Convert(JSContext *cx, JSHandleObject obj, JSType type, ObjectWrapperParent::CPOW_Convert(JSContext *cx, HandleObject obj, JSType type,
MutableHandleValue vp) MutableHandleValue vp)
{ {
CPOW_LOG(("Calling CPOW_Convert (to %s)...", CPOW_LOG(("Calling CPOW_Convert (to %s)...",
@ -708,7 +708,7 @@ ObjectWrapperParent::CPOW_Construct(JSContext* cx, unsigned argc, jsval* vp)
} }
/*static*/ JSBool /*static*/ JSBool
ObjectWrapperParent::CPOW_HasInstance(JSContext *cx, JSHandleObject obj, MutableHandleValue v, ObjectWrapperParent::CPOW_HasInstance(JSContext *cx, HandleObject obj, MutableHandleValue v,
JSBool *bp) JSBool *bp)
{ {
CPOW_LOG(("Calling CPOW_HasInstance...")); CPOW_LOG(("Calling CPOW_HasInstance..."));

Просмотреть файл

@ -59,30 +59,33 @@ private:
mutable JSObject* mObj; mutable JSObject* mObj;
static JSBool static JSBool
CPOW_AddProperty(JSContext *cx, JSHandleObject obj, JSHandleId id, JS::MutableHandleValue vp); CPOW_AddProperty(JSContext *cx, JS::HandleObject obj, JS::HandleId id,
JS::MutableHandleValue vp);
static JSBool static JSBool
CPOW_DelProperty(JSContext *cx, JSHandleObject obj, JSHandleId id, JSBool *succeeded); CPOW_DelProperty(JSContext *cx, JS::HandleObject obj, JS::HandleId id, JSBool *succeeded);
static JSBool static JSBool
CPOW_GetProperty(JSContext *cx, JSHandleObject obj, JSHandleId id, JS::MutableHandleValue vp); CPOW_GetProperty(JSContext *cx, JS::HandleObject obj, JS::HandleId id,
JS::MutableHandleValue vp);
static JSBool static JSBool
CPOW_SetProperty(JSContext *cx, JSHandleObject obj, JSHandleId id, JSBool strict, JS::MutableHandleValue vp); CPOW_SetProperty(JSContext *cx, JS::HandleObject obj, JS::HandleId id, JSBool strict,
JS::MutableHandleValue vp);
JSBool NewEnumerateInit(JSContext* cx, jsval* statep, jsid* idp); JSBool NewEnumerateInit(JSContext* cx, jsval* statep, jsid* idp);
JSBool NewEnumerateNext(JSContext* cx, jsval* statep, jsid* idp); JSBool NewEnumerateNext(JSContext* cx, jsval* statep, jsid* idp);
JSBool NewEnumerateDestroy(JSContext* cx, jsval state); JSBool NewEnumerateDestroy(JSContext* cx, jsval state);
static JSBool static JSBool
CPOW_NewEnumerate(JSContext *cx, JSHandleObject obj, JSIterateOp enum_op, CPOW_NewEnumerate(JSContext *cx, JS::HandleObject obj, JSIterateOp enum_op,
jsval *statep, jsid *idp); jsval *statep, jsid *idp);
static JSBool static JSBool
CPOW_NewResolve(JSContext *cx, JSHandleObject obj, JSHandleId id, unsigned flags, CPOW_NewResolve(JSContext *cx, JS::HandleObject obj, JS::HandleId id, unsigned flags,
JS::MutableHandleObject objp); JS::MutableHandleObject objp);
static JSBool static JSBool
CPOW_Convert(JSContext *cx, JSHandleObject obj, JSType type, JS::MutableHandleValue vp); CPOW_Convert(JSContext *cx, JS::HandleObject obj, JSType type, JS::MutableHandleValue vp);
static void static void
CPOW_Finalize(js::FreeOp* fop, JSObject* obj); CPOW_Finalize(js::FreeOp* fop, JSObject* obj);
@ -94,7 +97,7 @@ private:
CPOW_Construct(JSContext *cx, unsigned argc, jsval *vp); CPOW_Construct(JSContext *cx, unsigned argc, jsval *vp);
static JSBool static JSBool
CPOW_HasInstance(JSContext *cx, JSHandleObject obj, JS::MutableHandleValue vp, JSBool *bp); CPOW_HasInstance(JSContext *cx, JS::HandleObject obj, JS::MutableHandleValue vp, JSBool *bp);
static bool jsval_to_JSVariant(JSContext* cx, jsval from, JSVariant* to); static bool jsval_to_JSVariant(JSContext* cx, jsval from, JSVariant* to);
static bool jsval_from_JSVariant(JSContext* cx, const JSVariant& from, static bool jsval_from_JSVariant(JSContext* cx, const JSVariant& from,
@ -102,7 +105,8 @@ private:
static bool boolean_from_JSVariant(JSContext* cx, const JSVariant& from, static bool boolean_from_JSVariant(JSContext* cx, const JSVariant& from,
JSBool* to); JSBool* to);
static bool static bool
JSObject_to_PObjectWrapperParent(JSContext* cx, JSObject* from, PObjectWrapperParent** to); JSObject_to_PObjectWrapperParent(JSContext* cx, JSObject* from,
PObjectWrapperParent** to);
static bool static bool
JSObject_from_PObjectWrapperParent(JSContext* cx, JSObject_from_PObjectWrapperParent(JSContext* cx,
const PObjectWrapperParent* from, const PObjectWrapperParent* from,

Просмотреть файл

@ -135,7 +135,7 @@ struct RuntimeSizes
size_t dtoa; size_t dtoa;
size_t temporary; size_t temporary;
size_t regexpData; size_t regexpData;
size_t stack; size_t interpreterStack;
size_t gcMarker; size_t gcMarker;
size_t mathCache; size_t mathCache;
size_t scriptData; size_t scriptData;

Просмотреть файл

@ -170,9 +170,21 @@ struct JS_PUBLIC_API(NullPtr)
}; };
/* /*
* Encapsulated pointer class for use on the heap. * An encapsulated pointer class for heap based GC thing pointers.
* *
* Implements post barriers for heap-based GC thing pointers outside the engine. * This implements post-barriers for GC thing pointers stored on the heap. It is
* designed to be used for all heap-based GC thing pointers outside the JS
* engine.
*
* The template parameter T must be a JS GC thing pointer, masked pointer or
* possible pointer, such as a JS::Value or jsid.
*
* The class must be used to declare data members of heap classes only.
* Stack-based GC thing pointers should used Rooted<T>.
*
* Write barriers are implemented by overloading the assingment operator.
* Assiging to a Heap<T> triggers the appropriate calls into the GC to notify it
* of the change.
*/ */
template <typename T> template <typename T>
class Heap : public js::HeapBase<T> class Heap : public js::HeapBase<T>

Просмотреть файл

@ -405,7 +405,7 @@ static inline bool
WarnOnTooManyArgs(JSContext *cx, const CallArgs &args) WarnOnTooManyArgs(JSContext *cx, const CallArgs &args)
{ {
if (args.length() > 1) { if (args.length() > 1) {
Rooted<JSScript*> script(cx, cx->stack.currentScript()); Rooted<JSScript*> script(cx, cx->currentScript());
if (script && !script->warnedAboutTwoArgumentEval) { if (script && !script->warnedAboutTwoArgumentEval) {
static const char TWO_ARGUMENT_WARNING[] = static const char TWO_ARGUMENT_WARNING[] =
"Support for eval(code, scopeObject) has been removed. " "Support for eval(code, scopeObject) has been removed. "

Просмотреть файл

@ -443,8 +443,8 @@ IntlInitialize(JSContext *cx, HandleObject obj, Handle<PropertyName*> initialize
JS_ASSERT(initializerValue.isObject()); JS_ASSERT(initializerValue.isObject());
JS_ASSERT(initializerValue.toObject().is<JSFunction>()); JS_ASSERT(initializerValue.toObject().is<JSFunction>());
InvokeArgsGuard args; InvokeArgs args(cx);
if (!cx->stack.pushInvokeArgs(cx, 3, &args)) if (!args.init(3))
return false; return false;
args.setCallee(initializerValue); args.setCallee(initializerValue);
@ -509,8 +509,8 @@ GetInternals(JSContext *cx, HandleObject obj, MutableHandleObject internals)
JS_ASSERT(getInternalsValue.isObject()); JS_ASSERT(getInternalsValue.isObject());
JS_ASSERT(getInternalsValue.toObject().is<JSFunction>()); JS_ASSERT(getInternalsValue.toObject().is<JSFunction>());
InvokeArgsGuard args; InvokeArgs args(cx);
if (!cx->stack.pushInvokeArgs(cx, 1, &args)) if (!args.init(1))
return false; return false;
args.setCallee(getInternalsValue); args.setCallee(getInternalsValue);

Просмотреть файл

@ -530,14 +530,14 @@ obj_getPrototypeOf(JSContext *cx, unsigned argc, Value *vp)
* Implement [[Prototype]]-getting -- particularly across compartment * Implement [[Prototype]]-getting -- particularly across compartment
* boundaries -- by calling a cached __proto__ getter function. * boundaries -- by calling a cached __proto__ getter function.
*/ */
InvokeArgsGuard nested; InvokeArgs args2(cx);
if (!cx->stack.pushInvokeArgs(cx, 0, &nested)) if (!args2.init(0))
return false; return false;
nested.setCallee(cx->global()->protoGetter()); args2.setCallee(cx->global()->protoGetter());
nested.setThis(args[0]); args2.setThis(args[0]);
if (!Invoke(cx, nested)) if (!Invoke(cx, args2))
return false; return false;
args.rval().set(nested.rval()); args.rval().set(args2.rval());
return true; return true;
} }

Просмотреть файл

@ -133,7 +133,7 @@ ParallelArrayObject::constructHelper(JSContext *cx, MutableHandleFunction ctor,
if (cx->typeInferenceEnabled()) { if (cx->typeInferenceEnabled()) {
jsbytecode *pc; jsbytecode *pc;
RootedScript script(cx, cx->stack.currentScript(&pc)); RootedScript script(cx, cx->currentScript(&pc));
if (script) { if (script) {
if (ctor->nonLazyScript()->shouldCloneAtCallsite) { if (ctor->nonLazyScript()->shouldCloneAtCallsite) {
ctor.set(CloneFunctionAtCallsite(cx, ctor, script, pc)); ctor.set(CloneFunctionAtCallsite(cx, ctor, script, pc));
@ -163,8 +163,8 @@ ParallelArrayObject::constructHelper(JSContext *cx, MutableHandleFunction ctor,
} }
} }
InvokeArgsGuard args; InvokeArgs args(cx);
if (!cx->stack.pushInvokeArgs(cx, args0.length(), &args)) if (!args.init(args0.length()))
return false; return false;
args.setCallee(ObjectValue(*ctor)); args.setCallee(ObjectValue(*ctor));

Просмотреть файл

@ -12,7 +12,7 @@
namespace js { namespace js {
bool bool
DefineTestingFunctions(JSContext *cx, JSHandleObject obj); DefineTestingFunctions(JSContext *cx, HandleObject obj);
JSBool JSBool
testingFunc_inParallelSection(JSContext *cx, unsigned argc, jsval *vp); testingFunc_inParallelSection(JSContext *cx, unsigned argc, jsval *vp);

Просмотреть файл

@ -158,23 +158,23 @@ static JSBool ConstructAbstract(JSContext* cx, unsigned argc, jsval* vp);
namespace CType { namespace CType {
static JSBool ConstructData(JSContext* cx, unsigned argc, jsval* vp); static JSBool ConstructData(JSContext* cx, unsigned argc, jsval* vp);
static JSBool ConstructBasic(JSContext* cx, JSHandleObject obj, const CallArgs& args); static JSBool ConstructBasic(JSContext* cx, HandleObject obj, const CallArgs& args);
static void Trace(JSTracer* trc, JSObject* obj); static void Trace(JSTracer* trc, JSObject* obj);
static void Finalize(JSFreeOp *fop, JSObject* obj); static void Finalize(JSFreeOp *fop, JSObject* obj);
static void FinalizeProtoClass(JSFreeOp *fop, JSObject* obj); static void FinalizeProtoClass(JSFreeOp *fop, JSObject* obj);
static JSBool PrototypeGetter(JSContext* cx, JSHandleObject obj, JSHandleId idval, static JSBool PrototypeGetter(JSContext* cx, HandleObject obj, HandleId idval,
MutableHandleValue vp); MutableHandleValue vp);
static JSBool NameGetter(JSContext* cx, JSHandleObject obj, JSHandleId idval, static JSBool NameGetter(JSContext* cx, HandleObject obj, HandleId idval,
MutableHandleValue vp); MutableHandleValue vp);
static JSBool SizeGetter(JSContext* cx, JSHandleObject obj, JSHandleId idval, static JSBool SizeGetter(JSContext* cx, HandleObject obj, HandleId idval,
MutableHandleValue vp); MutableHandleValue vp);
static JSBool PtrGetter(JSContext* cx, JSHandleObject obj, JSHandleId idval, MutableHandleValue vp); static JSBool PtrGetter(JSContext* cx, HandleObject obj, HandleId idval, MutableHandleValue vp);
static JSBool CreateArray(JSContext* cx, unsigned argc, jsval* vp); static JSBool CreateArray(JSContext* cx, unsigned argc, jsval* vp);
static JSBool ToString(JSContext* cx, unsigned argc, jsval* vp); static JSBool ToString(JSContext* cx, unsigned argc, jsval* vp);
static JSBool ToSource(JSContext* cx, unsigned argc, jsval* vp); static JSBool ToSource(JSContext* cx, unsigned argc, jsval* vp);
static JSBool HasInstance(JSContext* cx, JSHandleObject obj, MutableHandleValue v, JSBool* bp); static JSBool HasInstance(JSContext* cx, HandleObject obj, MutableHandleValue v, JSBool* bp);
/* /*
@ -195,13 +195,13 @@ namespace ABI {
namespace PointerType { namespace PointerType {
static JSBool Create(JSContext* cx, unsigned argc, jsval* vp); static JSBool Create(JSContext* cx, unsigned argc, jsval* vp);
static JSBool ConstructData(JSContext* cx, JSHandleObject obj, const CallArgs& args); static JSBool ConstructData(JSContext* cx, HandleObject obj, const CallArgs& args);
static JSBool TargetTypeGetter(JSContext* cx, JSHandleObject obj, JSHandleId idval, static JSBool TargetTypeGetter(JSContext* cx, HandleObject obj, HandleId idval,
MutableHandleValue vp); MutableHandleValue vp);
static JSBool ContentsGetter(JSContext* cx, JSHandleObject obj, JSHandleId idval, static JSBool ContentsGetter(JSContext* cx, HandleObject obj, HandleId idval,
MutableHandleValue vp); MutableHandleValue vp);
static JSBool ContentsSetter(JSContext* cx, JSHandleObject obj, JSHandleId idval, JSBool strict, static JSBool ContentsSetter(JSContext* cx, HandleObject obj, HandleId idval, JSBool strict,
MutableHandleValue vp); MutableHandleValue vp);
static JSBool IsNull(JSContext* cx, unsigned argc, jsval* vp); static JSBool IsNull(JSContext* cx, unsigned argc, jsval* vp);
static JSBool Increment(JSContext* cx, unsigned argc, jsval* vp); static JSBool Increment(JSContext* cx, unsigned argc, jsval* vp);
@ -213,26 +213,26 @@ namespace PointerType {
namespace ArrayType { namespace ArrayType {
static JSBool Create(JSContext* cx, unsigned argc, jsval* vp); static JSBool Create(JSContext* cx, unsigned argc, jsval* vp);
static JSBool ConstructData(JSContext* cx, JSHandleObject obj, const CallArgs& args); static JSBool ConstructData(JSContext* cx, HandleObject obj, const CallArgs& args);
static JSBool ElementTypeGetter(JSContext* cx, JSHandleObject obj, JSHandleId idval, static JSBool ElementTypeGetter(JSContext* cx, HandleObject obj, HandleId idval,
MutableHandleValue vp); MutableHandleValue vp);
static JSBool LengthGetter(JSContext* cx, JSHandleObject obj, JSHandleId idval, static JSBool LengthGetter(JSContext* cx, HandleObject obj, HandleId idval,
MutableHandleValue vp); MutableHandleValue vp);
static JSBool Getter(JSContext* cx, JSHandleObject obj, JSHandleId idval, MutableHandleValue vp); static JSBool Getter(JSContext* cx, HandleObject obj, HandleId idval, MutableHandleValue vp);
static JSBool Setter(JSContext* cx, JSHandleObject obj, JSHandleId idval, JSBool strict, MutableHandleValue vp); static JSBool Setter(JSContext* cx, HandleObject obj, HandleId idval, JSBool strict, MutableHandleValue vp);
static JSBool AddressOfElement(JSContext* cx, unsigned argc, jsval* vp); static JSBool AddressOfElement(JSContext* cx, unsigned argc, jsval* vp);
} }
namespace StructType { namespace StructType {
static JSBool Create(JSContext* cx, unsigned argc, jsval* vp); static JSBool Create(JSContext* cx, unsigned argc, jsval* vp);
static JSBool ConstructData(JSContext* cx, JSHandleObject obj, const CallArgs& args); static JSBool ConstructData(JSContext* cx, HandleObject obj, const CallArgs& args);
static JSBool FieldsArrayGetter(JSContext* cx, JSHandleObject obj, JSHandleId idval, static JSBool FieldsArrayGetter(JSContext* cx, HandleObject obj, HandleId idval,
MutableHandleValue vp); MutableHandleValue vp);
static JSBool FieldGetter(JSContext* cx, JSHandleObject obj, JSHandleId idval, static JSBool FieldGetter(JSContext* cx, HandleObject obj, HandleId idval,
MutableHandleValue vp); MutableHandleValue vp);
static JSBool FieldSetter(JSContext* cx, JSHandleObject obj, JSHandleId idval, JSBool strict, static JSBool FieldSetter(JSContext* cx, HandleObject obj, HandleId idval, JSBool strict,
MutableHandleValue vp); MutableHandleValue vp);
static JSBool AddressOfField(JSContext* cx, unsigned argc, jsval* vp); static JSBool AddressOfField(JSContext* cx, unsigned argc, jsval* vp);
static JSBool Define(JSContext* cx, unsigned argc, jsval* vp); static JSBool Define(JSContext* cx, unsigned argc, jsval* vp);
@ -240,17 +240,17 @@ namespace StructType {
namespace FunctionType { namespace FunctionType {
static JSBool Create(JSContext* cx, unsigned argc, jsval* vp); static JSBool Create(JSContext* cx, unsigned argc, jsval* vp);
static JSBool ConstructData(JSContext* cx, JSHandleObject typeObj, static JSBool ConstructData(JSContext* cx, HandleObject typeObj,
JSHandleObject dataObj, JSHandleObject fnObj, JSHandleObject thisObj, jsval errVal); HandleObject dataObj, HandleObject fnObj, HandleObject thisObj, jsval errVal);
static JSBool Call(JSContext* cx, unsigned argc, jsval* vp); static JSBool Call(JSContext* cx, unsigned argc, jsval* vp);
static JSBool ArgTypesGetter(JSContext* cx, JSHandleObject obj, JSHandleId idval, static JSBool ArgTypesGetter(JSContext* cx, HandleObject obj, HandleId idval,
MutableHandleValue vp); MutableHandleValue vp);
static JSBool ReturnTypeGetter(JSContext* cx, JSHandleObject obj, JSHandleId idval, static JSBool ReturnTypeGetter(JSContext* cx, HandleObject obj, HandleId idval,
MutableHandleValue vp); MutableHandleValue vp);
static JSBool ABIGetter(JSContext* cx, JSHandleObject obj, JSHandleId idval, MutableHandleValue vp); static JSBool ABIGetter(JSContext* cx, HandleObject obj, HandleId idval, MutableHandleValue vp);
static JSBool IsVariadicGetter(JSContext* cx, JSHandleObject obj, JSHandleId idval, static JSBool IsVariadicGetter(JSContext* cx, HandleObject obj, HandleId idval,
MutableHandleValue vp); MutableHandleValue vp);
} }
@ -266,21 +266,21 @@ namespace CClosure {
namespace CData { namespace CData {
static void Finalize(JSFreeOp *fop, JSObject* obj); static void Finalize(JSFreeOp *fop, JSObject* obj);
static JSBool ValueGetter(JSContext* cx, JSHandleObject obj, JSHandleId idval, static JSBool ValueGetter(JSContext* cx, HandleObject obj, HandleId idval,
MutableHandleValue vp); MutableHandleValue vp);
static JSBool ValueSetter(JSContext* cx, JSHandleObject obj, JSHandleId idval, static JSBool ValueSetter(JSContext* cx, HandleObject obj, HandleId idval,
JSBool strict, MutableHandleValue vp); JSBool strict, MutableHandleValue vp);
static JSBool Address(JSContext* cx, unsigned argc, jsval* vp); static JSBool Address(JSContext* cx, unsigned argc, jsval* vp);
static JSBool ReadString(JSContext* cx, unsigned argc, jsval* vp); static JSBool ReadString(JSContext* cx, unsigned argc, jsval* vp);
static JSBool ReadStringReplaceMalformed(JSContext* cx, unsigned argc, jsval* vp); static JSBool ReadStringReplaceMalformed(JSContext* cx, unsigned argc, jsval* vp);
static JSBool ToSource(JSContext* cx, unsigned argc, jsval* vp); static JSBool ToSource(JSContext* cx, unsigned argc, jsval* vp);
static JSString *GetSourceString(JSContext *cx, JSHandleObject typeObj, static JSString *GetSourceString(JSContext *cx, HandleObject typeObj,
void *data); void *data);
static JSBool ErrnoGetter(JSContext* cx, JSHandleObject obj, JSHandleId idval, static JSBool ErrnoGetter(JSContext* cx, HandleObject obj, HandleId idval,
MutableHandleValue vp); MutableHandleValue vp);
#if defined(XP_WIN) #if defined(XP_WIN)
static JSBool LastErrorGetter(JSContext* cx, JSHandleObject obj, JSHandleId idval, static JSBool LastErrorGetter(JSContext* cx, HandleObject obj, HandleId idval,
MutableHandleValue vp); MutableHandleValue vp);
#endif // defined(XP_WIN) #endif // defined(XP_WIN)
} }
@ -3543,7 +3543,7 @@ CType::GetFFIType(JSContext* cx, JSObject* obj)
} }
JSString* JSString*
CType::GetName(JSContext* cx, JSHandleObject obj) CType::GetName(JSContext* cx, HandleObject obj)
{ {
JS_ASSERT(CType::IsCType(obj)); JS_ASSERT(CType::IsCType(obj));
@ -3593,7 +3593,7 @@ CType::GetProtoFromType(JSContext* cx, JSObject* obj, CTypeProtoSlot slot)
} }
JSBool JSBool
CType::PrototypeGetter(JSContext* cx, JSHandleObject obj, JSHandleId idval, MutableHandleValue vp) CType::PrototypeGetter(JSContext* cx, HandleObject obj, HandleId idval, MutableHandleValue vp)
{ {
if (!(CType::IsCType(obj) || CType::IsCTypeProto(obj))) { if (!(CType::IsCType(obj) || CType::IsCTypeProto(obj))) {
JS_ReportError(cx, "not a CType or CTypeProto"); JS_ReportError(cx, "not a CType or CTypeProto");
@ -3608,7 +3608,7 @@ CType::PrototypeGetter(JSContext* cx, JSHandleObject obj, JSHandleId idval, Muta
} }
JSBool JSBool
CType::NameGetter(JSContext* cx, JSHandleObject obj, JSHandleId idval, MutableHandleValue vp) CType::NameGetter(JSContext* cx, HandleObject obj, HandleId idval, MutableHandleValue vp)
{ {
if (!CType::IsCType(obj)) { if (!CType::IsCType(obj)) {
JS_ReportError(cx, "not a CType"); JS_ReportError(cx, "not a CType");
@ -3624,7 +3624,7 @@ CType::NameGetter(JSContext* cx, JSHandleObject obj, JSHandleId idval, MutableHa
} }
JSBool JSBool
CType::SizeGetter(JSContext* cx, JSHandleObject obj, JSHandleId idval, MutableHandleValue vp) CType::SizeGetter(JSContext* cx, HandleObject obj, HandleId idval, MutableHandleValue vp)
{ {
if (!CType::IsCType(obj)) { if (!CType::IsCType(obj)) {
JS_ReportError(cx, "not a CType"); JS_ReportError(cx, "not a CType");
@ -3637,7 +3637,7 @@ CType::SizeGetter(JSContext* cx, JSHandleObject obj, JSHandleId idval, MutableHa
} }
JSBool JSBool
CType::PtrGetter(JSContext* cx, JSHandleObject obj, JSHandleId idval, MutableHandleValue vp) CType::PtrGetter(JSContext* cx, HandleObject obj, HandleId idval, MutableHandleValue vp)
{ {
if (!CType::IsCType(obj)) { if (!CType::IsCType(obj)) {
JS_ReportError(cx, "not a CType"); JS_ReportError(cx, "not a CType");
@ -3747,7 +3747,7 @@ CType::ToSource(JSContext* cx, unsigned argc, jsval* vp)
} }
JSBool JSBool
CType::HasInstance(JSContext* cx, JSHandleObject obj, MutableHandleValue v, JSBool* bp) CType::HasInstance(JSContext* cx, HandleObject obj, MutableHandleValue v, JSBool* bp)
{ {
JS_ASSERT(CType::IsCType(obj)); JS_ASSERT(CType::IsCType(obj));
@ -3909,7 +3909,7 @@ PointerType::CreateInternal(JSContext* cx, HandleObject baseType)
JSBool JSBool
PointerType::ConstructData(JSContext* cx, PointerType::ConstructData(JSContext* cx,
JSHandleObject obj, HandleObject obj,
const CallArgs& args) const CallArgs& args)
{ {
if (!CType::IsCType(obj) || CType::GetTypeCode(obj) != TYPE_pointer) { if (!CType::IsCType(obj) || CType::GetTypeCode(obj) != TYPE_pointer) {
@ -4001,8 +4001,8 @@ PointerType::GetBaseType(JSObject* obj)
JSBool JSBool
PointerType::TargetTypeGetter(JSContext* cx, PointerType::TargetTypeGetter(JSContext* cx,
JSHandleObject obj, HandleObject obj,
JSHandleId idval, HandleId idval,
MutableHandleValue vp) MutableHandleValue vp)
{ {
if (!CType::IsCType(obj) || CType::GetTypeCode(obj) != TYPE_pointer) { if (!CType::IsCType(obj) || CType::GetTypeCode(obj) != TYPE_pointer) {
@ -4091,8 +4091,8 @@ PointerType::Decrement(JSContext* cx, unsigned argc, jsval* vp)
JSBool JSBool
PointerType::ContentsGetter(JSContext* cx, PointerType::ContentsGetter(JSContext* cx,
JSHandleObject obj, HandleObject obj,
JSHandleId idval, HandleId idval,
MutableHandleValue vp) MutableHandleValue vp)
{ {
if (!CData::IsCData(obj)) { if (!CData::IsCData(obj)) {
@ -4129,8 +4129,8 @@ PointerType::ContentsGetter(JSContext* cx,
JSBool JSBool
PointerType::ContentsSetter(JSContext* cx, PointerType::ContentsSetter(JSContext* cx,
JSHandleObject obj, HandleObject obj,
JSHandleId idval, HandleId idval,
JSBool strict, JSBool strict,
MutableHandleValue vp) MutableHandleValue vp)
{ {
@ -4254,7 +4254,7 @@ ArrayType::CreateInternal(JSContext* cx,
JSBool JSBool
ArrayType::ConstructData(JSContext* cx, ArrayType::ConstructData(JSContext* cx,
JSHandleObject obj_, HandleObject obj_,
const CallArgs& args) const CallArgs& args)
{ {
RootedObject obj(cx, obj_); // Make a mutable version RootedObject obj(cx, obj_); // Make a mutable version
@ -4449,7 +4449,7 @@ ArrayType::BuildFFIType(JSContext* cx, JSObject* obj)
} }
JSBool JSBool
ArrayType::ElementTypeGetter(JSContext* cx, JSHandleObject obj, JSHandleId idval, MutableHandleValue vp) ArrayType::ElementTypeGetter(JSContext* cx, HandleObject obj, HandleId idval, MutableHandleValue vp)
{ {
if (!CType::IsCType(obj) || CType::GetTypeCode(obj) != TYPE_array) { if (!CType::IsCType(obj) || CType::GetTypeCode(obj) != TYPE_array) {
JS_ReportError(cx, "not an ArrayType"); JS_ReportError(cx, "not an ArrayType");
@ -4462,7 +4462,7 @@ ArrayType::ElementTypeGetter(JSContext* cx, JSHandleObject obj, JSHandleId idval
} }
JSBool JSBool
ArrayType::LengthGetter(JSContext* cx, JSHandleObject obj_, JSHandleId idval, MutableHandleValue vp) ArrayType::LengthGetter(JSContext* cx, HandleObject obj_, HandleId idval, MutableHandleValue vp)
{ {
JSObject *obj = obj_; JSObject *obj = obj_;
@ -4482,7 +4482,7 @@ ArrayType::LengthGetter(JSContext* cx, JSHandleObject obj_, JSHandleId idval, Mu
} }
JSBool JSBool
ArrayType::Getter(JSContext* cx, JSHandleObject obj, JSHandleId idval, MutableHandleValue vp) ArrayType::Getter(JSContext* cx, HandleObject obj, HandleId idval, MutableHandleValue vp)
{ {
// This should never happen, but we'll check to be safe. // This should never happen, but we'll check to be safe.
if (!CData::IsCData(obj)) { if (!CData::IsCData(obj)) {
@ -4518,7 +4518,7 @@ ArrayType::Getter(JSContext* cx, JSHandleObject obj, JSHandleId idval, MutableHa
} }
JSBool JSBool
ArrayType::Setter(JSContext* cx, JSHandleObject obj, JSHandleId idval, JSBool strict, MutableHandleValue vp) ArrayType::Setter(JSContext* cx, HandleObject obj, HandleId idval, JSBool strict, MutableHandleValue vp)
{ {
// This should never happen, but we'll check to be safe. // This should never happen, but we'll check to be safe.
if (!CData::IsCData(obj)) { if (!CData::IsCData(obj)) {
@ -5118,7 +5118,7 @@ StructType::BuildFieldsArray(JSContext* cx, JSObject* obj)
} }
JSBool JSBool
StructType::FieldsArrayGetter(JSContext* cx, JSHandleObject obj, JSHandleId idval, MutableHandleValue vp) StructType::FieldsArrayGetter(JSContext* cx, HandleObject obj, HandleId idval, MutableHandleValue vp)
{ {
if (!CType::IsCType(obj) || CType::GetTypeCode(obj) != TYPE_struct) { if (!CType::IsCType(obj) || CType::GetTypeCode(obj) != TYPE_struct) {
JS_ReportError(cx, "not a StructType"); JS_ReportError(cx, "not a StructType");
@ -5148,7 +5148,7 @@ StructType::FieldsArrayGetter(JSContext* cx, JSHandleObject obj, JSHandleId idva
} }
JSBool JSBool
StructType::FieldGetter(JSContext* cx, JSHandleObject obj, JSHandleId idval, MutableHandleValue vp) StructType::FieldGetter(JSContext* cx, HandleObject obj, HandleId idval, MutableHandleValue vp)
{ {
if (!CData::IsCData(obj)) { if (!CData::IsCData(obj)) {
JS_ReportError(cx, "not a CData"); JS_ReportError(cx, "not a CData");
@ -5171,7 +5171,7 @@ StructType::FieldGetter(JSContext* cx, JSHandleObject obj, JSHandleId idval, Mut
} }
JSBool JSBool
StructType::FieldSetter(JSContext* cx, JSHandleObject obj, JSHandleId idval, JSBool strict, MutableHandleValue vp) StructType::FieldSetter(JSContext* cx, HandleObject obj, HandleId idval, JSBool strict, MutableHandleValue vp)
{ {
if (!CData::IsCData(obj)) { if (!CData::IsCData(obj)) {
JS_ReportError(cx, "not a CData"); JS_ReportError(cx, "not a CData");
@ -5635,10 +5635,10 @@ FunctionType::CreateInternal(JSContext* cx,
// PointerType::ConstructData(). // PointerType::ConstructData().
JSBool JSBool
FunctionType::ConstructData(JSContext* cx, FunctionType::ConstructData(JSContext* cx,
JSHandleObject typeObj, HandleObject typeObj,
JSHandleObject dataObj, HandleObject dataObj,
JSHandleObject fnObj, HandleObject fnObj,
JSHandleObject thisObj, HandleObject thisObj,
jsval errVal) jsval errVal)
{ {
JS_ASSERT(CType::GetTypeCode(typeObj) == TYPE_function); JS_ASSERT(CType::GetTypeCode(typeObj) == TYPE_function);
@ -5890,7 +5890,7 @@ CheckFunctionType(JSContext* cx, JSObject* obj)
} }
JSBool JSBool
FunctionType::ArgTypesGetter(JSContext* cx, JSHandleObject obj, JSHandleId idval, MutableHandleValue vp) FunctionType::ArgTypesGetter(JSContext* cx, HandleObject obj, HandleId idval, MutableHandleValue vp)
{ {
if (!CheckFunctionType(cx, obj)) if (!CheckFunctionType(cx, obj))
return JS_FALSE; return JS_FALSE;
@ -5925,7 +5925,7 @@ FunctionType::ArgTypesGetter(JSContext* cx, JSHandleObject obj, JSHandleId idval
} }
JSBool JSBool
FunctionType::ReturnTypeGetter(JSContext* cx, JSHandleObject obj, JSHandleId idval, MutableHandleValue vp) FunctionType::ReturnTypeGetter(JSContext* cx, HandleObject obj, HandleId idval, MutableHandleValue vp)
{ {
if (!CheckFunctionType(cx, obj)) if (!CheckFunctionType(cx, obj))
return JS_FALSE; return JS_FALSE;
@ -5936,7 +5936,7 @@ FunctionType::ReturnTypeGetter(JSContext* cx, JSHandleObject obj, JSHandleId idv
} }
JSBool JSBool
FunctionType::ABIGetter(JSContext* cx, JSHandleObject obj, JSHandleId idval, MutableHandleValue vp) FunctionType::ABIGetter(JSContext* cx, HandleObject obj, HandleId idval, MutableHandleValue vp)
{ {
if (!CheckFunctionType(cx, obj)) if (!CheckFunctionType(cx, obj))
return JS_FALSE; return JS_FALSE;
@ -5947,7 +5947,7 @@ FunctionType::ABIGetter(JSContext* cx, JSHandleObject obj, JSHandleId idval, Mut
} }
JSBool JSBool
FunctionType::IsVariadicGetter(JSContext* cx, JSHandleObject obj, JSHandleId idval, MutableHandleValue vp) FunctionType::IsVariadicGetter(JSContext* cx, HandleObject obj, HandleId idval, MutableHandleValue vp)
{ {
if (!CheckFunctionType(cx, obj)) if (!CheckFunctionType(cx, obj))
return JS_FALSE; return JS_FALSE;
@ -6394,7 +6394,7 @@ CData::IsCDataProto(JSObject* obj)
} }
JSBool JSBool
CData::ValueGetter(JSContext* cx, JSHandleObject obj, JSHandleId idval, MutableHandleValue vp) CData::ValueGetter(JSContext* cx, HandleObject obj, HandleId idval, MutableHandleValue vp)
{ {
if (!IsCData(obj)) { if (!IsCData(obj)) {
JS_ReportError(cx, "not a CData"); JS_ReportError(cx, "not a CData");
@ -6410,7 +6410,7 @@ CData::ValueGetter(JSContext* cx, JSHandleObject obj, JSHandleId idval, MutableH
} }
JSBool JSBool
CData::ValueSetter(JSContext* cx, JSHandleObject obj, JSHandleId idval, JSBool strict, MutableHandleValue vp) CData::ValueSetter(JSContext* cx, HandleObject obj, HandleId idval, JSBool strict, MutableHandleValue vp)
{ {
if (!IsCData(obj)) { if (!IsCData(obj)) {
JS_ReportError(cx, "not a CData"); JS_ReportError(cx, "not a CData");
@ -6639,7 +6639,7 @@ CData::ReadStringReplaceMalformed(JSContext* cx, unsigned argc, jsval* vp)
} }
JSString * JSString *
CData::GetSourceString(JSContext *cx, JSHandleObject typeObj, void *data) CData::GetSourceString(JSContext *cx, HandleObject typeObj, void *data)
{ {
// Walk the types, building up the toSource() string. // Walk the types, building up the toSource() string.
// First, we build up the type expression: // First, we build up the type expression:
@ -6693,7 +6693,7 @@ CData::ToSource(JSContext* cx, unsigned argc, jsval* vp)
} }
JSBool JSBool
CData::ErrnoGetter(JSContext* cx, JSHandleObject obj, JSHandleId, MutableHandleValue vp) CData::ErrnoGetter(JSContext* cx, HandleObject obj, HandleId, MutableHandleValue vp)
{ {
if (!IsCTypesGlobal(obj)) { if (!IsCTypesGlobal(obj)) {
JS_ReportError(cx, "this is not not global object ctypes"); JS_ReportError(cx, "this is not not global object ctypes");
@ -6706,7 +6706,7 @@ CData::ErrnoGetter(JSContext* cx, JSHandleObject obj, JSHandleId, MutableHandleV
#if defined(XP_WIN) #if defined(XP_WIN)
JSBool JSBool
CData::LastErrorGetter(JSContext* cx, JSHandleObject obj, JSHandleId, MutableHandleValue vp) CData::LastErrorGetter(JSContext* cx, HandleObject obj, HandleId, MutableHandleValue vp)
{ {
if (!IsCTypesGlobal(obj)) { if (!IsCTypesGlobal(obj)) {
JS_ReportError(cx, "not global object ctypes"); JS_ReportError(cx, "not global object ctypes");

Просмотреть файл

@ -311,15 +311,15 @@ bool IsCTypesGlobal(JSObject* obj);
JSCTypesCallbacks* GetCallbacks(JSObject* obj); JSCTypesCallbacks* GetCallbacks(JSObject* obj);
JSBool InitTypeClasses(JSContext* cx, JSHandleObject parent); JSBool InitTypeClasses(JSContext* cx, HandleObject parent);
JSBool ConvertToJS(JSContext* cx, JSHandleObject typeObj, JSHandleObject dataObj, JSBool ConvertToJS(JSContext* cx, HandleObject typeObj, HandleObject dataObj,
void* data, bool wantPrimitive, bool ownResult, jsval* result); void* data, bool wantPrimitive, bool ownResult, jsval* result);
JSBool ImplicitConvert(JSContext* cx, JSHandleValue val, JSObject* targetType, JSBool ImplicitConvert(JSContext* cx, HandleValue val, JSObject* targetType,
void* buffer, bool isArgument, bool* freePointer); void* buffer, bool isArgument, bool* freePointer);
JSBool ExplicitConvert(JSContext* cx, JSHandleValue val, JSHandleObject targetType, JSBool ExplicitConvert(JSContext* cx, HandleValue val, HandleObject targetType,
void* buffer); void* buffer);
/******************************************************************************* /*******************************************************************************
@ -419,7 +419,7 @@ enum Int64FunctionSlot {
*******************************************************************************/ *******************************************************************************/
namespace CType { namespace CType {
JSObject* Create(JSContext* cx, JSHandleObject typeProto, JSHandleObject dataProto, JSObject* Create(JSContext* cx, HandleObject typeProto, HandleObject dataProto,
TypeCode type, JSString* name, jsval size, jsval align, ffi_type* ffiType); TypeCode type, JSString* name, jsval size, jsval align, ffi_type* ffiType);
JSObject* DefineBuiltin(JSContext* cx, JSObject* parent, const char* propName, JSObject* DefineBuiltin(JSContext* cx, JSObject* parent, const char* propName,
@ -435,20 +435,20 @@ namespace CType {
bool IsSizeDefined(JSObject* obj); bool IsSizeDefined(JSObject* obj);
size_t GetAlignment(JSObject* obj); size_t GetAlignment(JSObject* obj);
ffi_type* GetFFIType(JSContext* cx, JSObject* obj); ffi_type* GetFFIType(JSContext* cx, JSObject* obj);
JSString* GetName(JSContext* cx, JSHandleObject obj); JSString* GetName(JSContext* cx, HandleObject obj);
JSObject* GetProtoFromCtor(JSObject* obj, CTypeProtoSlot slot); JSObject* GetProtoFromCtor(JSObject* obj, CTypeProtoSlot slot);
JSObject* GetProtoFromType(JSContext* cx, JSObject* obj, CTypeProtoSlot slot); JSObject* GetProtoFromType(JSContext* cx, JSObject* obj, CTypeProtoSlot slot);
JSCTypesCallbacks* GetCallbacksFromType(JSObject* obj); JSCTypesCallbacks* GetCallbacksFromType(JSObject* obj);
} }
namespace PointerType { namespace PointerType {
JSObject* CreateInternal(JSContext* cx, JSHandleObject baseType); JSObject* CreateInternal(JSContext* cx, HandleObject baseType);
JSObject* GetBaseType(JSObject* obj); JSObject* GetBaseType(JSObject* obj);
} }
namespace ArrayType { namespace ArrayType {
JSObject* CreateInternal(JSContext* cx, JSHandleObject baseType, size_t length, JSObject* CreateInternal(JSContext* cx, HandleObject baseType, size_t length,
bool lengthDefined); bool lengthDefined);
JSObject* GetBaseType(JSObject* obj); JSObject* GetBaseType(JSObject* obj);
@ -479,12 +479,12 @@ namespace FunctionType {
} }
namespace CClosure { namespace CClosure {
JSObject* Create(JSContext* cx, JSHandleObject typeObj, JSHandleObject fnObj, JSObject* Create(JSContext* cx, HandleObject typeObj, HandleObject fnObj,
JSHandleObject thisObj, jsval errVal, PRFuncPtr* fnptr); HandleObject thisObj, jsval errVal, PRFuncPtr* fnptr);
} }
namespace CData { namespace CData {
JSObject* Create(JSContext* cx, JSHandleObject typeObj, JSHandleObject refObj, JSObject* Create(JSContext* cx, HandleObject typeObj, HandleObject refObj,
void* data, bool ownResult); void* data, bool ownResult);
JSObject* GetCType(JSObject* dataObj); JSObject* GetCType(JSObject* dataObj);

Просмотреть файл

@ -163,7 +163,7 @@ class FullParseHandler
} }
ParseNode *newUnary(ParseNodeKind kind, JSOp op, uint32_t begin, ParseNode *kid) { ParseNode *newUnary(ParseNodeKind kind, JSOp op, uint32_t begin, ParseNode *kid) {
TokenPos pos = {begin, kid ? kid->pn_pos.end : begin + 1}; TokenPos pos(begin, kid ? kid->pn_pos.end : begin + 1);
return new_<UnaryNode>(kind, op, pos, kid); return new_<UnaryNode>(kind, op, pos, kid);
} }
@ -176,39 +176,143 @@ class FullParseHandler
} }
ParseNode *newBinary(ParseNodeKind kind, ParseNode *left, ParseNode *right, ParseNode *newBinary(ParseNodeKind kind, ParseNode *left, ParseNode *right,
JSOp op = JSOP_NOP) { JSOp op = JSOP_NOP) {
TokenPos pos = TokenPos::make(left->pn_pos.begin, right->pn_pos.end); TokenPos pos(left->pn_pos.begin, right->pn_pos.end);
return new_<BinaryNode>(kind, op, pos, left, right); return new_<BinaryNode>(kind, op, pos, left, right);
} }
ParseNode *newBinaryOrAppend(ParseNodeKind kind, ParseNode *left, ParseNode *right, ParseNode *newBinaryOrAppend(ParseNodeKind kind, ParseNode *left, ParseNode *right,
ParseContext<FullParseHandler> *pc, JSOp op = JSOP_NOP) { ParseContext<FullParseHandler> *pc, JSOp op = JSOP_NOP)
{
return ParseNode::newBinaryOrAppend(kind, op, left, right, this, pc, foldConstants); return ParseNode::newBinaryOrAppend(kind, op, left, right, this, pc, foldConstants);
} }
ParseNode *newTernary(ParseNodeKind kind, ParseNode *newTernary(ParseNodeKind kind,
ParseNode *first, ParseNode *second, ParseNode *third, ParseNode *first, ParseNode *second, ParseNode *third,
JSOp op = JSOP_NOP) { JSOp op = JSOP_NOP)
{
return new_<TernaryNode>(kind, op, first, second, third); return new_<TernaryNode>(kind, op, first, second, third);
} }
ParseNode *newStatementList(unsigned blockid, const TokenPos &pos) {
ParseNode *pn = new_<ListNode>(PNK_STATEMENTLIST, pos);
if (pn)
pn->pn_blockid = blockid;
return pn;
}
template <typename PC>
void addStatementToList(ParseNode *list, ParseNode *stmt, PC *pc) {
JS_ASSERT(list->isKind(PNK_STATEMENTLIST));
if (stmt->isKind(PNK_FUNCTION)) {
if (pc->atBodyLevel()) {
// PNX_FUNCDEFS notifies the emitter that the block contains
// body-level function definitions that should be processed
// before the rest of nodes.
list->pn_xflags |= PNX_FUNCDEFS;
} else {
// General deoptimization was done in Parser::functionDef.
JS_ASSERT_IF(pc->sc->isFunctionBox(),
pc->sc->asFunctionBox()->hasExtensibleScope());
}
}
list->append(stmt);
}
ParseNode *newEmptyStatement(const TokenPos &pos) {
return new_<UnaryNode>(PNK_SEMI, JSOP_NOP, pos, (ParseNode *) NULL);
}
ParseNode *newExprStatement(ParseNode *expr, uint32_t end) {
JS_ASSERT(expr->pn_pos.end <= end);
return new_<UnaryNode>(PNK_SEMI, JSOP_NOP, TokenPos(expr->pn_pos.begin, end), expr);
}
ParseNode *newIfStatement(uint32_t begin, ParseNode *cond, ParseNode *thenBranch,
ParseNode *elseBranch)
{
ParseNode *pn = new_<TernaryNode>(PNK_IF, JSOP_NOP, cond, thenBranch, elseBranch);
if (!pn)
return null();
pn->pn_pos.begin = begin;
return pn;
}
ParseNode *newDoWhileStatement(ParseNode *body, ParseNode *cond, const TokenPos &pos) {
return new_<BinaryNode>(PNK_DOWHILE, JSOP_NOP, pos, body, cond);
}
ParseNode *newWhileStatement(uint32_t begin, ParseNode *cond, ParseNode *body) {
TokenPos pos(begin, body->pn_pos.end);
return new_<BinaryNode>(PNK_WHILE, JSOP_NOP, pos, cond, body);
}
ParseNode *newForStatement(uint32_t begin, ParseNode *forHead, ParseNode *body,
unsigned iflags)
{
/* A FOR node is binary, left is loop control and right is the body. */
JSOp op = forHead->isKind(PNK_FORIN) ? JSOP_ITER : JSOP_NOP;
BinaryNode *pn = new_<BinaryNode>(PNK_FOR, op, TokenPos(begin, body->pn_pos.end),
forHead, body);
if (!pn)
return null();
pn->pn_iflags = iflags;
return pn;
}
ParseNode *newForHead(bool isForInOrOf, ParseNode *pn1, ParseNode *pn2, ParseNode *pn3,
const TokenPos &pos)
{
ParseNodeKind kind = isForInOrOf ? PNK_FORIN : PNK_FORHEAD;
return new_<TernaryNode>(kind, JSOP_NOP, pn1, pn2, pn3, pos);
}
ParseNode *newSwitchStatement(uint32_t begin, ParseNode *discriminant, ParseNode *caseList) {
TokenPos pos(begin, caseList->pn_pos.end);
return new_<BinaryNode>(PNK_SWITCH, JSOP_NOP, pos, discriminant, caseList);
}
ParseNode *newCaseOrDefault(uint32_t begin, ParseNode *expr, ParseNode *body) {
TokenPos pos(begin, body->pn_pos.end);
return new_<BinaryNode>(expr ? PNK_CASE : PNK_DEFAULT, JSOP_NOP, pos, expr, body);
}
ParseNode *newContinueStatement(PropertyName *label, const TokenPos &pos) {
return new_<ContinueStatement>(label, pos);
}
ParseNode *newBreakStatement(PropertyName *label, const TokenPos &pos) {
return new_<BreakStatement>(label, pos);
}
ParseNode *newReturnStatement(ParseNode *expr, const TokenPos &pos) {
JS_ASSERT_IF(expr, pos.encloses(expr->pn_pos));
return new_<UnaryNode>(PNK_RETURN, JSOP_RETURN, pos, expr);
}
ParseNode *newWithStatement(uint32_t begin, ParseNode *expr, ParseNode *body) {
return new_<BinaryNode>(PNK_WITH, JSOP_NOP, TokenPos(begin, body->pn_pos.end), expr, body);
}
ParseNode *newLabeledStatement(PropertyName *label, ParseNode *stmt, uint32_t begin) { ParseNode *newLabeledStatement(PropertyName *label, ParseNode *stmt, uint32_t begin) {
return new_<LabeledStatement>(label, stmt, begin); return new_<LabeledStatement>(label, stmt, begin);
} }
ParseNode *newCaseOrDefault(uint32_t begin, ParseNode *expr, ParseNode *body) { ParseNode *newThrowStatement(ParseNode *expr, const TokenPos &pos) {
TokenPos pos = TokenPos::make(begin, body->pn_pos.end); JS_ASSERT(pos.encloses(expr->pn_pos));
return new_<BinaryNode>(expr ? PNK_CASE : PNK_DEFAULT, JSOP_NOP, pos, expr, body); return new_<UnaryNode>(PNK_THROW, JSOP_THROW, pos, expr);
} }
ParseNode *newBreak(PropertyName *label, uint32_t begin, uint32_t end) { ParseNode *newTryStatement(uint32_t begin, ParseNode *body, ParseNode *catchList,
return new_<BreakStatement>(label, begin, end); ParseNode *finallyBlock) {
} TokenPos pos(begin, (finallyBlock ? finallyBlock : catchList)->pn_pos.end);
ParseNode *newContinue(PropertyName *label, uint32_t begin, uint32_t end) { return new_<TernaryNode>(PNK_TRY, JSOP_NOP, body, catchList, finallyBlock, pos);
return new_<ContinueStatement>(label, begin, end);
} }
ParseNode *newDebuggerStatement(const TokenPos &pos) { ParseNode *newDebuggerStatement(const TokenPos &pos) {
return new_<DebuggerStatement>(pos); return new_<DebuggerStatement>(pos);
} }
ParseNode *newPropertyAccess(ParseNode *pn, PropertyName *name, uint32_t end) { ParseNode *newPropertyAccess(ParseNode *pn, PropertyName *name, uint32_t end) {
return new_<PropertyAccess>(pn, name, pn->pn_pos.begin, end); return new_<PropertyAccess>(pn, name, pn->pn_pos.begin, end);
} }
@ -364,7 +468,7 @@ class FullParseHandler
} }
JSAtom *isStringExprStatement(ParseNode *pn, TokenPos *pos) { JSAtom *isStringExprStatement(ParseNode *pn, TokenPos *pos) {
if (JSAtom *atom = pn->isStringExprStatement()) { if (JSAtom *atom = pn->isStringExprStatement()) {
*pos = pn->pn_pos; *pos = pn->pn_kid->pn_pos;
return atom; return atom;
} }
return NULL; return NULL;

Просмотреть файл

@ -432,11 +432,9 @@ struct ParseNode
public: public:
ParseNode(ParseNodeKind kind, JSOp op, ParseNodeArity arity) ParseNode(ParseNodeKind kind, JSOp op, ParseNodeArity arity)
: pn_type(kind), pn_op(op), pn_arity(arity), pn_parens(0), pn_used(0), pn_defn(0), : pn_type(kind), pn_op(op), pn_arity(arity), pn_parens(0), pn_used(0), pn_defn(0),
pn_offset(0), pn_next(NULL), pn_link(NULL) pn_pos(0, 0), pn_offset(0), pn_next(NULL), pn_link(NULL)
{ {
JS_ASSERT(kind < PNK_LIMIT); JS_ASSERT(kind < PNK_LIMIT);
pn_pos.begin = 0;
pn_pos.end = 0;
memset(&pn_u, 0, sizeof pn_u); memset(&pn_u, 0, sizeof pn_u);
} }
@ -895,7 +893,7 @@ struct TernaryNode : public ParseNode
{ {
TernaryNode(ParseNodeKind kind, JSOp op, ParseNode *kid1, ParseNode *kid2, ParseNode *kid3) TernaryNode(ParseNodeKind kind, JSOp op, ParseNode *kid1, ParseNode *kid2, ParseNode *kid3)
: ParseNode(kind, op, PN_TERNARY, : ParseNode(kind, op, PN_TERNARY,
TokenPos::make((kid1 ? kid1 : kid2 ? kid2 : kid3)->pn_pos.begin, TokenPos((kid1 ? kid1 : kid2 ? kid2 : kid3)->pn_pos.begin,
(kid3 ? kid3 : kid2 ? kid2 : kid1)->pn_pos.end)) (kid3 ? kid3 : kid2 ? kid2 : kid1)->pn_pos.end))
{ {
pn_kid1 = kid1; pn_kid1 = kid1;
@ -903,6 +901,15 @@ struct TernaryNode : public ParseNode
pn_kid3 = kid3; pn_kid3 = kid3;
} }
TernaryNode(ParseNodeKind kind, JSOp op, ParseNode *kid1, ParseNode *kid2, ParseNode *kid3,
const TokenPos &pos)
: ParseNode(kind, op, PN_TERNARY, pos)
{
pn_kid1 = kid1;
pn_kid2 = kid2;
pn_kid3 = kid3;
}
static inline TernaryNode *create(ParseNodeKind kind, FullParseHandler *handler) { static inline TernaryNode *create(ParseNodeKind kind, FullParseHandler *handler) {
return (TernaryNode *) ParseNode::create(kind, PN_TERNARY, handler); return (TernaryNode *) ParseNode::create(kind, PN_TERNARY, handler);
} }
@ -918,10 +925,15 @@ struct TernaryNode : public ParseNode
struct ListNode : public ParseNode struct ListNode : public ParseNode
{ {
ListNode(ParseNodeKind kind, JSOp op, ParseNode *kid) ListNode(ParseNodeKind kind, const TokenPos &pos)
: ParseNode(kind, op, PN_LIST) : ParseNode(kind, JSOP_NOP, PN_LIST, pos)
{
makeEmpty();
}
ListNode(ParseNodeKind kind, JSOp op, ParseNode *kid)
: ParseNode(kind, op, PN_LIST, kid->pn_pos)
{ {
pn_pos = kid->pn_pos;
initList(kid); initList(kid);
} }
@ -992,7 +1004,7 @@ class LabeledStatement : public ParseNode
{ {
public: public:
LabeledStatement(PropertyName *label, ParseNode *stmt, uint32_t begin) LabeledStatement(PropertyName *label, ParseNode *stmt, uint32_t begin)
: ParseNode(PNK_LABEL, JSOP_NOP, PN_NAME, TokenPos::make(begin, stmt->pn_pos.end)) : ParseNode(PNK_LABEL, JSOP_NOP, PN_NAME, TokenPos(begin, stmt->pn_pos.end))
{ {
pn_atom = label; pn_atom = label;
pn_expr = stmt; pn_expr = stmt;
@ -1017,8 +1029,8 @@ class LabeledStatement : public ParseNode
class LoopControlStatement : public ParseNode class LoopControlStatement : public ParseNode
{ {
protected: protected:
LoopControlStatement(ParseNodeKind kind, PropertyName *label, uint32_t begin, uint32_t end) LoopControlStatement(ParseNodeKind kind, PropertyName *label, const TokenPos &pos)
: ParseNode(kind, JSOP_NOP, PN_NULLARY, TokenPos::make(begin, end)) : ParseNode(kind, JSOP_NOP, PN_NULLARY, pos)
{ {
JS_ASSERT(kind == PNK_BREAK || kind == PNK_CONTINUE); JS_ASSERT(kind == PNK_BREAK || kind == PNK_CONTINUE);
pn_u.loopControl.label = label; pn_u.loopControl.label = label;
@ -1041,8 +1053,8 @@ class LoopControlStatement : public ParseNode
class BreakStatement : public LoopControlStatement class BreakStatement : public LoopControlStatement
{ {
public: public:
BreakStatement(PropertyName *label, uint32_t begin, uint32_t end) BreakStatement(PropertyName *label, const TokenPos &pos)
: LoopControlStatement(PNK_BREAK, label, begin, end) : LoopControlStatement(PNK_BREAK, label, pos)
{ } { }
static bool test(const ParseNode &node) { static bool test(const ParseNode &node) {
@ -1056,8 +1068,8 @@ class BreakStatement : public LoopControlStatement
class ContinueStatement : public LoopControlStatement class ContinueStatement : public LoopControlStatement
{ {
public: public:
ContinueStatement(PropertyName *label, uint32_t begin, uint32_t end) ContinueStatement(PropertyName *label, const TokenPos &pos)
: LoopControlStatement(PNK_CONTINUE, label, begin, end) : LoopControlStatement(PNK_CONTINUE, label, pos)
{ } { }
static bool test(const ParseNode &node) { static bool test(const ParseNode &node) {
@ -1081,7 +1093,7 @@ class ConditionalExpression : public ParseNode
public: public:
ConditionalExpression(ParseNode *condition, ParseNode *thenExpr, ParseNode *elseExpr) ConditionalExpression(ParseNode *condition, ParseNode *thenExpr, ParseNode *elseExpr)
: ParseNode(PNK_CONDITIONAL, JSOP_NOP, PN_TERNARY, : ParseNode(PNK_CONDITIONAL, JSOP_NOP, PN_TERNARY,
TokenPos::make(condition->pn_pos.begin, elseExpr->pn_pos.end)) TokenPos(condition->pn_pos.begin, elseExpr->pn_pos.end))
{ {
JS_ASSERT(condition); JS_ASSERT(condition);
JS_ASSERT(thenExpr); JS_ASSERT(thenExpr);
@ -1154,7 +1166,7 @@ class PropertyAccess : public ParseNode
{ {
public: public:
PropertyAccess(ParseNode *lhs, PropertyName *name, uint32_t begin, uint32_t end) PropertyAccess(ParseNode *lhs, PropertyName *name, uint32_t begin, uint32_t end)
: ParseNode(PNK_DOT, JSOP_GETPROP, PN_NAME, TokenPos::make(begin, end)) : ParseNode(PNK_DOT, JSOP_GETPROP, PN_NAME, TokenPos(begin, end))
{ {
JS_ASSERT(lhs != NULL); JS_ASSERT(lhs != NULL);
JS_ASSERT(name != NULL); JS_ASSERT(name != NULL);
@ -1181,7 +1193,7 @@ class PropertyByValue : public ParseNode
{ {
public: public:
PropertyByValue(ParseNode *lhs, ParseNode *propExpr, uint32_t begin, uint32_t end) PropertyByValue(ParseNode *lhs, ParseNode *propExpr, uint32_t begin, uint32_t end)
: ParseNode(PNK_ELEM, JSOP_GETELEM, PN_BINARY, TokenPos::make(begin, end)) : ParseNode(PNK_ELEM, JSOP_GETELEM, PN_BINARY, TokenPos(begin, end))
{ {
pn_u.binary.left = lhs; pn_u.binary.left = lhs;
pn_u.binary.right = propExpr; pn_u.binary.right = propExpr;

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -417,11 +417,21 @@ struct Parser : private AutoGCRooter, public StrictModeGetter
Node functionExpr(); Node functionExpr();
Node statements(); Node statements();
Node switchStatement(); Node blockStatement();
Node ifStatement();
Node doWhileStatement();
Node whileStatement();
Node forStatement(); Node forStatement();
Node labeledStatement(); Node switchStatement();
Node tryStatement(); Node continueStatement();
Node breakStatement();
Node returnStatementOrYieldExpression();
Node withStatement(); Node withStatement();
Node labeledStatement();
Node throwStatement();
Node tryStatement();
Node debuggerStatement();
#if JS_HAS_BLOCK_SCOPE #if JS_HAS_BLOCK_SCOPE
Node letStatement(); Node letStatement();
#endif #endif
@ -461,7 +471,6 @@ struct Parser : private AutoGCRooter, public StrictModeGetter
bool argumentList(Node listNode); bool argumentList(Node listNode);
Node bracketedExpr(); Node bracketedExpr();
Node letBlock(LetContext letContext); Node letBlock(LetContext letContext);
Node returnOrYield(bool useAssignExpr);
Node destructuringExpr(BindData<ParseHandler> *data, TokenKind tt); Node destructuringExpr(BindData<ParseHandler> *data, TokenKind tt);
Node identifierName(); Node identifierName();
@ -477,7 +486,6 @@ struct Parser : private AutoGCRooter, public StrictModeGetter
bool setAssignmentLhsOps(Node pn, JSOp op); bool setAssignmentLhsOps(Node pn, JSOp op);
bool matchInOrOf(bool *isForOfp); bool matchInOrOf(bool *isForOfp);
void addStatementToList(Node pn, Node kid);
bool checkFunctionArguments(); bool checkFunctionArguments();
bool makeDefIntoUse(Definition *dn, Node pn, JSAtom *atom); bool makeDefIntoUse(Definition *dn, Node pn, JSAtom *atom);
bool checkFunctionDefinition(HandlePropertyName funName, Node *pn, FunctionSyntaxKind kind, bool checkFunctionDefinition(HandlePropertyName funName, Node *pn, FunctionSyntaxKind kind,

Просмотреть файл

@ -83,8 +83,6 @@ class SyntaxParseHandler
Node newDelete(uint32_t begin, Node expr) { return NodeGeneric; } Node newDelete(uint32_t begin, Node expr) { return NodeGeneric; }
Node newUnary(ParseNodeKind kind, JSOp op, uint32_t begin, Node kid) { Node newUnary(ParseNodeKind kind, JSOp op, uint32_t begin, Node kid) {
if (kind == PNK_SEMI && kid == NodeString)
return NodeStringExprStatement;
return NodeGeneric; return NodeGeneric;
} }
@ -102,24 +100,38 @@ class SyntaxParseHandler
return NodeGeneric; return NodeGeneric;
} }
Node newStatementList(unsigned blockid, const TokenPos &pos) { return NodeGeneric; }
void addStatementToList(Node list, Node stmt, ParseContext<SyntaxParseHandler> *pc) {}
Node newEmptyStatement(const TokenPos &pos) { return NodeGeneric; }
Node newExprStatement(Node expr, uint32_t end) {
return expr == NodeString ? NodeStringExprStatement : NodeGeneric;
}
Node newIfStatement(uint32_t begin, Node cond, Node then, Node else_) { return NodeGeneric; }
Node newDoWhileStatement(Node body, Node cond, const TokenPos &pos) { return NodeGeneric; }
Node newWhileStatement(uint32_t begin, Node cond, Node body) { return NodeGeneric; }
Node newSwitchStatement(uint32_t begin, Node discriminant, Node caseList) { return NodeGeneric; }
Node newCaseOrDefault(uint32_t begin, Node expr, Node body) { return NodeGeneric; }
Node newContinueStatement(PropertyName *label, const TokenPos &pos) { return NodeGeneric; }
Node newBreakStatement(PropertyName *label, const TokenPos &pos) { return NodeGeneric; }
Node newReturnStatement(Node expr, const TokenPos &pos) { return NodeGeneric; }
Node newLabeledStatement(PropertyName *label, Node stmt, uint32_t begin) { Node newLabeledStatement(PropertyName *label, Node stmt, uint32_t begin) {
return NodeGeneric; return NodeGeneric;
} }
Node newCaseOrDefault(uint32_t begin, Node expr, Node body) {
return NodeGeneric; Node newThrowStatement(Node expr, const TokenPos &pos) { return NodeGeneric; }
} Node newTryStatement(uint32_t begin, Node body, Node catchList, Node finallyBlock) {
Node newBreak(PropertyName *label, uint32_t begin, uint32_t end) {
return NodeGeneric;
}
Node newContinue(PropertyName *label, uint32_t begin, uint32_t end) {
return NodeGeneric; return NodeGeneric;
} }
Node newDebuggerStatement(const TokenPos &pos) { return NodeGeneric; } Node newDebuggerStatement(const TokenPos &pos) { return NodeGeneric; }
Node newPropertyAccess(Node pn, PropertyName *name, uint32_t end)
{ Node newPropertyAccess(Node pn, PropertyName *name, uint32_t end) {
lastAtom = name; lastAtom = name;
return NodeGetProp; return NodeGetProp;
} }
Node newPropertyByValue(Node pn, Node kid, uint32_t end) { return NodeLValue; } Node newPropertyByValue(Node pn, Node kid, uint32_t end) { return NodeLValue; }
bool addCatchBlock(Node catchList, Node letBlock, bool addCatchBlock(Node catchList, Node letBlock,

Просмотреть файл

@ -1861,7 +1861,6 @@ TokenKindToString(TokenKind tt)
case TOK_INSTANCEOF: return "TOK_INSTANCEOF"; case TOK_INSTANCEOF: return "TOK_INSTANCEOF";
case TOK_DEBUGGER: return "TOK_DEBUGGER"; case TOK_DEBUGGER: return "TOK_DEBUGGER";
case TOK_YIELD: return "TOK_YIELD"; case TOK_YIELD: return "TOK_YIELD";
case TOK_LEXICALSCOPE: return "TOK_LEXICALSCOPE";
case TOK_LET: return "TOK_LET"; case TOK_LET: return "TOK_LET";
case TOK_RESERVED: return "TOK_RESERVED"; case TOK_RESERVED: return "TOK_RESERVED";
case TOK_STRICT_RESERVED: return "TOK_STRICT_RESERVED"; case TOK_STRICT_RESERVED: return "TOK_STRICT_RESERVED";

Просмотреть файл

@ -72,7 +72,6 @@ enum TokenKind {
TOK_THROW, /* throw keyword */ TOK_THROW, /* throw keyword */
TOK_DEBUGGER, /* debugger keyword */ TOK_DEBUGGER, /* debugger keyword */
TOK_YIELD, /* yield from generator function */ TOK_YIELD, /* yield from generator function */
TOK_LEXICALSCOPE, /* block scope AST node label */
TOK_LET, /* let keyword */ TOK_LET, /* let keyword */
TOK_EXPORT, /* export keyword */ TOK_EXPORT, /* export keyword */
TOK_IMPORT, /* import keyword */ TOK_IMPORT, /* import keyword */
@ -199,19 +198,15 @@ struct TokenPos {
uint32_t begin; /* offset of the token's first char */ uint32_t begin; /* offset of the token's first char */
uint32_t end; /* offset of 1 past the token's last char */ uint32_t end; /* offset of 1 past the token's last char */
static TokenPos make(uint32_t begin, uint32_t end) { TokenPos() {}
JS_ASSERT(begin <= end); TokenPos(uint32_t begin, uint32_t end) : begin(begin), end(end) {}
TokenPos pos = {begin, end};
return pos;
}
/* Return a TokenPos that covers left, right, and anything in between. */ /* Return a TokenPos that covers left, right, and anything in between. */
static TokenPos box(const TokenPos &left, const TokenPos &right) { static TokenPos box(const TokenPos &left, const TokenPos &right) {
JS_ASSERT(left.begin <= left.end); JS_ASSERT(left.begin <= left.end);
JS_ASSERT(left.end <= right.begin); JS_ASSERT(left.end <= right.begin);
JS_ASSERT(right.begin <= right.end); JS_ASSERT(right.begin <= right.end);
TokenPos pos = {left.begin, right.end}; return TokenPos(left.begin, right.end);
return pos;
} }
bool operator==(const TokenPos& bpos) const { bool operator==(const TokenPos& bpos) const {

Просмотреть файл

@ -513,24 +513,6 @@ MarkValueInternal(JSTracer *trc, Value *v)
} }
} }
static inline void
MarkValueInternalMaybeNullPayload(JSTracer *trc, Value *v)
{
if (v->isMarkable()) {
void *thing = v->toGCThing();
if (thing) {
JS_SET_TRACING_LOCATION(trc, (void *)v);
MarkKind(trc, &thing, v->gcKind());
if (v->isString())
v->setString((JSString *)thing);
else
v->setObjectOrNull((JSObject *)thing);
return;
}
}
JS_UNSET_TRACING_LOCATION(trc);
}
void void
gc::MarkValue(JSTracer *trc, EncapsulatedValue *v, const char *name) gc::MarkValue(JSTracer *trc, EncapsulatedValue *v, const char *name)
{ {
@ -581,16 +563,6 @@ gc::MarkValueRootRange(JSTracer *trc, size_t len, Value *vec, const char *name)
} }
} }
void
gc::MarkValueRootRangeMaybeNullPayload(JSTracer *trc, size_t len, Value *vec, const char *name)
{
JS_ROOT_MARKING_ASSERT(trc);
for (size_t i = 0; i < len; ++i) {
JS_SET_TRACING_INDEX(trc, name, i);
MarkValueInternalMaybeNullPayload(trc, &vec[i]);
}
}
bool bool
gc::IsValueMarked(Value *v) gc::IsValueMarked(Value *v)
{ {

Просмотреть файл

@ -181,9 +181,6 @@ MarkValueRootRange(JSTracer *trc, Value *begin, Value *end, const char *name)
MarkValueRootRange(trc, end - begin, begin, name); MarkValueRootRange(trc, end - begin, begin, name);
} }
void
MarkValueRootRangeMaybeNullPayload(JSTracer *trc, size_t len, Value *vec, const char *name);
void void
MarkTypeRoot(JSTracer *trc, types::Type *v, const char *name); MarkTypeRoot(JSTracer *trc, types::Type *v, const char *name);

Просмотреть файл

@ -737,7 +737,7 @@ js::gc::MarkRuntime(JSTracer *trc, bool useSavedRoots)
c->debugScopes->mark(trc); c->debugScopes->mark(trc);
} }
rt->stackSpace.mark(trc); MarkInterpreterActivations(rt, trc);
#ifdef JS_ION #ifdef JS_ION
ion::MarkJitActivations(rt, trc); ion::MarkJitActivations(rt, trc);

Просмотреть файл

@ -1400,10 +1400,8 @@ class MOZ_STACK_CLASS ModuleCompiler
if (!module_->addHeapAccesses(gen.heapAccesses())) if (!module_->addHeapAccesses(gen.heapAccesses()))
return false; return false;
#endif #endif
for (unsigned i = 0; i < gen.globalAccesses().length(); i++) { if (!globalAccesses_.append(gen.globalAccesses()))
if (!globalAccesses_.append(gen.globalAccesses()[i]))
return false; return false;
}
return true; return true;
} }
bool addGlobalAccess(AsmJSGlobalAccess access) { bool addGlobalAccess(AsmJSGlobalAccess access) {

Просмотреть файл

@ -411,8 +411,8 @@ HandleDynamicLinkFailure(JSContext *cx, CallArgs args, AsmJSModule &module, Hand
unsigned argc = args.length(); unsigned argc = args.length();
InvokeArgsGuard args2; InvokeArgs args2(cx);
if (!cx->stack.pushInvokeArgs(cx, argc, &args2)) if (!args2.init(argc))
return false; return false;
args2.setCallee(ObjectValue(*fun)); args2.setCallee(ObjectValue(*fun));

Просмотреть файл

@ -613,11 +613,7 @@ class AsmJSModule
} }
bool addHeapAccesses(const ion::AsmJSHeapAccessVector &accesses) { bool addHeapAccesses(const ion::AsmJSHeapAccessVector &accesses) {
if (!heapAccesses_.reserve(heapAccesses_.length() + accesses.length())) return heapAccesses_.append(accesses);
return false;
for (size_t i = 0; i < accesses.length(); i++)
heapAccesses_.infallibleAppend(accesses[i]);
return true;
} }
unsigned numHeapAccesses() const { unsigned numHeapAccesses() const {
return heapAccesses_.length(); return heapAccesses_.length();
@ -630,11 +626,7 @@ class AsmJSModule
} }
#if defined(JS_CPU_ARM) #if defined(JS_CPU_ARM)
bool addBoundsChecks(const ion::AsmJSBoundsCheckVector &checks) { bool addBoundsChecks(const ion::AsmJSBoundsCheckVector &checks) {
if (!boundsChecks_.reserve(boundsChecks_.length() + checks.length())) return boundsChecks_.append(checks);
return false;
for (size_t i = 0; i < checks.length(); i++)
boundsChecks_.infallibleAppend(checks[i]);
return true;
} }
void convertBoundsChecksToActualOffset(ion::MacroAssembler &masm) { void convertBoundsChecksToActualOffset(ion::MacroAssembler &masm) {
for (unsigned i = 0; i < boundsChecks_.length(); i++) for (unsigned i = 0; i < boundsChecks_.length(); i++)

Просмотреть файл

@ -1204,7 +1204,7 @@ ion::FinishBailoutToBaseline(BaselineBailoutInfo *bailoutInfo)
// Check that we can get the current script's PC. // Check that we can get the current script's PC.
#ifdef DEBUG #ifdef DEBUG
jsbytecode *pc; jsbytecode *pc;
cx->stack.currentScript(&pc); cx->currentScript(&pc);
IonSpew(IonSpew_BaselineBailouts, " Got pc=%p", pc); IonSpew(IonSpew_BaselineBailouts, " Got pc=%p", pc);
#endif #endif

Просмотреть файл

@ -786,10 +786,9 @@ ion::BuildDominatorTree(MIRGraph &graph)
MBasicBlock *block = worklist.popCopy(); MBasicBlock *block = worklist.popCopy();
block->setDomIndex(index); block->setDomIndex(index);
for (size_t i = 0; i < block->numImmediatelyDominatedBlocks(); i++) { if (!worklist.append(block->immediatelyDominatedBlocksBegin(),
if (!worklist.append(block->getImmediatelyDominatedBlock(i))) block->immediatelyDominatedBlocksEnd()))
return false; return false;
}
index++; index++;
} }
@ -1358,10 +1357,9 @@ ion::EliminateRedundantChecks(MIRGraph &graph)
MBasicBlock *block = worklist.popCopy(); MBasicBlock *block = worklist.popCopy();
// Add all immediate dominators to the front of the worklist. // Add all immediate dominators to the front of the worklist.
for (size_t i = 0; i < block->numImmediatelyDominatedBlocks(); i++) { if (!worklist.append(block->immediatelyDominatedBlocksBegin(),
if (!worklist.append(block->getImmediatelyDominatedBlock(i))) block->immediatelyDominatedBlocksEnd()))
return false; return false;
}
for (MDefinitionIterator iter(block); iter; ) { for (MDefinitionIterator iter(block); iter; ) {
bool eliminated = false; bool eliminated = false;

Просмотреть файл

@ -105,8 +105,7 @@ class LinearSum
LinearSum(const LinearSum &other) LinearSum(const LinearSum &other)
: constant_(other.constant_) : constant_(other.constant_)
{ {
for (size_t i = 0; i < other.terms_.length(); i++) terms_.append(other.terms_);
terms_.append(other.terms_[i]);
} }
bool multiply(int32_t scale); bool multiply(int32_t scale);

Просмотреть файл

@ -936,7 +936,7 @@ GenerateCallGetter(JSContext *cx, IonScript *ion, MacroAssembler &masm,
PropertyOp target = shape->getterOp(); PropertyOp target = shape->getterOp();
JS_ASSERT(target); JS_ASSERT(target);
// JSPropertyOp: JSBool fn(JSContext *cx, JSHandleObject obj, JSHandleId id, MutableHandleValue vp) // JSPropertyOp: JSBool fn(JSContext *cx, HandleObject obj, HandleId id, MutableHandleValue vp)
// Push args on stack first so we can take pointers to make handles. // Push args on stack first so we can take pointers to make handles.
masm.Push(UndefinedValue()); masm.Push(UndefinedValue());
@ -1845,8 +1845,8 @@ SetPropertyIC::attachSetterCall(JSContext *cx, IonScript *ion,
StrictPropertyOp target = shape->setterOp(); StrictPropertyOp target = shape->setterOp();
JS_ASSERT(target); JS_ASSERT(target);
// JSStrictPropertyOp: JSBool fn(JSContext *cx, JSHandleObject obj, // JSStrictPropertyOp: JSBool fn(JSContext *cx, HandleObject obj,
// JSHandleId id, JSBool strict, MutableHandleValue vp); // HandleId id, JSBool strict, MutableHandleValue vp);
// Push args on stack first so we can take pointers to make handles. // Push args on stack first so we can take pointers to make handles.
if (value().constant()) if (value().constant())

Просмотреть файл

@ -384,6 +384,14 @@ class MBasicBlock : public TempObject, public InlineListNode<MBasicBlock>
return immediatelyDominated_[i]; return immediatelyDominated_[i];
} }
MBasicBlock **immediatelyDominatedBlocksBegin() {
return immediatelyDominated_.begin();
}
MBasicBlock **immediatelyDominatedBlocksEnd() {
return immediatelyDominated_.end();
}
size_t numDominated() const { size_t numDominated() const {
return numDominated_; return numDominated_;
} }

Просмотреть файл

@ -16,15 +16,11 @@ AllocationIntegrityState::record()
if (!instructions.empty()) if (!instructions.empty())
return true; return true;
if (!instructions.reserve(graph.numInstructions())) if (!instructions.appendN(InstructionInfo(), graph.numInstructions()))
return false; return false;
for (size_t i = 0; i < graph.numInstructions(); i++)
instructions.infallibleAppend(InstructionInfo());
if (!virtualRegisters.reserve(graph.numVirtualRegisters())) if (!virtualRegisters.appendN((LDefinition *)NULL, graph.numVirtualRegisters()))
return false; return false;
for (size_t i = 0; i < graph.numVirtualRegisters(); i++)
virtualRegisters.infallibleAppend((LDefinition *)NULL);
if (!blocks.reserve(graph.numBlocks())) if (!blocks.reserve(graph.numBlocks()))
return false; return false;
@ -425,8 +421,7 @@ AllocationIntegrityState::dump()
// were discovered. // were discovered.
Vector<IntegrityItem, 20, SystemAllocPolicy> seenOrdered; Vector<IntegrityItem, 20, SystemAllocPolicy> seenOrdered;
for (size_t i = 0; i < seen.count(); i++) seenOrdered.appendN(IntegrityItem(), seen.count());
seenOrdered.append(IntegrityItem());
for (IntegrityItemSet::Enum iter(seen); !iter.empty(); iter.popFront()) { for (IntegrityItemSet::Enum iter(seen); !iter.empty(); iter.popFront()) {
IntegrityItem item = iter.front(); IntegrityItem item = iter.front();

Просмотреть файл

@ -65,12 +65,9 @@ struct AllocationIntegrityState
InstructionInfo(const InstructionInfo &o) InstructionInfo(const InstructionInfo &o)
{ {
for (size_t i = 0; i < o.inputs.length(); i++) inputs.append(o.inputs);
inputs.append(o.inputs[i]); temps.append(o.temps);
for (size_t i = 0; i < o.temps.length(); i++) outputs.append(o.outputs);
temps.append(o.temps[i]);
for (size_t i = 0; i < o.outputs.length(); i++)
outputs.append(o.outputs[i]);
} }
}; };
Vector<InstructionInfo, 0, SystemAllocPolicy> instructions; Vector<InstructionInfo, 0, SystemAllocPolicy> instructions;
@ -79,8 +76,7 @@ struct AllocationIntegrityState
Vector<InstructionInfo, 5, SystemAllocPolicy> phis; Vector<InstructionInfo, 5, SystemAllocPolicy> phis;
BlockInfo() {} BlockInfo() {}
BlockInfo(const BlockInfo &o) { BlockInfo(const BlockInfo &o) {
for (size_t i = 0; i < o.phis.length(); i++) phis.append(o.phis);
phis.append(o.phis[i]);
} }
}; };
Vector<BlockInfo, 0, SystemAllocPolicy> blocks; Vector<BlockInfo, 0, SystemAllocPolicy> blocks;

Просмотреть файл

@ -46,10 +46,8 @@ StupidAllocator::init()
if (!RegisterAllocator::init()) if (!RegisterAllocator::init())
return false; return false;
if (!virtualRegisters.reserve(graph.numVirtualRegisters())) if (!virtualRegisters.appendN((LDefinition *)NULL, graph.numVirtualRegisters()))
return false; return false;
for (size_t i = 0; i < graph.numVirtualRegisters(); i++)
virtualRegisters.infallibleAppend((LDefinition *)NULL);
for (size_t i = 0; i < graph.numBlocks(); i++) { for (size_t i = 0; i < graph.numBlocks(); i++) {
LBlock *block = graph.getBlock(i); LBlock *block = graph.getBlock(i);

Просмотреть файл

@ -366,10 +366,9 @@ ValueNumberer::eliminateRedundancies()
IonSpew(IonSpew_GVN, "Looking at block %d", block->id()); IonSpew(IonSpew_GVN, "Looking at block %d", block->id());
// Add all immediate dominators to the front of the worklist. // Add all immediate dominators to the front of the worklist.
for (size_t i = 0; i < block->numImmediatelyDominatedBlocks(); i++) { if (!worklist.append(block->immediatelyDominatedBlocksBegin(),
if (!worklist.append(block->getImmediatelyDominatedBlock(i))) block->immediatelyDominatedBlocksEnd()))
return false; return false;
}
// For each instruction, attempt to look up a dominating definition. // For each instruction, attempt to look up a dominating definition.
for (MDefinitionIterator iter(block); iter; ) { for (MDefinitionIterator iter(block); iter; ) {

Просмотреть файл

@ -344,10 +344,10 @@ class IonOOLPropertyOpExitFrameLayout
IonExitFooterFrame footer_; IonExitFooterFrame footer_;
IonExitFrameLayout exit_; IonExitFrameLayout exit_;
// Object for JSHandleObject // Object for HandleObject
JSObject *obj_; JSObject *obj_;
// id for JSHandleId // id for HandleId
jsid id_; jsid id_;
// space for MutableHandleValue result // space for MutableHandleValue result
@ -392,10 +392,10 @@ class IonOOLProxyGetExitFrameLayout
// The proxy object. // The proxy object.
JSObject *proxy_; JSObject *proxy_;
// Object for JSHandleObject // Object for HandleObject
JSObject *receiver_; JSObject *receiver_;
// id for JSHandleId // id for HandleId
jsid id_; jsid id_;
// space for MutableHandleValue result // space for MutableHandleValue result

Просмотреть файл

@ -308,10 +308,10 @@ class IonOOLPropertyOpExitFrameLayout
IonExitFooterFrame footer_; IonExitFooterFrame footer_;
IonExitFrameLayout exit_; IonExitFrameLayout exit_;
// Object for JSHandleObject // Object for HandleObject
JSObject *obj_; JSObject *obj_;
// id for JSHandleId // id for HandleId
jsid id_; jsid id_;
// space for MutableHandleValue result // space for MutableHandleValue result
@ -356,10 +356,10 @@ class IonOOLProxyGetExitFrameLayout
// The proxy object. // The proxy object.
JSObject *proxy_; JSObject *proxy_;
// Object for JSHandleObject // Object for HandleObject
JSObject *receiver_; JSObject *receiver_;
// id for JSHandleId // id for HandleId
jsid id_; jsid id_;
// space for MutableHandleValue result // space for MutableHandleValue result

Просмотреть файл

@ -1,5 +1,13 @@
// no 'arguments' binding in arrow functions // arrow functions have an 'arguments' binding, like any other function
var arguments = []; var arguments = [];
var f = () => arguments; var f = () => arguments;
assertEq(f(), arguments); var args = f();
assertEq(args.length, 0);
assertEq(Object.getPrototypeOf(args), Object.prototype);
args = f(true, false);
assertEq(args.length, 2);
assertEq(args[0], true);
assertEq(args[1], false);

Просмотреть файл

@ -1,9 +1,14 @@
// 'arguments' is lexically scoped in arrow functions // 'arguments' in arrow functions nested in other functions
var args, g; var g;
function f() { function f() {
g = () => arguments; g = () => arguments;
args = arguments;
} }
f(); f();
assertEq(g(), args); var args = g();
assertEq(args.length, 0);
args = g(1, 2, 3);
assertEq(args.length, 3);
assertEq(args[0], 1);
assertEq(args[2], 3);

Просмотреть файл

@ -1,9 +1,13 @@
// 'arguments' in eval // the 'arguments' binding in an arrow function is visible in direct eval code
function f() { function f() {
var g = s => eval(s); return s => eval(s);
assertEq(g("arguments"), arguments);
} }
f(); var g = f();
f(0, 1, 2); var args = g("arguments");
assertEq(typeof args, "object");
assertEq(args !== g("arguments"), true);
assertEq(args.length, 1);
assertEq(args[0], "arguments");

Просмотреть файл

@ -1,10 +1,13 @@
// 'arguments' is banned in a function with a rest param, even nested in an arrow-function // 'arguments' is banned in a function with a rest param,
// even nested in an arrow-function parameter default value
load(libdir + "asserts.js"); load(libdir + "asserts.js");
var mistakes = [ var mistakes = [
"function f(...rest) { return x => arguments; }", "(...rest) => arguments",
"function f(...rest) { return (x=arguments) => 0; }" "(...rest) => (x=arguments) => 0",
"function f(...rest) { return (x=arguments) => 0; }",
"function f(...rest) { return (x=(y=arguments) => 1) => 0; }",
]; ];
for (var s of mistakes) for (var s of mistakes)

Просмотреть файл

@ -0,0 +1,3 @@
(function() {
a = (b => eval("0; [arguments]"))();
})();

Просмотреть файл

@ -0,0 +1,4 @@
(function() {
a = (b => eval("arguments"))();
})(1, 2, 3, 4);
assertEq(a.length, 0);

Просмотреть файл

@ -1,13 +1,13 @@
// arrow functions are implicitly strict-mode code // arrow functions are not implicitly strict-mode code
load(libdir + "asserts.js"); load(libdir + "asserts.js");
assertThrowsInstanceOf( var f = a => { with (a) return f(); };
function () { Function("a => { with (a) f(); }"); }, assertEq(f({f: () => 7}), 7);
SyntaxError);
assertThrowsInstanceOf( f = a => function () { with (a) return f(); };
function () { Function("a => function () { with (a) f(); }"); }, assertEq(f({f: () => 7})(), 7);
SyntaxError);
f = (a = {x: 1, x: 2}) => b => { "use strict"; return a.x; };
assertEq(f()(0), 2);

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше