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

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

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

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

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

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

@ -114,8 +114,8 @@ typedef CallbackObjectHolder<NodeFilter, nsIDOMNodeFilter> NodeFilterHolder;
} // namespace mozilla
#define NS_IDOCUMENT_IID \
{ 0x308f8444, 0x7679, 0x445a, \
{ 0xa6, 0xcc, 0xb9, 0x5c, 0x61, 0xff, 0xe2, 0x66 } }
{ 0x62cca591, 0xa030, 0x4117, \
{ 0x9b, 0x80, 0xdc, 0xd3, 0x66, 0xbb, 0xb5, 0x9 } }
// Flag for AddStyleSheet().
#define NS_STYLESHEET_FROM_CATALOG (1 << 0)
@ -770,13 +770,6 @@ public:
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;
/**
@ -1475,8 +1468,7 @@ public:
{
NS_PRECONDITION(!GetShell() &&
!nsCOMPtr<nsISupports>(GetContainer()) &&
!GetWindow() &&
!GetScriptGlobalObject(),
!GetWindow(),
"Shouldn't set mDisplayDocument on documents that already "
"have a presentation or a docshell or a window");
NS_PRECONDITION(aDisplayDocument != this, "Should be different document");

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

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

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

@ -6100,10 +6100,10 @@ nsContentUtils::IsPatternMatching(nsAString& aValue, nsAString& aPattern,
nsIDocument* aDocument)
{
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()->
GetContext()->GetNativeContext());
AutoPushJSContext cx(sgo->GetContext()->GetNativeContext());
NS_ENSURE_TRUE(cx, true);
// The pattern has to match the entire value.

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

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

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

@ -4078,28 +4078,6 @@ nsDocument::FirstAdditionalAuthorSheet()
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*
nsDocument::GetScopeObject() const
{
@ -4270,14 +4248,25 @@ nsPIDOMWindow *
nsDocument::GetWindowInternal() const
{
MOZ_ASSERT(!mWindow, "This should not be called when mWindow is not null!");
nsCOMPtr<nsPIDOMWindow> win(do_QueryInterface(GetScriptGlobalObject()));
if (!win) {
return nullptr;
// Let's use mScriptGlobalObject. Even if the document is already removed from
// the docshell, the outer window might be still obtainable from the it.
nsCOMPtr<nsPIDOMWindow> win;
if (mRemovedFromDocShell) {
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*
@ -7111,7 +7100,7 @@ nsDocument::IsScriptEnabled()
nsCOMPtr<nsIScriptSecurityManager> sm(do_GetService(NS_SCRIPTSECURITYMANAGER_CONTRACTID));
NS_ENSURE_TRUE(sm, false);
nsIScriptGlobalObject* globalObject = GetScriptGlobalObject();
nsCOMPtr<nsIScriptGlobalObject> globalObject = do_QueryInterface(GetWindow());
NS_ENSURE_TRUE(globalObject, false);
nsIScriptContext *scriptContext = globalObject->GetContext();
@ -8123,7 +8112,7 @@ nsDocument::MutationEventDispatched(nsINode* aTarget)
}
nsCOMPtr<nsPIDOMWindow> window;
window = do_QueryInterface(GetScriptGlobalObject());
window = do_QueryInterface(GetWindow());
if (window &&
!window->HasMutationListeners(NS_EVENT_BITS_MUTATION_SUBTREEMODIFIED)) {
mSubtreeModifiedTargets.Clear();
@ -11275,7 +11264,7 @@ nsIDocument::WrapObject(JSContext *aCx, JS::Handle<JSObject*> aScope)
return nullptr;
}
nsCOMPtr<nsPIDOMWindow> win = do_QueryInterface(GetScriptGlobalObject());
nsCOMPtr<nsPIDOMWindow> win = do_QueryInterface(GetInnerWindow());
if (!win) {
// No window, nothing else to do here
return obj;

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

@ -640,12 +640,6 @@ public:
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 SetScriptHandlingObject(nsIScriptGlobalObject* aScriptObject) MOZ_OVERRIDE;

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

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

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

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

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

@ -148,7 +148,7 @@ class nsObjectLoadingContent : public nsImageLoadingContent
void TeardownProtoChain();
// 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);
// WebIDL API

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

@ -273,7 +273,7 @@ nsScriptLoader::StartLoad(nsScriptLoadRequest *aRequest, const nsAString &aType,
nsCOMPtr<nsILoadGroup> loadGroup = mDocument->GetDocumentLoadGroup();
nsCOMPtr<nsPIDOMWindow> window(do_QueryInterface(mDocument->GetScriptGlobalObject()));
nsCOMPtr<nsPIDOMWindow> window(do_QueryInterface(mDocument->GetWindow()));
if (!window) {
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
// disabled.
// XXX is this different from the mDocument->IsScriptEnabled() call?
nsIScriptGlobalObject *globalObject = mDocument->GetScriptGlobalObject();
nsCOMPtr<nsIScriptGlobalObject> globalObject =
do_QueryInterface(mDocument->GetWindow());
if (!globalObject) {
return false;
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

@ -103,7 +103,7 @@ nsXULPDGlobalObject_finalize(JSFreeOp *fop, JSObject *obj)
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;

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

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

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

@ -2601,8 +2601,8 @@ static JSClass sGlobalScopePolluterClass = {
// static
JSBool
nsWindowSH::GlobalScopePolluterGetProperty(JSContext *cx, JSHandleObject obj,
JSHandleId id, JS::MutableHandle<JS::Value> vp)
nsWindowSH::GlobalScopePolluterGetProperty(JSContext *cx, JS::Handle<JSObject*> obj,
JS::Handle<jsid> id, JS::MutableHandle<JS::Value> vp)
{
// Someone is accessing a element by referencing its name/id in the
// 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.
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)
{
MOZ_ASSERT(JSID_IS_STRING(id));
@ -2661,8 +2661,8 @@ GetDocument(JSObject *obj)
// static
JSBool
nsWindowSH::GlobalScopePolluterNewResolve(JSContext *cx, JSHandleObject obj,
JSHandleId id, unsigned flags,
nsWindowSH::GlobalScopePolluterNewResolve(JSContext *cx, JS::Handle<JSObject*> obj,
JS::Handle<jsid> id, unsigned flags,
JS::MutableHandle<JSObject*> objp)
{
if (!JSID_IS_STRING(id)) {
@ -3108,7 +3108,8 @@ static const IDBConstant sIDBConstants[] = {
};
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);
unsigned index;
@ -4244,7 +4245,7 @@ LocationSetterGuts(JSContext *cx, JSObject *obj, jsval *vp)
template<class Interface>
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)
{
nsresult rv = LocationSetterGuts<Interface>(cx, obj, vp.address());
@ -4257,8 +4258,8 @@ LocationSetter(JSContext *cx, JSHandleObject obj, JSHandleId id, JSBool strict,
}
static JSBool
LocationSetterUnwrapper(JSContext *cx, JSHandleObject obj_, JSHandleId id, JSBool strict,
JS::MutableHandle<JS::Value> vp)
LocationSetterUnwrapper(JSContext *cx, JS::Handle<JSObject*> obj_, JS::Handle<jsid> id,
JSBool strict, JS::MutableHandle<JS::Value> vp)
{
JS::RootedObject obj(cx, obj_);
@ -5616,8 +5617,8 @@ nsHTMLDocumentSH::GetDocumentAllNodeList(JSContext *cx,
}
JSBool
nsHTMLDocumentSH::DocumentAllGetProperty(JSContext *cx, JSHandleObject obj_,
JSHandleId id, JS::MutableHandle<JS::Value> vp)
nsHTMLDocumentSH::DocumentAllGetProperty(JSContext *cx, JS::Handle<JSObject*> obj_,
JS::Handle<jsid> id, JS::MutableHandle<JS::Value> vp)
{
JS::Rooted<JSObject*> obj(cx, obj_);
@ -5713,8 +5714,9 @@ nsHTMLDocumentSH::DocumentAllGetProperty(JSContext *cx, JSHandleObject obj_,
}
JSBool
nsHTMLDocumentSH::DocumentAllNewResolve(JSContext *cx, JSHandleObject obj, JSHandleId id,
unsigned flags, JS::MutableHandle<JSObject*> objp)
nsHTMLDocumentSH::DocumentAllNewResolve(JSContext *cx, JS::Handle<JSObject*> obj,
JS::Handle<jsid> id, unsigned flags,
JS::MutableHandle<JSObject*> objp)
{
JS::RootedValue v(cx);

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

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

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

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

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

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

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

@ -655,7 +655,7 @@ TryPreserveWrapper(JSObject* obj)
// 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.
JSBool
InstanceClassHasProtoAtDepth(JSHandleObject protoObject, uint32_t protoID,
InstanceClassHasProtoAtDepth(JS::Handle<JSObject*> protoObject, uint32_t protoID,
uint32_t depth)
{
const DOMClass* domClass = static_cast<DOMClass*>(
@ -1755,7 +1755,7 @@ InterfaceHasInstance(JSContext* cx, JS::Handle<JSObject*> obj,
}
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)
{
if (!vp.isObject()) {

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

@ -928,7 +928,7 @@ TryPreserveWrapper(JSObject* obj);
// 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.
JSBool
InstanceClassHasProtoAtDepth(JSHandleObject protoObject, uint32_t protoID,
InstanceClassHasProtoAtDepth(JS::Handle<JSObject*> protoObject, uint32_t protoID,
uint32_t depth);
// 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,
JSBool* bp);
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);
// Helper for lenient getters/setters to report to console. If this

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

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

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

@ -36,7 +36,7 @@ DefineStaticJSVals(JSContext* cx)
int HandlerFamily;
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);
if (v.isObject()) {

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

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

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

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

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

@ -41,7 +41,7 @@ public:
virtual nsresult GetResultCode() = 0;
virtual nsresult GetSuccessResult(JSContext* aCx,
jsval* aVal) = 0;
JS::MutableHandle<JS::Value> aVal) = 0;
IDBRequest* GetRequest() const
{
@ -61,7 +61,7 @@ protected:
*/
nsresult WrapNative(JSContext* aCx,
nsISupports* aNative,
jsval* aResult);
JS::MutableHandle<JS::Value> aResult);
/**
* 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.
*/
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
@ -216,7 +216,7 @@ protected:
static nsresult ConvertToArrayAndCleanup(
JSContext* aCx,
nsTArray<StructuredCloneReadInfo>& aReadInfos,
jsval* aResult);
JS::MutableHandle<JS::Value> aResult);
/**
* This should only be called by AutoSetCurrentTransaction.

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

@ -88,7 +88,7 @@ public:
MOZ_OVERRIDE;
virtual nsresult GetSuccessResult(JSContext* aCx,
jsval* aVal) MOZ_OVERRIDE;
JS::MutableHandle<JS::Value> aVal) MOZ_OVERRIDE;
virtual void ReleaseMainThreadObjects() MOZ_OVERRIDE;
@ -607,7 +607,7 @@ IDBCursor::GetValue(JSContext* 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;
}
@ -1004,12 +1004,12 @@ ContinueHelper::DoDatabaseWork(mozIStorageConnection* aConnection)
nsresult
ContinueHelper::GetSuccessResult(JSContext* aCx,
jsval* aVal)
JS::MutableHandle<JS::Value> aVal)
{
UpdateCursorState();
if (mKey.IsUnset()) {
*aVal = JSVAL_NULL;
aVal.setNull();
}
else {
nsresult rv = WrapNative(aCx, mCursor, aVal);

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

@ -109,28 +109,28 @@ NPClass nsJSObjWrapper::sJSObjWrapperNPClass =
};
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
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
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);
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
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);
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);
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
NPObjWrapper_Finalize(JSFreeOp *fop, JSObject *obj);
@ -171,7 +171,7 @@ typedef struct NPObjectMemberPrivate {
} NPObjectMemberPrivate;
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
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
// SetProperty call.
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);
@ -1149,7 +1149,7 @@ NPObjWrapper_AddProperty(JSContext *cx, JSHandleObject obj, JSHandleId id, JS::M
}
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);
@ -1182,7 +1182,7 @@ NPObjWrapper_DelProperty(JSContext *cx, JSHandleObject obj, JSHandleId id, JSBoo
}
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)
{
NPObject *npobj = GetNPObject(cx, obj);
@ -1242,7 +1242,7 @@ NPObjWrapper_SetProperty(JSContext *cx, JSHandleObject obj, JSHandleId id, JSBoo
}
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);
@ -1472,7 +1472,7 @@ struct NPObjectEnumerateState {
};
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)
{
NPObject *npobj = GetNPObject(cx, obj);
@ -1552,7 +1552,7 @@ NPObjWrapper_newEnumerate(JSContext *cx, JSHandleObject obj, JSIterateOp enum_op
}
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)
{
NPObject *npobj = GetNPObject(cx, obj);
@ -1606,7 +1606,7 @@ NPObjWrapper_NewResolve(JSContext *cx, JSHandleObject obj, JSHandleId id, unsign
}
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);
@ -2026,7 +2026,7 @@ CreateNPObjectMember(NPP npp, JSContext *cx, JSObject *obj, NPObject* npobj,
}
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 *)::JS_GetInstancePrivate(cx, obj,

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

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

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

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

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

@ -220,7 +220,8 @@ private:
}
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));
@ -236,7 +237,8 @@ private:
}
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_TO_INT(idval) >= CAPTURING_PHASE &&
@ -505,7 +507,8 @@ private:
}
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));
@ -712,7 +715,8 @@ private:
}
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));
@ -891,7 +895,8 @@ private:
}
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));

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

@ -126,7 +126,8 @@ private:
}
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));
@ -146,7 +147,8 @@ private:
}
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));
aVp.set(INT_TO_JSVAL(JSID_TO_INT(idval)));

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

@ -113,7 +113,8 @@ private:
}
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");
if (!blob) {
@ -132,7 +133,8 @@ private:
}
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");
if (!blob) {
@ -302,7 +304,8 @@ private:
}
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");
if (!file) {
@ -328,7 +331,8 @@ private:
}
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");
if (!file) {
@ -350,7 +354,8 @@ private:
}
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");
if (!file) {

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

@ -115,7 +115,8 @@ private:
}
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);
if (classPtr != &sClass) {

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

@ -129,7 +129,8 @@ private:
}
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);
if (classPtr != &sClass) {

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

@ -117,7 +117,8 @@ private:
}
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);
if (classPtr != &sClass) {

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

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

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

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

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

@ -142,7 +142,8 @@ protected:
private:
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_TO_INT(aIdval) >= 0 && JSID_TO_INT(aIdval) < STRING_COUNT);
@ -168,8 +169,8 @@ private:
}
static JSBool
SetEventListener(JSContext* aCx, JSHandleObject aObj, JSHandleId aIdval, JSBool aStrict,
JS::MutableHandle<JS::Value> aVp)
SetEventListener(JSContext* aCx, JS::Handle<JSObject*> aObj, JS::Handle<jsid> aIdval,
JSBool aStrict, JS::MutableHandle<JS::Value> aVp)
{
JS_ASSERT(JSID_IS_INT(aIdval));
JS_ASSERT(JSID_TO_INT(aIdval) >= 0 && JSID_TO_INT(aIdval) < STRING_COUNT);
@ -209,7 +210,8 @@ private:
}
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")) {
return false;
@ -220,7 +222,8 @@ private:
}
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 =
GetInstancePrivate(aCx, aObj, sProperties[SLOT_location].name);
@ -309,7 +312,8 @@ private:
}
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];
WorkerGlobalScope* scope = GetInstancePrivate(aCx, aObj, name);
@ -340,7 +344,7 @@ private:
}
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)
{
const char* name = sEventStrings[STRING_onerror];
@ -383,7 +387,8 @@ private:
}
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 =
GetInstancePrivate(aCx, aObj, sProperties[SLOT_navigator].name);
@ -732,7 +737,8 @@ private:
using EventTarget::SetEventListener;
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_TO_INT(aIdval) >= 0 && JSID_TO_INT(aIdval) < STRING_COUNT);
@ -758,8 +764,8 @@ private:
}
static JSBool
SetEventListener(JSContext* aCx, JSHandleObject aObj, JSHandleId aIdval, JSBool aStrict,
JS::MutableHandle<JS::Value> aVp)
SetEventListener(JSContext* aCx, JS::Handle<JSObject*> aObj, JS::Handle<jsid> aIdval,
JSBool aStrict, JS::MutableHandle<JS::Value> aVp)
{
JS_ASSERT(JSID_IS_INT(aIdval));
JS_ASSERT(JSID_TO_INT(aIdval) >= 0 && JSID_TO_INT(aIdval) < STRING_COUNT);
@ -812,7 +818,7 @@ private:
}
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)
{
JSBool resolved;

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

@ -165,7 +165,7 @@ struct JSSettings
// All of these are implemented in RuntimeService.cpp
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);
void

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

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

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

@ -59,30 +59,33 @@ private:
mutable JSObject* mObj;
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
CPOW_DelProperty(JSContext *cx, JSHandleObject obj, JSHandleId id, JSBool *succeeded);
CPOW_DelProperty(JSContext *cx, JS::HandleObject obj, JS::HandleId id, JSBool *succeeded);
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
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 NewEnumerateNext(JSContext* cx, jsval* statep, jsid* idp);
JSBool NewEnumerateDestroy(JSContext* cx, jsval state);
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);
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);
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
CPOW_Finalize(js::FreeOp* fop, JSObject* obj);
@ -94,7 +97,7 @@ private:
CPOW_Construct(JSContext *cx, unsigned argc, jsval *vp);
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_from_JSVariant(JSContext* cx, const JSVariant& from,
@ -102,7 +105,8 @@ private:
static bool boolean_from_JSVariant(JSContext* cx, const JSVariant& from,
JSBool* to);
static bool
JSObject_to_PObjectWrapperParent(JSContext* cx, JSObject* from, PObjectWrapperParent** to);
JSObject_to_PObjectWrapperParent(JSContext* cx, JSObject* from,
PObjectWrapperParent** to);
static bool
JSObject_from_PObjectWrapperParent(JSContext* cx,
const PObjectWrapperParent* from,

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

@ -158,23 +158,23 @@ static JSBool ConstructAbstract(JSContext* cx, unsigned argc, jsval* vp);
namespace CType {
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 Finalize(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);
static JSBool NameGetter(JSContext* cx, JSHandleObject obj, JSHandleId idval,
static JSBool NameGetter(JSContext* cx, HandleObject obj, HandleId idval,
MutableHandleValue vp);
static JSBool SizeGetter(JSContext* cx, JSHandleObject obj, JSHandleId idval,
static JSBool SizeGetter(JSContext* cx, HandleObject obj, HandleId idval,
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 ToString(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 {
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);
static JSBool ContentsGetter(JSContext* cx, JSHandleObject obj, JSHandleId idval,
static JSBool ContentsGetter(JSContext* cx, HandleObject obj, HandleId idval,
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);
static JSBool IsNull(JSContext* cx, unsigned argc, jsval* vp);
static JSBool Increment(JSContext* cx, unsigned argc, jsval* vp);
@ -213,26 +213,26 @@ namespace PointerType {
namespace ArrayType {
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);
static JSBool LengthGetter(JSContext* cx, JSHandleObject obj, JSHandleId idval,
static JSBool LengthGetter(JSContext* cx, HandleObject obj, HandleId idval,
MutableHandleValue vp);
static JSBool Getter(JSContext* cx, JSHandleObject obj, JSHandleId idval, MutableHandleValue vp);
static JSBool Setter(JSContext* cx, JSHandleObject obj, JSHandleId idval, JSBool strict, MutableHandleValue vp);
static JSBool Getter(JSContext* cx, HandleObject obj, HandleId idval, MutableHandleValue vp);
static JSBool Setter(JSContext* cx, HandleObject obj, HandleId idval, JSBool strict, MutableHandleValue vp);
static JSBool AddressOfElement(JSContext* cx, unsigned argc, jsval* vp);
}
namespace StructType {
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);
static JSBool FieldGetter(JSContext* cx, JSHandleObject obj, JSHandleId idval,
static JSBool FieldGetter(JSContext* cx, HandleObject obj, HandleId idval,
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);
static JSBool AddressOfField(JSContext* cx, unsigned argc, jsval* vp);
static JSBool Define(JSContext* cx, unsigned argc, jsval* vp);
@ -240,17 +240,17 @@ namespace StructType {
namespace FunctionType {
static JSBool Create(JSContext* cx, unsigned argc, jsval* vp);
static JSBool ConstructData(JSContext* cx, JSHandleObject typeObj,
JSHandleObject dataObj, JSHandleObject fnObj, JSHandleObject thisObj, jsval errVal);
static JSBool ConstructData(JSContext* cx, HandleObject typeObj,
HandleObject dataObj, HandleObject fnObj, HandleObject thisObj, jsval errVal);
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);
static JSBool ReturnTypeGetter(JSContext* cx, JSHandleObject obj, JSHandleId idval,
static JSBool ReturnTypeGetter(JSContext* cx, HandleObject obj, HandleId idval,
MutableHandleValue vp);
static JSBool ABIGetter(JSContext* cx, JSHandleObject obj, JSHandleId idval, MutableHandleValue vp);
static JSBool IsVariadicGetter(JSContext* cx, JSHandleObject obj, JSHandleId idval,
static JSBool ABIGetter(JSContext* cx, HandleObject obj, HandleId idval, MutableHandleValue vp);
static JSBool IsVariadicGetter(JSContext* cx, HandleObject obj, HandleId idval,
MutableHandleValue vp);
}
@ -266,21 +266,21 @@ namespace CClosure {
namespace CData {
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);
static JSBool ValueSetter(JSContext* cx, JSHandleObject obj, JSHandleId idval,
static JSBool ValueSetter(JSContext* cx, HandleObject obj, HandleId idval,
JSBool strict, MutableHandleValue vp);
static JSBool Address(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 ToSource(JSContext* cx, unsigned argc, jsval* vp);
static JSString *GetSourceString(JSContext *cx, JSHandleObject typeObj,
static JSString *GetSourceString(JSContext *cx, HandleObject typeObj,
void *data);
static JSBool ErrnoGetter(JSContext* cx, JSHandleObject obj, JSHandleId idval,
static JSBool ErrnoGetter(JSContext* cx, HandleObject obj, HandleId idval,
MutableHandleValue vp);
#if defined(XP_WIN)
static JSBool LastErrorGetter(JSContext* cx, JSHandleObject obj, JSHandleId idval,
static JSBool LastErrorGetter(JSContext* cx, HandleObject obj, HandleId idval,
MutableHandleValue vp);
#endif // defined(XP_WIN)
}
@ -3543,7 +3543,7 @@ CType::GetFFIType(JSContext* cx, JSObject* obj)
}
JSString*
CType::GetName(JSContext* cx, JSHandleObject obj)
CType::GetName(JSContext* cx, HandleObject obj)
{
JS_ASSERT(CType::IsCType(obj));
@ -3593,7 +3593,7 @@ CType::GetProtoFromType(JSContext* cx, JSObject* obj, CTypeProtoSlot slot)
}
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))) {
JS_ReportError(cx, "not a CType or CTypeProto");
@ -3608,7 +3608,7 @@ CType::PrototypeGetter(JSContext* cx, JSHandleObject obj, JSHandleId idval, Muta
}
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)) {
JS_ReportError(cx, "not a CType");
@ -3624,7 +3624,7 @@ CType::NameGetter(JSContext* cx, JSHandleObject obj, JSHandleId idval, MutableHa
}
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)) {
JS_ReportError(cx, "not a CType");
@ -3637,7 +3637,7 @@ CType::SizeGetter(JSContext* cx, JSHandleObject obj, JSHandleId idval, MutableHa
}
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)) {
JS_ReportError(cx, "not a CType");
@ -3747,7 +3747,7 @@ CType::ToSource(JSContext* cx, unsigned argc, jsval* vp)
}
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));
@ -3909,7 +3909,7 @@ PointerType::CreateInternal(JSContext* cx, HandleObject baseType)
JSBool
PointerType::ConstructData(JSContext* cx,
JSHandleObject obj,
HandleObject obj,
const CallArgs& args)
{
if (!CType::IsCType(obj) || CType::GetTypeCode(obj) != TYPE_pointer) {
@ -4001,8 +4001,8 @@ PointerType::GetBaseType(JSObject* obj)
JSBool
PointerType::TargetTypeGetter(JSContext* cx,
JSHandleObject obj,
JSHandleId idval,
HandleObject obj,
HandleId idval,
MutableHandleValue vp)
{
if (!CType::IsCType(obj) || CType::GetTypeCode(obj) != TYPE_pointer) {
@ -4091,8 +4091,8 @@ PointerType::Decrement(JSContext* cx, unsigned argc, jsval* vp)
JSBool
PointerType::ContentsGetter(JSContext* cx,
JSHandleObject obj,
JSHandleId idval,
HandleObject obj,
HandleId idval,
MutableHandleValue vp)
{
if (!CData::IsCData(obj)) {
@ -4129,8 +4129,8 @@ PointerType::ContentsGetter(JSContext* cx,
JSBool
PointerType::ContentsSetter(JSContext* cx,
JSHandleObject obj,
JSHandleId idval,
HandleObject obj,
HandleId idval,
JSBool strict,
MutableHandleValue vp)
{
@ -4254,7 +4254,7 @@ ArrayType::CreateInternal(JSContext* cx,
JSBool
ArrayType::ConstructData(JSContext* cx,
JSHandleObject obj_,
HandleObject obj_,
const CallArgs& args)
{
RootedObject obj(cx, obj_); // Make a mutable version
@ -4449,7 +4449,7 @@ ArrayType::BuildFFIType(JSContext* cx, JSObject* obj)
}
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) {
JS_ReportError(cx, "not an ArrayType");
@ -4462,7 +4462,7 @@ ArrayType::ElementTypeGetter(JSContext* cx, JSHandleObject obj, JSHandleId idval
}
JSBool
ArrayType::LengthGetter(JSContext* cx, JSHandleObject obj_, JSHandleId idval, MutableHandleValue vp)
ArrayType::LengthGetter(JSContext* cx, HandleObject obj_, HandleId idval, MutableHandleValue vp)
{
JSObject *obj = obj_;
@ -4482,7 +4482,7 @@ ArrayType::LengthGetter(JSContext* cx, JSHandleObject obj_, JSHandleId idval, Mu
}
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.
if (!CData::IsCData(obj)) {
@ -4518,7 +4518,7 @@ ArrayType::Getter(JSContext* cx, JSHandleObject obj, JSHandleId idval, MutableHa
}
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.
if (!CData::IsCData(obj)) {
@ -5118,7 +5118,7 @@ StructType::BuildFieldsArray(JSContext* cx, JSObject* obj)
}
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) {
JS_ReportError(cx, "not a StructType");
@ -5148,7 +5148,7 @@ StructType::FieldsArrayGetter(JSContext* cx, JSHandleObject obj, JSHandleId idva
}
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)) {
JS_ReportError(cx, "not a CData");
@ -5171,7 +5171,7 @@ StructType::FieldGetter(JSContext* cx, JSHandleObject obj, JSHandleId idval, Mut
}
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)) {
JS_ReportError(cx, "not a CData");
@ -5635,10 +5635,10 @@ FunctionType::CreateInternal(JSContext* cx,
// PointerType::ConstructData().
JSBool
FunctionType::ConstructData(JSContext* cx,
JSHandleObject typeObj,
JSHandleObject dataObj,
JSHandleObject fnObj,
JSHandleObject thisObj,
HandleObject typeObj,
HandleObject dataObj,
HandleObject fnObj,
HandleObject thisObj,
jsval errVal)
{
JS_ASSERT(CType::GetTypeCode(typeObj) == TYPE_function);
@ -5890,7 +5890,7 @@ CheckFunctionType(JSContext* cx, JSObject* obj)
}
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))
return JS_FALSE;
@ -5925,7 +5925,7 @@ FunctionType::ArgTypesGetter(JSContext* cx, JSHandleObject obj, JSHandleId idval
}
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))
return JS_FALSE;
@ -5936,7 +5936,7 @@ FunctionType::ReturnTypeGetter(JSContext* cx, JSHandleObject obj, JSHandleId idv
}
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))
return JS_FALSE;
@ -5947,7 +5947,7 @@ FunctionType::ABIGetter(JSContext* cx, JSHandleObject obj, JSHandleId idval, Mut
}
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))
return JS_FALSE;
@ -6394,7 +6394,7 @@ CData::IsCDataProto(JSObject* obj)
}
JSBool
CData::ValueGetter(JSContext* cx, JSHandleObject obj, JSHandleId idval, MutableHandleValue vp)
CData::ValueGetter(JSContext* cx, HandleObject obj, HandleId idval, MutableHandleValue vp)
{
if (!IsCData(obj)) {
JS_ReportError(cx, "not a CData");
@ -6410,7 +6410,7 @@ CData::ValueGetter(JSContext* cx, JSHandleObject obj, JSHandleId idval, MutableH
}
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)) {
JS_ReportError(cx, "not a CData");
@ -6639,7 +6639,7 @@ CData::ReadStringReplaceMalformed(JSContext* cx, unsigned argc, jsval* vp)
}
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.
// First, we build up the type expression:
@ -6693,7 +6693,7 @@ CData::ToSource(JSContext* cx, unsigned argc, jsval* vp)
}
JSBool
CData::ErrnoGetter(JSContext* cx, JSHandleObject obj, JSHandleId, MutableHandleValue vp)
CData::ErrnoGetter(JSContext* cx, HandleObject obj, HandleId, MutableHandleValue vp)
{
if (!IsCTypesGlobal(obj)) {
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)
JSBool
CData::LastErrorGetter(JSContext* cx, JSHandleObject obj, JSHandleId, MutableHandleValue vp)
CData::LastErrorGetter(JSContext* cx, HandleObject obj, HandleId, MutableHandleValue vp)
{
if (!IsCTypesGlobal(obj)) {
JS_ReportError(cx, "not global object ctypes");

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

@ -311,15 +311,15 @@ bool IsCTypesGlobal(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);
JSBool ImplicitConvert(JSContext* cx, JSHandleValue val, JSObject* targetType,
JSBool ImplicitConvert(JSContext* cx, HandleValue val, JSObject* targetType,
void* buffer, bool isArgument, bool* freePointer);
JSBool ExplicitConvert(JSContext* cx, JSHandleValue val, JSHandleObject targetType,
JSBool ExplicitConvert(JSContext* cx, HandleValue val, HandleObject targetType,
void* buffer);
/*******************************************************************************
@ -419,7 +419,7 @@ enum Int64FunctionSlot {
*******************************************************************************/
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);
JSObject* DefineBuiltin(JSContext* cx, JSObject* parent, const char* propName,
@ -435,20 +435,20 @@ namespace CType {
bool IsSizeDefined(JSObject* obj);
size_t GetAlignment(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* GetProtoFromType(JSContext* cx, JSObject* obj, CTypeProtoSlot slot);
JSCTypesCallbacks* GetCallbacksFromType(JSObject* obj);
}
namespace PointerType {
JSObject* CreateInternal(JSContext* cx, JSHandleObject baseType);
JSObject* CreateInternal(JSContext* cx, HandleObject baseType);
JSObject* GetBaseType(JSObject* obj);
}
namespace ArrayType {
JSObject* CreateInternal(JSContext* cx, JSHandleObject baseType, size_t length,
JSObject* CreateInternal(JSContext* cx, HandleObject baseType, size_t length,
bool lengthDefined);
JSObject* GetBaseType(JSObject* obj);
@ -479,12 +479,12 @@ namespace FunctionType {
}
namespace CClosure {
JSObject* Create(JSContext* cx, JSHandleObject typeObj, JSHandleObject fnObj,
JSHandleObject thisObj, jsval errVal, PRFuncPtr* fnptr);
JSObject* Create(JSContext* cx, HandleObject typeObj, HandleObject fnObj,
HandleObject thisObj, jsval errVal, PRFuncPtr* fnptr);
}
namespace CData {
JSObject* Create(JSContext* cx, JSHandleObject typeObj, JSHandleObject refObj,
JSObject* Create(JSContext* cx, HandleObject typeObj, HandleObject refObj,
void* data, bool ownResult);
JSObject* GetCType(JSObject* dataObj);

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

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

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

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

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

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

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

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

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

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

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

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

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

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

@ -513,24 +513,6 @@ MarkValueInternal(JSTracer *trc, Value *v)
}
}
static inline void
MarkValueInternalMaybeNullPayload(JSTracer *trc, Value *v)
{
if (v->isMarkable()) {
void *thing = v->toGCThing();
if (thing) {
JS_SET_TRACING_LOCATION(trc, (void *)v);
MarkKind(trc, &thing, v->gcKind());
if (v->isString())
v->setString((JSString *)thing);
else
v->setObjectOrNull((JSObject *)thing);
return;
}
}
JS_UNSET_TRACING_LOCATION(trc);
}
void
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
gc::IsValueMarked(Value *v)
{

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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