Bug 1065811 - Clean up ObjectId handling with static type checking. r=billm
While adding the CPOW flag for xray waivers, I discovered a bunch of inconsistency and sloppiness with respect to our handling of object ids, and a general lack of clarity about when the id included flags or not. Given the fact that I'm removing static callability for CPOWs, we _could_ just get rid of the flags, and store the xray waiver state on the answer-side only. But I eventually decided that these kinds of flags (which are accessible to both the Answer _and_ the Owner) had enough potential utility that they were worth cleaning up. It's worth noting that that utility comes with the large caveat that the flags can't be trusted for security-sensitive decisions (at least in the parent->child case), since they could be forged by a compromised child.
This commit is contained in:
@@ -123,7 +123,7 @@ ObjectToIdMap::find(JSObject *obj)
|
||||
{
|
||||
Table::Ptr p = table_->lookup(obj);
|
||||
if (!p)
|
||||
return 0;
|
||||
return ObjectId::nullId();
|
||||
return p->value();
|
||||
}
|
||||
|
||||
@@ -162,7 +162,7 @@ bool JavaScriptShared::sStackLoggingEnabled;
|
||||
JavaScriptShared::JavaScriptShared(JSRuntime *rt)
|
||||
: rt_(rt),
|
||||
refcount_(1),
|
||||
lastId_(0)
|
||||
nextSerialNumber_(1)
|
||||
{
|
||||
if (!sLoggingInitialized) {
|
||||
sLoggingInitialized = true;
|
||||
@@ -381,7 +381,7 @@ JavaScriptShared::ConvertID(const JSIID &from, nsID *to)
|
||||
}
|
||||
|
||||
JSObject *
|
||||
JavaScriptShared::findObjectById(JSContext *cx, uint32_t objId)
|
||||
JavaScriptShared::findObjectById(JSContext *cx, const ObjectId &objId)
|
||||
{
|
||||
RootedObject obj(cx, findObjectById(objId));
|
||||
if (!obj) {
|
||||
|
||||
Reference in New Issue
Block a user