Merge mozilla-central and inbound

This commit is contained in:
Ed Morley 2013-06-21 15:45:08 +01:00
commit 4b7c34d87b
141 changed files with 1301 additions and 2229 deletions

View File

@ -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.

View File

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

View File

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

View File

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

View File

@ -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.

View File

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

View File

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

View File

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

View File

@ -603,9 +603,9 @@ 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;
nsresult rv = info->IsTypeSupported(aMimeType, webNav, &supported); nsresult rv = info->IsTypeSupported(aMimeType, webNav, &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

View File

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

View File

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

View File

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

View File

@ -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.

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -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()) {

View File

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

View File

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

View File

@ -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()) {

View File

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

View File

@ -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.

View File

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

View File

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

View File

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

View File

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

View File

@ -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,

View File

@ -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!");
} }

View File

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

View File

@ -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;
@ -159,4 +159,4 @@ protected:
END_INDEXEDDB_NAMESPACE END_INDEXEDDB_NAMESPACE
#endif // mozilla_dom_indexeddb_opendatabasehelper_h__ #endif // mozilla_dom_indexeddb_opendatabasehelper_h__

View File

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

View File

@ -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,

View File

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

View File

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

View File

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

View File

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

View File

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

View 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) {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -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,

View File

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

View File

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

View File

@ -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. "

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -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_;
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -50,7 +50,7 @@ static JSClass DocumentAllClass = {
}; };
JSBool JSBool
document_resolve(JSContext *cx, JSHandleObject obj, JSHandleId id, unsigned flags, document_resolve(JSContext *cx, JS::HandleObject obj, JS::HandleId id, unsigned flags,
JS::MutableHandleObject objp) JS::MutableHandleObject objp)
{ {
// If id is "all", resolve document.all=true. // If id is "all", resolve document.all=true.

View File

@ -69,7 +69,7 @@ struct AutoIncrCounters {
}; };
bool bool
doResolve(JSHandleObject obj, JSHandleId id, unsigned flags, JS::MutableHandleObject objp) doResolve(JS::HandleObject obj, JS::HandleId id, unsigned flags, JS::MutableHandleObject objp)
{ {
CHECK_EQUAL(resolveExitCount, 0); CHECK_EQUAL(resolveExitCount, 0);
AutoIncrCounters incr(this); AutoIncrCounters incr(this);
@ -127,7 +127,7 @@ doResolve(JSHandleObject obj, JSHandleId id, unsigned flags, JS::MutableHandleOb
} }
static JSBool static JSBool
my_resolve(JSContext *cx, JSHandleObject obj, JSHandleId id, unsigned flags, my_resolve(JSContext *cx, JS::HandleObject obj, JS::HandleId id, unsigned flags,
JS::MutableHandleObject objp) JS::MutableHandleObject objp)
{ {
return static_cast<cls_testResolveRecursion *>(JS_GetPrivate(obj))-> return static_cast<cls_testResolveRecursion *>(JS_GetPrivate(obj))->

View File

@ -963,9 +963,6 @@ JSRuntime::init(uint32_t maxbytes)
dateTimeInfo.updateTimeZoneAdjustment(); dateTimeInfo.updateTimeZoneAdjustment();
if (!stackSpace.init())
return false;
if (!scriptDataTable.init()) if (!scriptDataTable.init())
return false; return false;
@ -3078,38 +3075,38 @@ JS_DefaultValue(JSContext *cx, JSObject *objArg, JSType hint, jsval *vp)
} }
JS_PUBLIC_API(JSBool) JS_PUBLIC_API(JSBool)
JS_PropertyStub(JSContext *cx, JSHandleObject obj, JSHandleId id, MutableHandleValue vp) JS_PropertyStub(JSContext *cx, HandleObject obj, HandleId id, MutableHandleValue vp)
{ {
return JS_TRUE; return JS_TRUE;
} }
JS_PUBLIC_API(JSBool) JS_PUBLIC_API(JSBool)
JS_StrictPropertyStub(JSContext *cx, JSHandleObject obj, JSHandleId id, JSBool strict, MutableHandleValue vp) JS_StrictPropertyStub(JSContext *cx, HandleObject obj, HandleId id, JSBool strict, MutableHandleValue vp)
{ {
return JS_TRUE; return JS_TRUE;
} }
JS_PUBLIC_API(JSBool) JS_PUBLIC_API(JSBool)
JS_DeletePropertyStub(JSContext *cx, JSHandleObject obj, JSHandleId id, JSBool *succeeded) JS_DeletePropertyStub(JSContext *cx, HandleObject obj, HandleId id, JSBool *succeeded)
{ {
*succeeded = true; *succeeded = true;
return true; return true;
} }
JS_PUBLIC_API(JSBool) JS_PUBLIC_API(JSBool)
JS_EnumerateStub(JSContext *cx, JSHandleObject obj) JS_EnumerateStub(JSContext *cx, HandleObject obj)
{ {
return JS_TRUE; return JS_TRUE;
} }
JS_PUBLIC_API(JSBool) JS_PUBLIC_API(JSBool)
JS_ResolveStub(JSContext *cx, JSHandleObject obj, JSHandleId id) JS_ResolveStub(JSContext *cx, HandleObject obj, HandleId id)
{ {
return JS_TRUE; return JS_TRUE;
} }
JS_PUBLIC_API(JSBool) JS_PUBLIC_API(JSBool)
JS_ConvertStub(JSContext *cx, JSHandleObject obj, JSType type, MutableHandleValue vp) JS_ConvertStub(JSContext *cx, HandleObject obj, JSType type, MutableHandleValue vp)
{ {
JS_ASSERT(type != JSTYPE_OBJECT && type != JSTYPE_FUNCTION); JS_ASSERT(type != JSTYPE_OBJECT && type != JSTYPE_FUNCTION);
JS_ASSERT(obj); JS_ASSERT(obj);
@ -3801,7 +3798,7 @@ JS_DefineElement(JSContext *cx, JSObject *objArg, uint32_t index, jsval valueArg
} }
static JSBool static JSBool
DefineProperty(JSContext *cx, JSHandleObject obj, const char *name, const Value &value_, DefineProperty(JSContext *cx, HandleObject obj, const char *name, const Value &value_,
const JSPropertyOpWrapper &getter, const JSStrictPropertyOpWrapper &setter, const JSPropertyOpWrapper &getter, const JSStrictPropertyOpWrapper &setter,
unsigned attrs, unsigned flags, int tinyid) unsigned attrs, unsigned flags, int tinyid)
{ {
@ -3844,7 +3841,7 @@ JS_DefinePropertyWithTinyId(JSContext *cx, JSObject *objArg, const char *name, i
} }
static JSBool static JSBool
DefineUCProperty(JSContext *cx, JSHandleObject obj, const jschar *name, size_t namelen, DefineUCProperty(JSContext *cx, HandleObject obj, const jschar *name, size_t namelen,
const Value &value_, PropertyOp getter, StrictPropertyOp setter, unsigned attrs, const Value &value_, PropertyOp getter, StrictPropertyOp setter, unsigned attrs,
unsigned flags, int tinyid) unsigned flags, int tinyid)
{ {
@ -5784,8 +5781,8 @@ JS_New(JSContext *cx, JSObject *ctorArg, unsigned argc, jsval *argv)
// is not a simple variation of JSOP_CALL. We have to determine what class // is not a simple variation of JSOP_CALL. We have to determine what class
// of object to create, create it, and clamp the return value to an object, // of object to create, create it, and clamp the return value to an object,
// among other details. InvokeConstructor does the hard work. // among other details. InvokeConstructor does the hard work.
InvokeArgsGuard args; InvokeArgs args(cx);
if (!cx->stack.pushInvokeArgs(cx, argc, &args)) if (!args.init(argc))
return NULL; return NULL;
args.setCallee(ObjectValue(*ctor)); args.setCallee(ObjectValue(*ctor));

View File

@ -713,11 +713,6 @@ CallNonGenericMethod(JSContext *cx, IsAcceptableThis Test, NativeImpl Impl, Call
/************************************************************************/ /************************************************************************/
typedef JS::Handle<JSObject*> JSHandleObject;
typedef JS::Handle<JSString*> JSHandleString;
typedef JS::Handle<JS::Value> JSHandleValue;
typedef JS::Handle<jsid> JSHandleId;
/* JSClass operation signatures. */ /* JSClass operation signatures. */
/* /*
@ -726,7 +721,7 @@ typedef JS::Handle<jsid> JSHandleId;
* *vp out parameter, on success, is the new property value after the action. * *vp out parameter, on success, is the new property value after the action.
*/ */
typedef JSBool typedef JSBool
(* JSPropertyOp)(JSContext *cx, JSHandleObject obj, JSHandleId id, JS::MutableHandle<JS::Value> vp); (* JSPropertyOp)(JSContext *cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JS::MutableHandle<JS::Value> vp);
/* /*
* Set a property named by id in obj, treating the assignment as strict * Set a property named by id in obj, treating the assignment as strict
@ -736,7 +731,7 @@ typedef JSBool
* set. * set.
*/ */
typedef JSBool typedef JSBool
(* JSStrictPropertyOp)(JSContext *cx, JSHandleObject obj, JSHandleId id, JSBool strict, JS::MutableHandle<JS::Value> vp); (* JSStrictPropertyOp)(JSContext *cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JSBool strict, JS::MutableHandle<JS::Value> vp);
/* /*
* Delete a property named by id in obj. * Delete a property named by id in obj.
@ -754,7 +749,7 @@ typedef JSBool
* set *succeeded to true and return true. * set *succeeded to true and return true.
*/ */
typedef JSBool typedef JSBool
(* JSDeletePropertyOp)(JSContext *cx, JSHandleObject obj, JSHandleId id, JSBool *succeeded); (* JSDeletePropertyOp)(JSContext *cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JSBool *succeeded);
/* /*
* This function type is used for callbacks that enumerate the properties of * This function type is used for callbacks that enumerate the properties of
@ -789,7 +784,7 @@ typedef JSBool
* indicating failure. * indicating failure.
*/ */
typedef JSBool typedef JSBool
(* JSNewEnumerateOp)(JSContext *cx, JSHandleObject obj, JSIterateOp enum_op, (* JSNewEnumerateOp)(JSContext *cx, JS::Handle<JSObject*> obj, JSIterateOp enum_op,
JS::MutableHandle<JS::Value> statep, JS::MutableHandleId idp); JS::MutableHandle<JS::Value> statep, JS::MutableHandleId idp);
/* /*
@ -797,7 +792,7 @@ typedef JSBool
* yet reflected in obj. * yet reflected in obj.
*/ */
typedef JSBool typedef JSBool
(* JSEnumerateOp)(JSContext *cx, JSHandleObject obj); (* JSEnumerateOp)(JSContext *cx, JS::Handle<JSObject*> obj);
/* /*
* Resolve a lazy property named by id in obj by defining it directly in obj. * Resolve a lazy property named by id in obj by defining it directly in obj.
@ -812,7 +807,7 @@ typedef JSBool
* NB: JSNewResolveOp provides a cheaper way to resolve lazy properties. * NB: JSNewResolveOp provides a cheaper way to resolve lazy properties.
*/ */
typedef JSBool typedef JSBool
(* JSResolveOp)(JSContext *cx, JSHandleObject obj, JSHandleId id); (* JSResolveOp)(JSContext *cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id);
/* /*
* Like JSResolveOp, but flags provide contextual information as follows: * Like JSResolveOp, but flags provide contextual information as follows:
@ -827,7 +822,7 @@ typedef JSBool
* if JSCLASS_NEW_RESOLVE is set in JSClass.flags. * if JSCLASS_NEW_RESOLVE is set in JSClass.flags.
*/ */
typedef JSBool typedef JSBool
(* JSNewResolveOp)(JSContext *cx, JSHandleObject obj, JSHandleId id, unsigned flags, (* JSNewResolveOp)(JSContext *cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, unsigned flags,
JS::MutableHandleObject objp); JS::MutableHandleObject objp);
/* /*
@ -835,7 +830,8 @@ typedef JSBool
* *vp on success, and returning false on error or exception. * *vp on success, and returning false on error or exception.
*/ */
typedef JSBool typedef JSBool
(* JSConvertOp)(JSContext *cx, JSHandleObject obj, JSType type, JS::MutableHandle<JS::Value> vp); (* JSConvertOp)(JSContext *cx, JS::Handle<JSObject*> obj, JSType type,
JS::MutableHandle<JS::Value> vp);
typedef struct JSFreeOp JSFreeOp; typedef struct JSFreeOp JSFreeOp;
@ -877,8 +873,8 @@ struct JSStringFinalizer {
* is either a string or an int jsval. * is either a string or an int jsval.
*/ */
typedef JSBool typedef JSBool
(* JSCheckAccessOp)(JSContext *cx, JSHandleObject obj, JSHandleId id, JSAccessMode mode, (* JSCheckAccessOp)(JSContext *cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id,
JS::MutableHandle<JS::Value> vp); JSAccessMode mode, JS::MutableHandle<JS::Value> vp);
/* /*
* Check whether v is an instance of obj. Return false on error or exception, * Check whether v is an instance of obj. Return false on error or exception,
@ -886,7 +882,8 @@ typedef JSBool
* *bp otherwise. * *bp otherwise.
*/ */
typedef JSBool typedef JSBool
(* JSHasInstanceOp)(JSContext *cx, JSHandleObject obj, JS::MutableHandle<JS::Value> vp, JSBool *bp); (* JSHasInstanceOp)(JSContext *cx, JS::Handle<JSObject*> obj, JS::MutableHandle<JS::Value> vp,
JSBool *bp);
/* /*
* Function type for trace operation of the class called to enumerate all * Function type for trace operation of the class called to enumerate all
@ -1026,13 +1023,15 @@ typedef const JSErrorFormatString *
const unsigned errorNumber); const unsigned errorNumber);
typedef JSBool typedef JSBool
(* JSLocaleToUpperCase)(JSContext *cx, JSHandleString src, JS::MutableHandle<JS::Value> rval); (* JSLocaleToUpperCase)(JSContext *cx, JS::Handle<JSString*> src,
JS::MutableHandle<JS::Value> rval);
typedef JSBool typedef JSBool
(* JSLocaleToLowerCase)(JSContext *cx, JSHandleString src, JS::MutableHandle<JS::Value> rval); (* JSLocaleToLowerCase)(JSContext *cx, JS::Handle<JSString*> src,
JS::MutableHandle<JS::Value> rval);
typedef JSBool typedef JSBool
(* JSLocaleCompare)(JSContext *cx, JSHandleString src1, JSHandleString src2, (* JSLocaleCompare)(JSContext *cx, JS::Handle<JSString*> src1, JS::Handle<JSString*> src2,
JS::MutableHandle<JS::Value> rval); JS::MutableHandle<JS::Value> rval);
typedef JSBool typedef JSBool
@ -2961,22 +2960,26 @@ extern JS_PUBLIC_API(JSBool)
JS_DefaultValue(JSContext *cx, JSObject *obj, JSType hint, jsval *vp); JS_DefaultValue(JSContext *cx, JSObject *obj, JSType hint, jsval *vp);
extern JS_PUBLIC_API(JSBool) extern JS_PUBLIC_API(JSBool)
JS_PropertyStub(JSContext *cx, JSHandleObject obj, JSHandleId id, JS::MutableHandle<JS::Value> vp); JS_PropertyStub(JSContext *cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id,
JS::MutableHandle<JS::Value> vp);
extern JS_PUBLIC_API(JSBool) extern JS_PUBLIC_API(JSBool)
JS_StrictPropertyStub(JSContext *cx, JSHandleObject obj, JSHandleId id, JSBool strict, JS::MutableHandle<JS::Value> vp); JS_StrictPropertyStub(JSContext *cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JSBool strict,
JS::MutableHandle<JS::Value> vp);
extern JS_PUBLIC_API(JSBool) extern JS_PUBLIC_API(JSBool)
JS_DeletePropertyStub(JSContext *cx, JSHandleObject obj, JSHandleId id, JSBool *succeeded); JS_DeletePropertyStub(JSContext *cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id,
JSBool *succeeded);
extern JS_PUBLIC_API(JSBool) extern JS_PUBLIC_API(JSBool)
JS_EnumerateStub(JSContext *cx, JSHandleObject obj); JS_EnumerateStub(JSContext *cx, JS::Handle<JSObject*> obj);
extern JS_PUBLIC_API(JSBool) extern JS_PUBLIC_API(JSBool)
JS_ResolveStub(JSContext *cx, JSHandleObject obj, JSHandleId id); JS_ResolveStub(JSContext *cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id);
extern JS_PUBLIC_API(JSBool) extern JS_PUBLIC_API(JSBool)
JS_ConvertStub(JSContext *cx, JSHandleObject obj, JSType type, JS::MutableHandle<JS::Value> vp); JS_ConvertStub(JSContext *cx, JS::Handle<JSObject*> obj, JSType type,
JS::MutableHandle<JS::Value> vp);
struct JSConstDoubleSpec { struct JSConstDoubleSpec {
double dval; double dval;
@ -3915,26 +3918,26 @@ struct JS_PUBLIC_API(CompileOptions) {
}; };
extern JS_PUBLIC_API(JSScript *) extern JS_PUBLIC_API(JSScript *)
Compile(JSContext *cx, JSHandleObject obj, CompileOptions options, Compile(JSContext *cx, JS::Handle<JSObject*> obj, CompileOptions options,
const char *bytes, size_t length); const char *bytes, size_t length);
extern JS_PUBLIC_API(JSScript *) extern JS_PUBLIC_API(JSScript *)
Compile(JSContext *cx, JSHandleObject obj, CompileOptions options, Compile(JSContext *cx, JS::Handle<JSObject*> obj, CompileOptions options,
const jschar *chars, size_t length); const jschar *chars, size_t length);
extern JS_PUBLIC_API(JSScript *) extern JS_PUBLIC_API(JSScript *)
Compile(JSContext *cx, JSHandleObject obj, CompileOptions options, FILE *file); Compile(JSContext *cx, JS::Handle<JSObject*> obj, CompileOptions options, FILE *file);
extern JS_PUBLIC_API(JSScript *) extern JS_PUBLIC_API(JSScript *)
Compile(JSContext *cx, JSHandleObject obj, CompileOptions options, const char *filename); Compile(JSContext *cx, JS::Handle<JSObject*> obj, CompileOptions options, const char *filename);
extern JS_PUBLIC_API(JSFunction *) extern JS_PUBLIC_API(JSFunction *)
CompileFunction(JSContext *cx, JSHandleObject obj, CompileOptions options, CompileFunction(JSContext *cx, JS::Handle<JSObject*> obj, CompileOptions options,
const char *name, unsigned nargs, const char **argnames, const char *name, unsigned nargs, const char **argnames,
const char *bytes, size_t length); const char *bytes, size_t length);
extern JS_PUBLIC_API(JSFunction *) extern JS_PUBLIC_API(JSFunction *)
CompileFunction(JSContext *cx, JSHandleObject obj, CompileOptions options, CompileFunction(JSContext *cx, JS::Handle<JSObject*> obj, CompileOptions options,
const char *name, unsigned nargs, const char **argnames, const char *name, unsigned nargs, const char **argnames,
const jschar *chars, size_t length); const jschar *chars, size_t length);
@ -4062,15 +4065,15 @@ JS_EvaluateUCScriptForPrincipalsVersionOrigin(JSContext *cx, JSObject *obj,
namespace JS { namespace JS {
extern JS_PUBLIC_API(bool) extern JS_PUBLIC_API(bool)
Evaluate(JSContext *cx, JSHandleObject obj, CompileOptions options, Evaluate(JSContext *cx, JS::Handle<JSObject*> obj, CompileOptions options,
const jschar *chars, size_t length, jsval *rval); const jschar *chars, size_t length, jsval *rval);
extern JS_PUBLIC_API(bool) extern JS_PUBLIC_API(bool)
Evaluate(JSContext *cx, JSHandleObject obj, CompileOptions options, Evaluate(JSContext *cx, JS::Handle<JSObject*> obj, CompileOptions options,
const char *bytes, size_t length, jsval *rval); const char *bytes, size_t length, jsval *rval);
extern JS_PUBLIC_API(bool) extern JS_PUBLIC_API(bool)
Evaluate(JSContext *cx, JSHandleObject obj, CompileOptions options, Evaluate(JSContext *cx, JS::Handle<JSObject*> obj, CompileOptions options,
const char *filename, jsval *rval); const char *filename, jsval *rval);
} /* namespace JS */ } /* namespace JS */

View File

@ -1009,17 +1009,17 @@ array_toString(JSContext *cx, unsigned argc, Value *vp)
return true; return true;
} }
InvokeArgsGuard ag; InvokeArgs args2(cx);
if (!cx->stack.pushInvokeArgs(cx, 0, &ag)) if (!args2.init(0))
return false; return false;
ag.setCallee(join); args2.setCallee(join);
ag.setThis(ObjectValue(*obj)); args2.setThis(ObjectValue(*obj));
/* Do the call. */ /* Do the call. */
if (!Invoke(cx, ag)) if (!Invoke(cx, args2))
return false; return false;
args.rval().set(ag.rval()); args.rval().set(args2.rval());
return true; return true;
} }
@ -1421,20 +1421,20 @@ SortComparatorFunction::operator()(const Value &a, const Value &b, bool *lessOrE
if (!JS_CHECK_OPERATION_LIMIT(cx)) if (!JS_CHECK_OPERATION_LIMIT(cx))
return false; return false;
InvokeArgsGuard &ag = fig.args(); InvokeArgs &args = fig.args();
if (!ag.pushed() && !cx->stack.pushInvokeArgs(cx, 2, &ag)) if (!args.init(2))
return false; return false;
ag.setCallee(fval); args.setCallee(fval);
ag.setThis(UndefinedValue()); args.setThis(UndefinedValue());
ag[0] = a; args[0] = a;
ag[1] = b; args[1] = b;
if (!fig.invoke(cx)) if (!fig.invoke(cx))
return false; return false;
double cmp; double cmp;
if (!ToNumber(cx, ag.rval(), &cmp)) if (!ToNumber(cx, args.rval(), &cmp))
return false; return false;
/* /*
@ -2637,7 +2637,7 @@ array_filter(JSContext *cx, unsigned argc, Value *vp)
/* Step 9. */ /* Step 9. */
JS_ASSERT(!InParallelSection()); JS_ASSERT(!InParallelSection());
FastInvokeGuard fig(cx, ObjectValue(*callable)); FastInvokeGuard fig(cx, ObjectValue(*callable));
InvokeArgsGuard &ag = fig.args(); InvokeArgs &args2 = fig.args();
RootedValue kValue(cx); RootedValue kValue(cx);
while (k < len) { while (k < len) {
if (!JS_CHECK_OPERATION_LIMIT(cx)) if (!JS_CHECK_OPERATION_LIMIT(cx))
@ -2650,17 +2650,17 @@ array_filter(JSContext *cx, unsigned argc, Value *vp)
/* Step c.ii-iii. */ /* Step c.ii-iii. */
if (!kNotPresent) { if (!kNotPresent) {
if (!ag.pushed() && !cx->stack.pushInvokeArgs(cx, 3, &ag)) if (!args2.init(3))
return false; return false;
ag.setCallee(ObjectValue(*callable)); args2.setCallee(ObjectValue(*callable));
ag.setThis(thisv); args2.setThis(thisv);
ag[0] = kValue; args2[0] = kValue;
ag[1] = NumberValue(k); args2[1] = NumberValue(k);
ag[2] = ObjectValue(*obj); args2[2] = ObjectValue(*obj);
if (!fig.invoke(cx)) if (!fig.invoke(cx))
return false; return false;
if (ToBoolean(ag.rval())) { if (ToBoolean(args2.rval())) {
if (!SetArrayElement(cx, arr, to, kValue)) if (!SetArrayElement(cx, arr, to, kValue))
return false; return false;
to++; to++;

View File

@ -598,7 +598,7 @@ JSStructuredCloneWriter::writeTypedArray(HandleObject arr)
} }
bool bool
JSStructuredCloneWriter::writeArrayBuffer(JSHandleObject obj) JSStructuredCloneWriter::writeArrayBuffer(HandleObject obj)
{ {
ArrayBufferObject &buffer = obj->as<ArrayBufferObject>(); ArrayBufferObject &buffer = obj->as<ArrayBufferObject>();
return out.writePair(SCTAG_ARRAY_BUFFER_OBJECT, buffer.byteLength()) && return out.writePair(SCTAG_ARRAY_BUFFER_OBJECT, buffer.byteLength()) &&
@ -606,7 +606,7 @@ JSStructuredCloneWriter::writeArrayBuffer(JSHandleObject obj)
} }
bool bool
JSStructuredCloneWriter::startObject(JSHandleObject obj, bool *backref) JSStructuredCloneWriter::startObject(HandleObject obj, bool *backref)
{ {
/* Handle cycles in the object graph. */ /* Handle cycles in the object graph. */
CloneMemory::AddPtr p = memory.lookupForAdd(obj); CloneMemory::AddPtr p = memory.lookupForAdd(obj);
@ -625,7 +625,7 @@ JSStructuredCloneWriter::startObject(JSHandleObject obj, bool *backref)
} }
bool bool
JSStructuredCloneWriter::traverseObject(JSHandleObject obj) JSStructuredCloneWriter::traverseObject(HandleObject obj)
{ {
/* /*
* Get enumerable property ids and put them in reverse order so that they * Get enumerable property ids and put them in reverse order so that they

View File

@ -159,11 +159,11 @@ struct JSStructuredCloneWriter {
bool writeString(uint32_t tag, JSString *str); bool writeString(uint32_t tag, JSString *str);
bool writeId(jsid id); bool writeId(jsid id);
bool writeArrayBuffer(JSHandleObject obj); bool writeArrayBuffer(JS::HandleObject obj);
bool writeTypedArray(JSHandleObject obj); bool writeTypedArray(JS::HandleObject obj);
bool startObject(JSHandleObject obj, bool *backref); bool startObject(JS::HandleObject obj, bool *backref);
bool startWrite(const js::Value &v); bool startWrite(const js::Value &v);
bool traverseObject(JSHandleObject obj); bool traverseObject(JS::HandleObject obj);
bool parseTransferable(); bool parseTransferable();
void reportErrorTransferable(); void reportErrorTransferable();

View File

@ -126,7 +126,7 @@ JSRuntime::sizeOfIncludingThis(JSMallocSizeOfFun mallocSizeOf, JS::RuntimeSizes
rtSizes->regexpData = bumpAlloc_ ? bumpAlloc_->sizeOfNonHeapData() : 0; rtSizes->regexpData = bumpAlloc_ ? bumpAlloc_->sizeOfNonHeapData() : 0;
rtSizes->stack = stackSpace.sizeOf(); rtSizes->interpreterStack = interpreterStack_.sizeOfExcludingThis(mallocSizeOf);
rtSizes->gcMarker = gcMarker.sizeOfExcludingThis(mallocSizeOf); rtSizes->gcMarker = gcMarker.sizeOfExcludingThis(mallocSizeOf);
@ -560,7 +560,7 @@ checkReportFlags(JSContext *cx, unsigned *flags)
* otherwise. We assume that if the top frame is a native, then it is * otherwise. We assume that if the top frame is a native, then it is
* strict if the nearest scripted frame is strict, see bug 536306. * strict if the nearest scripted frame is strict, see bug 536306.
*/ */
JSScript *script = cx->stack.currentScript(); JSScript *script = cx->currentScript();
if (script && script->strict) if (script && script->strict)
*flags &= ~JSREPORT_WARNING; *flags &= ~JSREPORT_WARNING;
else if (cx->hasExtraWarningsOption()) else if (cx->hasExtraWarningsOption())
@ -1179,7 +1179,6 @@ JSContext::JSContext(JSRuntime *rt)
enterCompartmentDepth_(0), enterCompartmentDepth_(0),
savedFrameChains_(), savedFrameChains_(),
defaultCompartmentObject_(NULL), defaultCompartmentObject_(NULL),
stack(thisDuringConstruction()),
cycleDetectorSet(thisDuringConstruction()), cycleDetectorSet(thisDuringConstruction()),
errorReporter(NULL), errorReporter(NULL),
operationCallback(NULL), operationCallback(NULL),
@ -1302,14 +1301,9 @@ JSContext::runningWithTrustedPrincipals() const
bool bool
JSContext::saveFrameChain() JSContext::saveFrameChain()
{ {
if (!stack.saveFrameChain()) if (!savedFrameChains_.append(SavedFrameChain(compartment(), enterCompartmentDepth_)))
return false; return false;
if (!savedFrameChains_.append(SavedFrameChain(compartment(), enterCompartmentDepth_))) {
stack.restoreFrameChain();
return false;
}
if (Activation *act = mainThread().activation()) if (Activation *act = mainThread().activation())
act->saveFrameChain(); act->saveFrameChain();
@ -1331,8 +1325,6 @@ JSContext::restoreFrameChain()
setCompartment(sfc.compartment); setCompartment(sfc.compartment);
enterCompartmentDepth_ = sfc.enterCompartmentCount; enterCompartmentDepth_ = sfc.enterCompartmentCount;
stack.restoreFrameChain();
if (Activation *act = mainThread().activation()) if (Activation *act = mainThread().activation())
act->restoreFrameChain(); act->restoreFrameChain();
@ -1532,7 +1524,7 @@ JSContext::findVersion() const
if (hasVersionOverride) if (hasVersionOverride)
return versionOverride; return versionOverride;
if (JSScript *script = stack.currentScript(NULL, js::ContextStack::ALLOW_CROSS_COMPARTMENT)) if (JSScript *script = currentScript(NULL, ALLOW_CROSS_COMPARTMENT))
return script->getVersion(); return script->getVersion();
return defaultVersion; return defaultVersion;

View File

@ -726,9 +726,6 @@ struct JSRuntime : public JS::shadow::Runtime,
void assertValidThread() const {} void assertValidThread() const {}
#endif #endif
/* Keeper of the contiguous stack used by all contexts in this thread. */
js::StackSpace stackSpace;
/* Temporary arena pool used while compiling and decompiling. */ /* Temporary arena pool used while compiling and decompiling. */
static const size_t TEMP_LIFO_ALLOC_PRIMARY_CHUNK_SIZE = 4 * 1024; static const size_t TEMP_LIFO_ALLOC_PRIMARY_CHUNK_SIZE = 4 * 1024;
js::LifoAlloc tempLifoAlloc; js::LifoAlloc tempLifoAlloc;
@ -750,6 +747,9 @@ struct JSRuntime : public JS::shadow::Runtime,
JSObject *selfHostingGlobal_; JSObject *selfHostingGlobal_;
/* Space for interpreter frames. */
js::InterpreterStack interpreterStack_;
JSC::ExecutableAllocator *createExecutableAllocator(JSContext *cx); JSC::ExecutableAllocator *createExecutableAllocator(JSContext *cx);
WTF::BumpPointerAllocator *createBumpPointerAllocator(JSContext *cx); WTF::BumpPointerAllocator *createBumpPointerAllocator(JSContext *cx);
js::ion::IonRuntime *createIonRuntime(JSContext *cx); js::ion::IonRuntime *createIonRuntime(JSContext *cx);
@ -777,6 +777,9 @@ struct JSRuntime : public JS::shadow::Runtime,
bool hasIonRuntime() const { bool hasIonRuntime() const {
return !!ionRuntime_; return !!ionRuntime_;
} }
js::InterpreterStack &interpreterStack() {
return interpreterStack_;
}
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
// Self-hosting support // Self-hosting support
@ -1686,9 +1689,6 @@ struct JSContext : js::ThreadSafeContext,
inline void setDefaultCompartmentObjectIfUnset(JSObject *obj); inline void setDefaultCompartmentObjectIfUnset(JSObject *obj);
JSObject *maybeDefaultCompartmentObject() const { return defaultCompartmentObject_; } JSObject *maybeDefaultCompartmentObject() const { return defaultCompartmentObject_; }
/* Current execution stack. */
js::ContextStack stack;
/* /*
* Current global. This is only safe to use within the scope of the * Current global. This is only safe to use within the scope of the
* AutoCompartment from which it's called. * AutoCompartment from which it's called.
@ -1748,8 +1748,7 @@ struct JSContext : js::ThreadSafeContext,
* default version. * default version.
*/ */
void maybeMigrateVersionOverride() { void maybeMigrateVersionOverride() {
JS_ASSERT(stack.empty()); if (JS_UNLIKELY(isVersionOverridden()) && !currentlyRunning()) {
if (JS_UNLIKELY(isVersionOverridden())) {
defaultVersion = versionOverride; defaultVersion = versionOverride;
clearVersionOverride(); clearVersionOverride();
} }
@ -1820,6 +1819,19 @@ struct JSContext : js::ThreadSafeContext,
return mainThread().activation()->asInterpreter()->regs(); return mainThread().activation()->asInterpreter()->regs();
} }
/*
* Get the topmost script and optional pc on the stack. By default, this
* function only returns a JSScript in the current compartment, returning
* NULL if the current script is in a different compartment. This behavior
* can be overridden by passing ALLOW_CROSS_COMPARTMENT.
*/
enum MaybeAllowCrossCompartment {
DONT_ALLOW_CROSS_COMPARTMENT = false,
ALLOW_CROSS_COMPARTMENT = true
};
inline JSScript *currentScript(jsbytecode **pc = NULL,
MaybeAllowCrossCompartment = DONT_ALLOW_CROSS_COMPARTMENT) const;
#ifdef MOZ_TRACE_JSCALLS #ifdef MOZ_TRACE_JSCALLS
/* Function entry/exit debugging callback. */ /* Function entry/exit debugging callback. */
JSFunctionCallback functionCallback; JSFunctionCallback functionCallback;
@ -2015,6 +2027,12 @@ class MOZ_STACK_CLASS AutoKeepAtoms
~AutoKeepAtoms() { JS_UNKEEP_ATOMS(rt); } ~AutoKeepAtoms() { JS_UNKEEP_ATOMS(rt); }
}; };
// Maximum supported value of arguments.length. This bounds the maximum
// number of arguments that can be supplied to Function.prototype.apply.
// This value also bounds the number of elements parsed in an array
// initialiser.
static const unsigned ARGS_LENGTH_MAX = 500 * 1000;
} /* namespace js */ } /* namespace js */
class JSAutoResolveFlags class JSAutoResolveFlags

View File

@ -16,6 +16,7 @@
#include "builtin/Object.h" // For js::obj_construct #include "builtin/Object.h" // For js::obj_construct
#include "frontend/ParseMaps.h" #include "frontend/ParseMaps.h"
#include "ion/IonFrames.h" // For GetPcScript
#include "vm/Interpreter.h" #include "vm/Interpreter.h"
#include "vm/Probes.h" #include "vm/Probes.h"
#include "vm/RegExpObject.h" #include "vm/RegExpObject.h"
@ -123,25 +124,6 @@ NewObjectCache::newObjectFromHit(JSContext *cx, EntryIndex entry_, js::gc::Initi
return NULL; return NULL;
} }
struct PreserveRegsGuard
{
PreserveRegsGuard(JSContext *cx, FrameRegs &regs)
: prevContextRegs(cx->stack.maybeRegs()), cx(cx), regs_(regs) {
cx->stack.repointRegs(&regs_);
}
~PreserveRegsGuard() {
JS_ASSERT(cx->stack.maybeRegs() == &regs_);
*prevContextRegs = regs_;
cx->stack.repointRegs(prevContextRegs);
}
FrameRegs *prevContextRegs;
private:
JSContext *cx;
FrameRegs &regs_;
};
#ifdef JS_CRASH_DIAGNOSTICS #ifdef JS_CRASH_DIAGNOSTICS
class CompartmentChecker class CompartmentChecker
{ {
@ -575,6 +557,48 @@ JSContext::setCompartment(JSCompartment *comp)
allocator_ = zone_ ? &zone_->allocator : NULL; allocator_ = zone_ ? &zone_->allocator : NULL;
} }
inline JSScript *
JSContext::currentScript(jsbytecode **ppc,
MaybeAllowCrossCompartment allowCrossCompartment) const
{
if (ppc)
*ppc = NULL;
js::Activation *act = mainThread().activation();
while (act && (act->cx() != this || !act->isActive()))
act = act->prev();
if (!act)
return NULL;
JS_ASSERT(act->cx() == this);
#ifdef JS_ION
if (act->isJit()) {
JSScript *script = NULL;
js::ion::GetPcScript(const_cast<JSContext *>(this), &script, ppc);
if (!allowCrossCompartment && script->compartment() != compartment())
return NULL;
return script;
}
#endif
JS_ASSERT(act->isInterpreter());
js::StackFrame *fp = act->asInterpreter()->current();
JS_ASSERT(!fp->runningInJit());
JSScript *script = fp->script();
if (!allowCrossCompartment && script->compartment() != compartment())
return NULL;
if (ppc) {
*ppc = act->asInterpreter()->regs().pc;
JS_ASSERT(*ppc >= script->code && *ppc < script->code + script->length);
}
return script;
}
template <typename T> template <typename T>
inline bool inline bool
js::ThreadSafeContext::isInsideCurrentZone(T thing) const js::ThreadSafeContext::isInsideCurrentZone(T thing) const

View File

@ -2590,16 +2590,16 @@ date_toJSON(JSContext *cx, unsigned argc, Value *vp)
} }
/* Step 6. */ /* Step 6. */
InvokeArgsGuard ag; InvokeArgs args2(cx);
if (!cx->stack.pushInvokeArgs(cx, 0, &ag)) if (!args2.init(0))
return false; return false;
ag.setCallee(toISO); args2.setCallee(toISO);
ag.setThis(ObjectValue(*obj)); args2.setThis(ObjectValue(*obj));
if (!Invoke(cx, ag)) if (!Invoke(cx, args2))
return false; return false;
args.rval().set(ag.rval()); args.rval().set(args2.rval());
return true; return true;
} }

View File

@ -1238,8 +1238,6 @@ JSObject *
JSAbstractFramePtr::scopeChain(JSContext *cx) JSAbstractFramePtr::scopeChain(JSContext *cx)
{ {
AbstractFramePtr frame = Valueify(*this); AbstractFramePtr frame = Valueify(*this);
JS_ASSERT_IF(frame.isStackFrame(),
cx->stack.space().containsSlow(frame.asStackFrame()));
RootedObject scopeChain(cx, frame.scopeChain()); RootedObject scopeChain(cx, frame.scopeChain());
AutoCompartment ac(cx, scopeChain); AutoCompartment ac(cx, scopeChain);
return GetDebugScopeForFrame(cx, frame); return GetDebugScopeForFrame(cx, frame);
@ -1249,9 +1247,6 @@ JSObject *
JSAbstractFramePtr::callObject(JSContext *cx) JSAbstractFramePtr::callObject(JSContext *cx)
{ {
AbstractFramePtr frame = Valueify(*this); AbstractFramePtr frame = Valueify(*this);
JS_ASSERT_IF(frame.isStackFrame(),
cx->stack.space().containsSlow(frame.asStackFrame()));
if (!frame.isFunctionFrame()) if (!frame.isFunctionFrame())
return NULL; return NULL;

View File

@ -309,7 +309,7 @@ AutoSwitchCompartment::AutoSwitchCompartment(JSContext *cx, JSCompartment *newCo
cx->setCompartment(newCompartment); cx->setCompartment(newCompartment);
} }
AutoSwitchCompartment::AutoSwitchCompartment(JSContext *cx, JSHandleObject target AutoSwitchCompartment::AutoSwitchCompartment(JSContext *cx, HandleObject target
MOZ_GUARD_OBJECT_NOTIFIER_PARAM_IN_IMPL) MOZ_GUARD_OBJECT_NOTIFIER_PARAM_IN_IMPL)
: cx(cx), oldCompartment(cx->compartment()) : cx(cx), oldCompartment(cx->compartment())
{ {
@ -800,7 +800,7 @@ js::SetActivityCallback(JSRuntime *rt, ActivityCallback cb, void *arg)
JS_FRIEND_API(bool) JS_FRIEND_API(bool)
js::IsContextRunningJS(JSContext *cx) js::IsContextRunningJS(JSContext *cx)
{ {
return !cx->stack.empty(); return cx->currentlyRunning();
} }
JS_FRIEND_API(JS::GCSliceCallback) JS_FRIEND_API(JS::GCSliceCallback)
@ -1081,7 +1081,7 @@ js::SetObjectMetadataCallback(JSContext *cx, ObjectMetadataCallback callback)
} }
JS_FRIEND_API(bool) JS_FRIEND_API(bool)
js::SetObjectMetadata(JSContext *cx, JSHandleObject obj, JSHandleObject metadata) js::SetObjectMetadata(JSContext *cx, HandleObject obj, HandleObject metadata)
{ {
return JSObject::setMetadata(cx, obj, metadata); return JSObject::setMetadata(cx, obj, metadata);
} }

View File

@ -52,7 +52,7 @@ extern JS_FRIEND_API(JSObject *)
JS_NewObjectWithUniqueType(JSContext *cx, JSClass *clasp, JSObject *proto, JSObject *parent); JS_NewObjectWithUniqueType(JSContext *cx, JSClass *clasp, JSObject *proto, JSObject *parent);
extern JS_FRIEND_API(uint32_t) extern JS_FRIEND_API(uint32_t)
JS_ObjectCountDynamicSlots(JSHandleObject obj); JS_ObjectCountDynamicSlots(JS::HandleObject obj);
extern JS_FRIEND_API(size_t) extern JS_FRIEND_API(size_t)
JS_SetProtoCalled(JSContext *cx); JS_SetProtoCalled(JSContext *cx);
@ -122,10 +122,11 @@ extern JS_FRIEND_API(JSObject *)
JS_CloneObject(JSContext *cx, JSObject *obj, JSObject *proto, JSObject *parent); JS_CloneObject(JSContext *cx, JSObject *obj, JSObject *proto, JSObject *parent);
extern JS_FRIEND_API(JSString *) extern JS_FRIEND_API(JSString *)
JS_BasicObjectToString(JSContext *cx, JSHandleObject obj); JS_BasicObjectToString(JSContext *cx, JS::HandleObject obj);
extern JS_FRIEND_API(JSBool) extern JS_FRIEND_API(JSBool)
js_GetterOnlyPropertyStub(JSContext *cx, JSHandleObject obj, JSHandleId id, JSBool strict, JS::MutableHandleValue vp); js_GetterOnlyPropertyStub(JSContext *cx, JS::HandleObject obj, JS::HandleId id, JSBool strict,
JS::MutableHandleValue vp);
JS_FRIEND_API(void) JS_FRIEND_API(void)
js_ReportOverRecursed(JSContext *maybecx); js_ReportOverRecursed(JSContext *maybecx);
@ -161,7 +162,7 @@ extern JS_FRIEND_API(JSBool)
JS_WrapAutoIdVector(JSContext *cx, JS::AutoIdVector &props); JS_WrapAutoIdVector(JSContext *cx, JS::AutoIdVector &props);
extern JS_FRIEND_API(JSBool) extern JS_FRIEND_API(JSBool)
JS_EnumerateState(JSContext *cx, JSHandleObject obj, JSIterateOp enum_op, JS_EnumerateState(JSContext *cx, JS::HandleObject obj, JSIterateOp enum_op,
js::MutableHandleValue statep, js::MutableHandleId idp); js::MutableHandleValue statep, js::MutableHandleId idp);
struct JSFunctionSpecWithHelp { struct JSFunctionSpecWithHelp {
@ -229,7 +230,7 @@ class JS_FRIEND_API(AutoSwitchCompartment) {
public: public:
AutoSwitchCompartment(JSContext *cx, JSCompartment *newCompartment AutoSwitchCompartment(JSContext *cx, JSCompartment *newCompartment
MOZ_GUARD_OBJECT_NOTIFIER_PARAM); MOZ_GUARD_OBJECT_NOTIFIER_PARAM);
AutoSwitchCompartment(JSContext *cx, JSHandleObject target AutoSwitchCompartment(JSContext *cx, JS::HandleObject target
MOZ_GUARD_OBJECT_NOTIFIER_PARAM); MOZ_GUARD_OBJECT_NOTIFIER_PARAM);
~AutoSwitchCompartment(); ~AutoSwitchCompartment();
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
@ -785,7 +786,7 @@ extern JS_FRIEND_API(AnalysisPurgeCallback)
SetAnalysisPurgeCallback(JSRuntime *rt, AnalysisPurgeCallback callback); SetAnalysisPurgeCallback(JSRuntime *rt, AnalysisPurgeCallback callback);
typedef JSBool typedef JSBool
(* DOMInstanceClassMatchesProto)(JSHandleObject protoObject, uint32_t protoID, (* DOMInstanceClassMatchesProto)(JS::HandleObject protoObject, uint32_t protoID,
uint32_t depth); uint32_t depth);
struct JSDOMCallbacks { struct JSDOMCallbacks {
DOMInstanceClassMatchesProto instanceClassMatchesProto; DOMInstanceClassMatchesProto instanceClassMatchesProto;
@ -915,7 +916,7 @@ typedef enum DOMProxyShadowsResult {
DoesntShadowUnique DoesntShadowUnique
} DOMProxyShadowsResult; } DOMProxyShadowsResult;
typedef DOMProxyShadowsResult typedef DOMProxyShadowsResult
(* DOMProxyShadowsCheck)(JSContext* cx, JSHandleObject object, JSHandleId id); (* DOMProxyShadowsCheck)(JSContext* cx, JS::HandleObject object, JS::HandleId id);
JS_FRIEND_API(void) JS_FRIEND_API(void)
SetDOMProxyInformation(void *domProxyHandlerFamily, uint32_t domProxyExpandoSlot, SetDOMProxyInformation(void *domProxyHandlerFamily, uint32_t domProxyExpandoSlot,
DOMProxyShadowsCheck domProxyShadowsCheck); DOMProxyShadowsCheck domProxyShadowsCheck);
@ -1542,13 +1543,13 @@ struct JSJitMethodCallArgsTraits
* available to general JSAPI users, but we are not currently ready to do so. * available to general JSAPI users, but we are not currently ready to do so.
*/ */
typedef bool typedef bool
(* JSJitGetterOp)(JSContext *cx, JSHandleObject thisObj, (* JSJitGetterOp)(JSContext *cx, JS::HandleObject thisObj,
void *specializedThis, JSJitGetterCallArgs args); void *specializedThis, JSJitGetterCallArgs args);
typedef bool typedef bool
(* JSJitSetterOp)(JSContext *cx, JSHandleObject thisObj, (* JSJitSetterOp)(JSContext *cx, JS::HandleObject thisObj,
void *specializedThis, JSJitSetterCallArgs args); void *specializedThis, JSJitSetterCallArgs args);
typedef bool typedef bool
(* JSJitMethodOp)(JSContext *cx, JSHandleObject thisObj, (* JSJitMethodOp)(JSContext *cx, JS::HandleObject thisObj,
void *specializedThis, const JSJitMethodCallArgs& args); void *specializedThis, const JSJitMethodCallArgs& args);
struct JSJitInfo { struct JSJitInfo {
@ -1744,14 +1745,14 @@ SetObjectMetadataCallback(JSContext *cx, ObjectMetadataCallback callback);
/* Manipulate the metadata associated with an object. */ /* Manipulate the metadata associated with an object. */
JS_FRIEND_API(bool) JS_FRIEND_API(bool)
SetObjectMetadata(JSContext *cx, JSHandleObject obj, JSHandleObject metadata); SetObjectMetadata(JSContext *cx, JS::HandleObject obj, JS::HandleObject metadata);
JS_FRIEND_API(JSObject *) JS_FRIEND_API(JSObject *)
GetObjectMetadata(JSObject *obj); GetObjectMetadata(JSObject *obj);
/* ES5 8.12.8. */ /* ES5 8.12.8. */
extern JS_FRIEND_API(JSBool) extern JS_FRIEND_API(JSBool)
DefaultValue(JSContext *cx, HandleObject obj, JSType hint, MutableHandleValue vp); DefaultValue(JSContext *cx, JS::HandleObject obj, JSType hint, MutableHandleValue vp);
} /* namespace js */ } /* namespace js */

View File

@ -817,8 +817,8 @@ js_fun_call(JSContext *cx, unsigned argc, Value *vp)
} }
/* Allocate stack space for fval, obj, and the args. */ /* Allocate stack space for fval, obj, and the args. */
InvokeArgsGuard args; InvokeArgs args(cx);
if (!cx->stack.pushInvokeArgs(cx, argc, &args)) if (!args.init(argc))
return JS_FALSE; return JS_FALSE;
/* Push fval, thisv, and the args. */ /* Push fval, thisv, and the args. */
@ -833,13 +833,13 @@ js_fun_call(JSContext *cx, unsigned argc, Value *vp)
#ifdef JS_ION #ifdef JS_ION
static bool static bool
PushBaselineFunApplyArguments(JSContext *cx, ion::IonFrameIterator &frame, InvokeArgsGuard &args, PushBaselineFunApplyArguments(JSContext *cx, ion::IonFrameIterator &frame, InvokeArgs &args,
Value *vp) Value *vp)
{ {
unsigned length = frame.numActualArgs(); unsigned length = frame.numActualArgs();
JS_ASSERT(length <= StackSpace::ARGS_LENGTH_MAX); JS_ASSERT(length <= ARGS_LENGTH_MAX);
if (!cx->stack.pushInvokeArgs(cx, length, &args)) if (!args.init(length))
return false; return false;
/* Push fval, obj, and aobj's elements as args. */ /* Push fval, obj, and aobj's elements as args. */
@ -867,7 +867,7 @@ js_fun_apply(JSContext *cx, unsigned argc, Value *vp)
if (argc < 2 || vp[3].isNullOrUndefined()) if (argc < 2 || vp[3].isNullOrUndefined())
return js_fun_call(cx, (argc > 0) ? 1 : 0, vp); return js_fun_call(cx, (argc > 0) ? 1 : 0, vp);
InvokeArgsGuard args; InvokeArgs args(cx);
/* /*
* GuardFunApplyArgumentsOptimization already called IsOptimizedArguments, * GuardFunApplyArgumentsOptimization already called IsOptimizedArguments,
@ -895,9 +895,9 @@ js_fun_apply(JSContext *cx, unsigned argc, Value *vp)
ion::InlineFrameIterator iter(cx, &frame); ion::InlineFrameIterator iter(cx, &frame);
unsigned length = iter.numActualArgs(); unsigned length = iter.numActualArgs();
JS_ASSERT(length <= StackSpace::ARGS_LENGTH_MAX); JS_ASSERT(length <= ARGS_LENGTH_MAX);
if (!cx->stack.pushInvokeArgs(cx, length, &args)) if (!args.init(length))
return false; return false;
/* Push fval, obj, and aobj's elements as args. */ /* Push fval, obj, and aobj's elements as args. */
@ -932,9 +932,9 @@ js_fun_apply(JSContext *cx, unsigned argc, Value *vp)
{ {
StackFrame *fp = cx->interpreterFrame(); StackFrame *fp = cx->interpreterFrame();
unsigned length = fp->numActualArgs(); unsigned length = fp->numActualArgs();
JS_ASSERT(length <= StackSpace::ARGS_LENGTH_MAX); JS_ASSERT(length <= ARGS_LENGTH_MAX);
if (!cx->stack.pushInvokeArgs(cx, length, &args)) if (!args.init(length))
return false; return false;
/* Push fval, obj, and aobj's elements as args. */ /* Push fval, obj, and aobj's elements as args. */
@ -961,12 +961,12 @@ js_fun_apply(JSContext *cx, unsigned argc, Value *vp)
return false; return false;
/* Step 6. */ /* Step 6. */
if (length > StackSpace::ARGS_LENGTH_MAX) { if (length > ARGS_LENGTH_MAX) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_TOO_MANY_FUN_APPLY_ARGS); JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_TOO_MANY_FUN_APPLY_ARGS);
return false; return false;
} }
if (!cx->stack.pushInvokeArgs(cx, length, &args)) if (!args.init(length))
return false; return false;
/* Push fval, obj, and aobj's elements as args. */ /* Push fval, obj, and aobj's elements as args. */
@ -1118,7 +1118,7 @@ js::CallOrConstructBoundFunction(JSContext *cx, unsigned argc, Value *vp)
/* 15.3.4.5.1 step 1, 15.3.4.5.2 step 3. */ /* 15.3.4.5.1 step 1, 15.3.4.5.2 step 3. */
unsigned argslen = fun->getBoundFunctionArgumentCount(); unsigned argslen = fun->getBoundFunctionArgumentCount();
if (argc + argslen > StackSpace::ARGS_LENGTH_MAX) { if (argc + argslen > ARGS_LENGTH_MAX) {
js_ReportAllocationOverflow(cx); js_ReportAllocationOverflow(cx);
return false; return false;
} }
@ -1129,8 +1129,8 @@ js::CallOrConstructBoundFunction(JSContext *cx, unsigned argc, Value *vp)
/* 15.3.4.5.1 step 2. */ /* 15.3.4.5.1 step 2. */
const Value &boundThis = fun->getBoundFunctionThis(); const Value &boundThis = fun->getBoundFunctionThis();
InvokeArgsGuard args; InvokeArgs args(cx);
if (!cx->stack.pushInvokeArgs(cx, argc + argslen, &args)) if (!args.init(argc + argslen))
return false; return false;
/* 15.3.4.5.1, 15.3.4.5.2 step 4. */ /* 15.3.4.5.1, 15.3.4.5.2 step 4. */

View File

@ -2558,6 +2558,7 @@ PurgeRuntime(JSRuntime *rt)
comp->purge(); comp->purge();
rt->freeLifoAlloc.transferUnusedFrom(&rt->tempLifoAlloc); rt->freeLifoAlloc.transferUnusedFrom(&rt->tempLifoAlloc);
rt->interpreterStack().purge(rt);
rt->gsnCache.purge(); rt->gsnCache.purge();
rt->newObjectCache.purge(); rt->newObjectCache.purge();
@ -4132,8 +4133,6 @@ AutoGCSlice::AutoGCSlice(JSRuntime *rt)
* is set at the beginning of the mark phase. During incremental GC, we also * is set at the beginning of the mark phase. During incremental GC, we also
* set it at the start of every phase. * set it at the start of every phase.
*/ */
rt->stackSpace.markActiveCompartments();
for (ActivationIterator iter(rt); !iter.done(); ++iter) for (ActivationIterator iter(rt); !iter.done(); ++iter)
iter.activation()->compartment()->zone()->active = true; iter.activation()->compartment()->zone()->active = true;

View File

@ -5426,7 +5426,7 @@ types::MarkIteratorUnknownSlow(JSContext *cx)
/* Check whether we are actually at an ITER opcode. */ /* Check whether we are actually at an ITER opcode. */
jsbytecode *pc; jsbytecode *pc;
RootedScript script(cx, cx->stack.currentScript(&pc)); RootedScript script(cx, cx->currentScript(&pc));
if (!script || !pc) if (!script || !pc)
return; return;

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