Bug 993026 - Rename NewResolve to Resolve in browser. r=bz

This commit is contained in:
Tom Schuster 2014-11-08 01:07:12 +01:00
parent 18c9617c27
commit 8a051a23e7
18 changed files with 62 additions and 62 deletions

View File

@ -1961,9 +1961,9 @@ Navigator::GetMozAudioChannelManager(ErrorResult& aRv)
#endif
bool
Navigator::DoNewResolve(JSContext* aCx, JS::Handle<JSObject*> aObject,
JS::Handle<jsid> aId,
JS::MutableHandle<JSPropertyDescriptor> aDesc)
Navigator::DoResolve(JSContext* aCx, JS::Handle<JSObject*> aObject,
JS::Handle<jsid> aId,
JS::MutableHandle<JSPropertyDescriptor> aDesc)
{
if (!JSID_IS_STRING(aId)) {
return true;

View File

@ -274,9 +274,9 @@ public:
already_AddRefed<ServiceWorkerContainer> ServiceWorker();
bool DoNewResolve(JSContext* aCx, JS::Handle<JSObject*> aObject,
JS::Handle<jsid> aId,
JS::MutableHandle<JSPropertyDescriptor> aDesc);
bool DoResolve(JSContext* aCx, JS::Handle<JSObject*> aObject,
JS::Handle<jsid> aId,
JS::MutableHandle<JSPropertyDescriptor> aDesc);
void GetOwnPropertyNames(JSContext* aCx, nsTArray<nsString>& aNames,
ErrorResult& aRv);
void GetLanguages(nsTArray<nsString>& aLanguages);
@ -358,7 +358,7 @@ private:
nsRefPtr<ServiceWorkerContainer> mServiceWorkerContainer;
nsCOMPtr<nsPIDOMWindow> mWindow;
// Hashtable for saving cached objects newresolve created, so we don't create
// Hashtable for saving cached objects DoResolve created, so we don't create
// the object twice if asked for it twice, whether due to use of "delete" or
// due to Xrays. We could probably use a nsJSThingHashtable here, but then
// we'd need to figure out exactly how to trace that, and that seems to be

View File

@ -2151,7 +2151,7 @@ nsWindowSH::GlobalResolve(nsGlobalWindow *aWin, JSContext *cx,
nsScriptNameSpaceManager *nameSpaceManager = GetNameSpaceManager();
NS_ENSURE_TRUE(nameSpaceManager, NS_ERROR_NOT_INITIALIZED);
// Note - Our only caller is nsGlobalWindow::DoNewResolve, which checks that
// Note - Our only caller is nsGlobalWindow::DoResolve, which checks that
// JSID_IS_STRING(id) is true.
nsAutoJSString name;
if (!name.init(cx, JSID_TO_STRING(id))) {

View File

@ -4238,9 +4238,9 @@ nsGlobalWindow::GetSupportedNames(nsTArray<nsString>& aNames)
}
bool
nsGlobalWindow::DoNewResolve(JSContext* aCx, JS::Handle<JSObject*> aObj,
JS::Handle<jsid> aId,
JS::MutableHandle<JSPropertyDescriptor> aDesc)
nsGlobalWindow::DoResolve(JSContext* aCx, JS::Handle<JSObject*> aObj,
JS::Handle<jsid> aId,
JS::MutableHandle<JSPropertyDescriptor> aDesc)
{
MOZ_ASSERT(IsInnerWindow());

View File

@ -483,9 +483,9 @@ public:
static bool IsShowModalDialogEnabled(JSContext* /* unused */ = nullptr,
JSObject* /* unused */ = nullptr);
bool DoNewResolve(JSContext* aCx, JS::Handle<JSObject*> aObj,
JS::Handle<jsid> aId,
JS::MutableHandle<JSPropertyDescriptor> aDesc);
bool DoResolve(JSContext* aCx, JS::Handle<JSObject*> aObj,
JS::Handle<jsid> aId,
JS::MutableHandle<JSPropertyDescriptor> aDesc);
void GetOwnPropertyNames(JSContext* aCx, nsTArray<nsString>& aNames,
mozilla::ErrorResult& aRv);

View File

@ -3622,9 +3622,9 @@ nsObjectLoadingContent::TeardownProtoChain()
}
bool
nsObjectLoadingContent::DoNewResolve(JSContext* aCx, JS::Handle<JSObject*> aObject,
JS::Handle<jsid> aId,
JS::MutableHandle<JSPropertyDescriptor> aDesc)
nsObjectLoadingContent::DoResolve(JSContext* aCx, JS::Handle<JSObject*> aObject,
JS::Handle<jsid> aId,
JS::MutableHandle<JSPropertyDescriptor> aDesc)
{
// We don't resolve anything; we just try to make sure we're instantiated.
// This purposefully does not fire for chrome/xray resolves, see bug 967694
@ -3642,7 +3642,7 @@ nsObjectLoadingContent::GetOwnPropertyNames(JSContext* aCx,
nsTArray<nsString>& /* unused */,
ErrorResult& aRv)
{
// Just like DoNewResolve, just make sure we're instantiated. That will do
// Just like DoResolve, just make sure we're instantiated. That will do
// the work our Enumerate hook needs to do. This purposefully does not fire
// for xray resolves, see bug 967694
nsRefPtr<nsNPAPIPluginInstance> pi;

View File

@ -157,7 +157,7 @@ class nsObjectLoadingContent : public nsImageLoadingContent
* SetupProtoChain handles actually inserting the plug-in
* scriptable object into the proto chain if needed.
*
* DoNewResolve is a hook that allows us to find out when the web
* DoResolve is a hook that allows us to find out when the web
* page is looking up a property name on our object and make sure
* that our plug-in, if any, is instantiated.
*/
@ -167,10 +167,10 @@ class nsObjectLoadingContent : public nsImageLoadingContent
// Remove plugin from protochain
void TeardownProtoChain();
// Helper for WebIDL newResolve
bool DoNewResolve(JSContext* aCx, JS::Handle<JSObject*> aObject,
JS::Handle<jsid> aId,
JS::MutableHandle<JSPropertyDescriptor> aDesc);
// Helper for WebIDL NeedResolve
bool DoResolve(JSContext* aCx, JS::Handle<JSObject*> aObject,
JS::Handle<jsid> aId,
JS::MutableHandle<JSPropertyDescriptor> aDesc);
// Helper for WebIDL enumeration
void GetOwnPropertyNames(JSContext* aCx, nsTArray<nsString>& /* unused */,
mozilla::ErrorResult& aRv);

View File

@ -21,7 +21,7 @@ OBJECT_MOVED_HOOK_NAME = '_objectMoved'
CONSTRUCT_HOOK_NAME = '_constructor'
LEGACYCALLER_HOOK_NAME = '_legacycaller'
HASINSTANCE_HOOK_NAME = '_hasInstance'
NEWRESOLVE_HOOK_NAME = '_newResolve'
RESOLVE_HOOK_NAME = '_resolve'
ENUMERATE_HOOK_NAME = '_enumerate'
ENUM_ENTRY_VARIABLE_NAME = 'strings'
INSTANCE_RESERVED_SLOTS = 1
@ -275,7 +275,7 @@ class CGNativePropertyHooks(CGThing):
resolveOwnProperty = "ResolveOwnProperty"
enumerateOwnProperties = "EnumerateOwnProperties"
elif self.descriptor.needsXrayResolveHooks():
resolveOwnProperty = "ResolveOwnPropertyViaNewresolve"
resolveOwnProperty = "ResolveOwnPropertyViaResolve"
enumerateOwnProperties = "EnumerateOwnPropertiesViaGetOwnPropertyNames"
else:
resolveOwnProperty = "nullptr"
@ -418,14 +418,14 @@ class CGDOMJSClass(CGThing):
else:
classFlags += "JSCLASS_HAS_RESERVED_SLOTS(%d)" % slotCount
reservedSlots = slotCount
if self.descriptor.interface.getExtendedAttribute("NeedNewResolve"):
newResolveHook = NEWRESOLVE_HOOK_NAME
if self.descriptor.interface.getExtendedAttribute("NeedResolve"):
resolveHook = RESOLVE_HOOK_NAME
enumerateHook = ENUMERATE_HOOK_NAME
elif self.descriptor.isGlobal():
newResolveHook = "mozilla::dom::ResolveGlobal"
resolveHook = "mozilla::dom::ResolveGlobal"
enumerateHook = "mozilla::dom::EnumerateGlobal"
else:
newResolveHook = "JS_ResolveStub"
resolveHook = "JS_ResolveStub"
enumerateHook = "JS_EnumerateStub"
return fill(
@ -459,7 +459,7 @@ class CGDOMJSClass(CGThing):
flags=classFlags,
addProperty=ADDPROPERTY_HOOK_NAME if wantsAddProperty(self.descriptor) else 'JS_PropertyStub',
enumerate=enumerateHook,
resolve=newResolveHook,
resolve=resolveHook,
finalize=FINALIZE_HOOK_NAME,
call=callHook,
trace=traceHook,
@ -7597,12 +7597,12 @@ class CGLegacyCallHook(CGAbstractBindingMethod):
self._legacycaller)
class CGNewResolveHook(CGAbstractBindingMethod):
class CGResolveHook(CGAbstractBindingMethod):
"""
NewResolve hook for objects with custom hooks.
Resolve hook for objects that have the NeedResolve extended attribute.
"""
def __init__(self, descriptor):
assert descriptor.interface.getExtendedAttribute("NeedNewResolve")
assert descriptor.interface.getExtendedAttribute("NeedResolve")
args = [Argument('JSContext*', 'cx'),
Argument('JS::Handle<JSObject*>', 'obj'),
@ -7610,19 +7610,19 @@ class CGNewResolveHook(CGAbstractBindingMethod):
Argument('bool*', 'resolvedp')]
# Our "self" is actually the "obj" argument in this case, not the thisval.
CGAbstractBindingMethod.__init__(
self, descriptor, NEWRESOLVE_HOOK_NAME,
self, descriptor, RESOLVE_HOOK_NAME,
args, getThisObj="", callArgs="")
def generate_code(self):
return CGGeneric(dedent("""
JS::Rooted<JSPropertyDescriptor> desc(cx);
if (!self->DoNewResolve(cx, obj, id, &desc)) {
if (!self->DoResolve(cx, obj, id, &desc)) {
return false;
}
if (!desc.object()) {
return true;
}
// If desc.value() is undefined, then the DoNewResolve call
// If desc.value() is undefined, then the DoResolve call
// has already defined it on the object. Don't try to also
// define it.
if (!desc.value().isUndefined() &&
@ -7658,7 +7658,7 @@ class CGEnumerateHook(CGAbstractBindingMethod):
Enumerate hook for objects with custom hooks.
"""
def __init__(self, descriptor):
assert descriptor.interface.getExtendedAttribute("NeedNewResolve")
assert descriptor.interface.getExtendedAttribute("NeedResolve")
args = [Argument('JSContext*', 'cx'),
Argument('JS::Handle<JSObject*>', 'obj')]
@ -9564,10 +9564,10 @@ class CGResolveOwnProperty(CGAbstractStaticMethod):
return "return js::GetProxyHandler(obj)->getOwnPropertyDescriptor(cx, wrapper, id, desc);\n"
class CGResolveOwnPropertyViaNewresolve(CGAbstractBindingMethod):
class CGResolveOwnPropertyViaResolve(CGAbstractBindingMethod):
"""
An implementation of Xray ResolveOwnProperty stuff for things that have a
newresolve hook.
resolve hook.
"""
def __init__(self, descriptor):
args = [Argument('JSContext*', 'cx'),
@ -9576,7 +9576,7 @@ class CGResolveOwnPropertyViaNewresolve(CGAbstractBindingMethod):
Argument('JS::Handle<jsid>', 'id'),
Argument('JS::MutableHandle<JSPropertyDescriptor>', 'desc')]
CGAbstractBindingMethod.__init__(self, descriptor,
"ResolveOwnPropertyViaNewresolve",
"ResolveOwnPropertyViaResolve",
args, getThisObj="",
callArgs="")
@ -9591,10 +9591,10 @@ class CGResolveOwnPropertyViaNewresolve(CGAbstractBindingMethod):
// them.
JSAutoCompartment ac(cx, obj);
JS::Rooted<JSPropertyDescriptor> objDesc(cx);
if (!self->DoNewResolve(cx, obj, id, &objDesc)) {
if (!self->DoResolve(cx, obj, id, &objDesc)) {
return false;
}
// If desc.value() is undefined, then the DoNewResolve call
// If desc.value() is undefined, then the DoResolve call
// has already defined the property on the object. Don't
// try to also define it.
if (objDesc.object() &&
@ -9606,7 +9606,7 @@ class CGResolveOwnPropertyViaNewresolve(CGAbstractBindingMethod):
return false;
}
}
return self->DoNewResolve(cx, wrapper, id, desc);
return self->DoResolve(cx, wrapper, id, desc);
"""))
@ -9626,7 +9626,7 @@ class CGEnumerateOwnProperties(CGAbstractStaticMethod):
class CGEnumerateOwnPropertiesViaGetOwnPropertyNames(CGAbstractBindingMethod):
"""
An implementation of Xray EnumerateOwnProperties stuff for things
that have a newresolve hook.
that have a resolve hook.
"""
def __init__(self, descriptor):
args = [Argument('JSContext*', 'cx'),
@ -11092,7 +11092,7 @@ class CGDescriptor(CGThing):
cgThings.append(CGResolveOwnProperty(descriptor))
cgThings.append(CGEnumerateOwnProperties(descriptor))
elif descriptor.needsXrayResolveHooks():
cgThings.append(CGResolveOwnPropertyViaNewresolve(descriptor))
cgThings.append(CGResolveOwnPropertyViaResolve(descriptor))
cgThings.append(CGEnumerateOwnPropertiesViaGetOwnPropertyNames(descriptor))
# Now that we have our ResolveOwnProperty/EnumerateOwnProperties stuff
@ -11109,8 +11109,8 @@ class CGDescriptor(CGThing):
cgThings.append(CGNamedConstructors(descriptor))
cgThings.append(CGLegacyCallHook(descriptor))
if descriptor.interface.getExtendedAttribute("NeedNewResolve"):
cgThings.append(CGNewResolveHook(descriptor))
if descriptor.interface.getExtendedAttribute("NeedResolve"):
cgThings.append(CGResolveHook(descriptor))
cgThings.append(CGEnumerateHook(descriptor))
if descriptor.hasNamedPropertiesObject:

View File

@ -663,14 +663,14 @@ class Descriptor(DescriptorProvider):
def needsXrayResolveHooks(self):
"""
Generally, any interface with NeedNewResolve needs Xray
Generally, any interface with NeedResolve needs Xray
resolveOwnProperty and enumerateOwnProperties hooks. But for
the special case of plugin-loading elements, we do NOT want
those, because we don't want to instantiate plug-ins simply
due to chrome touching them and that's all those hooks do on
those elements. So we special-case those here.
"""
return (self.interface.getExtendedAttribute("NeedNewResolve") and
return (self.interface.getExtendedAttribute("NeedResolve") and
self.interface.identifier.name not in ["HTMLObjectElement",
"HTMLEmbedElement",
"HTMLAppletElement"])

View File

@ -1225,7 +1225,7 @@ class IDLInterface(IDLObjectWithScope):
self.parentScope.globalNames.add(self.identifier.name)
self.parentScope.globalNameMapping[self.identifier.name].add(self.identifier.name)
self._isOnGlobalProtoChain = True
elif (identifier == "NeedNewResolve" or
elif (identifier == "NeedResolve" or
identifier == "OverrideBuiltins" or
identifier == "ChromeOnly" or
identifier == "Unforgeable" or

View File

@ -158,8 +158,8 @@ NPObjWrapper_newEnumerate(JSContext *cx, JS::Handle<JSObject*> obj, JSIterateOp
JS::Value *statep, jsid *idp);
static bool
NPObjWrapper_NewResolve(JSContext *cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id,
bool *resolvedp);
NPObjWrapper_Resolve(JSContext *cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id,
bool *resolvedp);
static bool
NPObjWrapper_Convert(JSContext *cx, JS::Handle<JSObject*> obj, JSType type, JS::MutableHandle<JS::Value> vp);
@ -190,7 +190,7 @@ const static js::Class sNPObjectJSWrapperClass =
NPObjWrapper_GetProperty,
NPObjWrapper_SetProperty,
(JSEnumerateOp)NPObjWrapper_newEnumerate,
NPObjWrapper_NewResolve,
NPObjWrapper_Resolve,
NPObjWrapper_Convert,
NPObjWrapper_Finalize,
NPObjWrapper_Call,
@ -1653,8 +1653,8 @@ NPObjWrapper_newEnumerate(JSContext *cx, JS::Handle<JSObject*> obj, JSIterateOp
}
static bool
NPObjWrapper_NewResolve(JSContext *cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id,
bool *resolvedp)
NPObjWrapper_Resolve(JSContext *cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id,
bool *resolvedp)
{
if (JSID_IS_SYMBOL(id))
return true;

View File

@ -12,7 +12,7 @@
*/
// http://www.whatwg.org/specs/web-apps/current-work/#the-applet-element
[NeedNewResolve]
[NeedResolve]
interface HTMLAppletElement : HTMLElement {
[Pure, SetterThrows]
attribute DOMString align;

View File

@ -13,7 +13,7 @@
*/
// http://www.whatwg.org/specs/web-apps/current-work/#the-embed-element
[NeedNewResolve]
[NeedResolve]
interface HTMLEmbedElement : HTMLElement {
[Pure, SetterThrows]
attribute DOMString src;

View File

@ -13,7 +13,7 @@
*/
// http://www.whatwg.org/specs/web-apps/current-work/#the-object-element
[NeedNewResolve]
[NeedResolve]
interface HTMLObjectElement : HTMLElement {
[Pure, SetterThrows]
attribute DOMString data;

View File

@ -19,7 +19,7 @@
*/
// http://www.whatwg.org/specs/web-apps/current-work/#the-navigator-object
[HeaderFile="Navigator.h", NeedNewResolve]
[HeaderFile="Navigator.h", NeedResolve]
interface Navigator {
// objects implementing this interface also implement the interfaces given below
};

View File

@ -24,7 +24,7 @@ interface nsIDOMCrypto;
typedef any Transferable;
// http://www.whatwg.org/specs/web-apps/current-work/
[PrimaryGlobal, NeedNewResolve]
[PrimaryGlobal, NeedResolve]
/*sealed*/ interface Window : EventTarget {
// the current browsing context
[Unforgeable, Throws,

View File

@ -17,7 +17,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=853283
<!-- test code goes here -->
<script type="application/javascript">
<![CDATA[
/** Test nsNavigatorSH::NewResolve in conjunction with Xrays.**/
/** Test nsNavigatorSH::Resolve in conjunction with Xrays.**/
SimpleTest.waitForExplicitFinish();
const Cu = Components.utils;

View File

@ -1818,7 +1818,7 @@ XrayWrapper<Base, Traits>::getPropertyDescriptor(JSContext *cx, HandleObject wra
//
// resolveOwnProperty may or may not cache what it finds on the holder,
// depending on how ephemeral it decides the property is. XPCWN |own|
// properties generally end up on the holder via NewResolve, whereas
// properties generally end up on the holder via Resolve, whereas
// NodeList |own| properties don't get defined on the holder, since they're
// supposed to be dynamic. This means that we have to first check the result
// of resolveOwnProperty, and _then_, if that comes up blank, check the