static bool FixWaiverAfterTransplant(JSContext *cx, HandleObject oldWaiver, HandleObject newobj) { MOZ_ASSERT(Wrapper::wrapperHandler(oldWaiver) == &XrayWaiver); MOZ_ASSERT(!js::IsCrossCompartmentWrapper(newobj)); // Create a waiver in the new compartment. We know there's not one already // because we _just_ transplanted, which means that |newobj| was either // created from scratch, or was previously cross-compartment wrapper (which // should have no waiver). CreateXrayWaiver asserts this. JSObject *newWaiver = WrapperFactory::CreateXrayWaiver(cx, newobj); if (!newWaiver) return false; // Update all the cross-compartment references to oldWaiver to point to // newWaiver. if (!js::RemapAllWrappersForObject(cx, oldWaiver, newWaiver)) return false; // There should be no same-compartment references to oldWaiver, and we // just remapped all cross-compartment references. It's dead, so we can // remove it from the map. XPCWrappedNativeScope *scope = GetObjectScope(oldWaiver); JSObject *key = Wrapper::wrappedObject(oldWaiver); MOZ_ASSERT(scope->mWaiverWrapperMap->Find(key)); scope->mWaiverWrapperMap->Remove(key); return true; }
JSObject * WrapperFactory::CreateXrayWaiver(JSContext *cx, HandleObject obj) { // The caller is required to have already done a lookup. // NB: This implictly performs the assertions of GetXrayWaiver. MOZ_ASSERT(!GetXrayWaiver(obj)); XPCWrappedNativeScope *scope = GetObjectScope(obj); JSAutoCompartment ac(cx, obj); JSObject *waiver = Wrapper::New(cx, obj, JS_GetGlobalForObject(cx, obj), &XrayWaiver); if (!waiver) return nullptr; // Add the new waiver to the map. It's important that we only ever have // one waiver for the lifetime of the target object. if (!scope->mWaiverWrapperMap) { scope->mWaiverWrapperMap = JSObject2JSObjectMap::newMap(XPC_WRAPPER_MAP_SIZE); MOZ_ASSERT(scope->mWaiverWrapperMap); } if (!scope->mWaiverWrapperMap->Add(cx, obj, waiver)) return nullptr; return waiver; }
bool CoreBioComponent :: EvaluateSmartMessagesAndTriggersForStage (SmartMessagingComm& comm, int numHigherObjects, int stage, bool allMessages, bool signalsOnly) { int i; comm.SMOStack [numHigherObjects] = (SmartMessagingObject*) this; int topNum = numHigherObjects + 1; for (i=1; i<=mNumberOfChannels; i++) mDataChannels [i]->EvaluateSmartMessagesAndTriggersForStage (comm, topNum, stage, allMessages, signalsOnly); if (allMessages || (!signalsOnly)) { SmartMessage::EvaluateAllMessages (comm, topNum, stage, GetObjectScope ()); SmartMessage::SetTriggersForAllMessages (comm, topNum, stage, GetObjectScope ()); } return true; }
bool DataSignal :: EvaluateSmartMessagesForStage (SmartMessagingComm& comm, int numHigherObjects, int stage) { if (stage <= mStageCompleted) return false; mStageCompleted = stage; comm.SMOStack [numHigherObjects] = (SmartMessagingObject*) this; return SmartMessage::EvaluateAllMessages (comm, numHigherObjects + 1, stage, GetObjectScope ()); }
bool DataSignal :: EvaluateSmartMessagesForStage (int stage) { RGDList temp; if (stage <= mStageCompleted) return false; mStageCompleted = stage; return SmartMessage::EvaluateAllMessages (mMessageArray, temp, stage, GetObjectScope ()); }
bool DataSignal :: SetTriggersForAllMessages (SmartMessagingComm& comm, int numHigherObjects, int stage) { if (stage <= mTriggerStageCompleted) return false; mTriggerStageCompleted = stage; double bp = GetApproximateBioID (); int ibp = (int) floor (bp + 0.5); comm.SMOStack [numHigherObjects] = (SmartMessagingObject*) this; return SmartMessage::SetTriggersForAllMessages (comm, numHigherObjects + 1, stage, GetObjectScope (), ibp, mAlleleName); }
void DataSignal :: CaptureSmartMessages (const DataSignal* signal) { int scope = GetObjectScope (); int size = SmartMessage::GetSizeOfArrayForScope (scope); int i; for (i=0; i<size; i++){ if (signal->mMessageArray [i]) SetMessageValue (scope, i, true); } }
JSObject * WrapperFactory::GetXrayWaiver(JSObject *obj) { // Object should come fully unwrapped but outerized. MOZ_ASSERT(obj == UncheckedUnwrap(obj)); MOZ_ASSERT(!js::GetObjectClass(obj)->ext.outerObject); XPCWrappedNativeScope *scope = GetObjectScope(obj); MOZ_ASSERT(scope); if (!scope->mWaiverWrapperMap) return NULL; return xpc_UnmarkGrayObject(scope->mWaiverWrapperMap->Find(obj)); }
bool CoreBioComponent :: EvaluateSmartMessagesForStage (int stage, bool allMessages, bool signalsOnly) { int i; bool status = true; for (i=1; i<=mNumberOfChannels; i++) mDataChannels [i]->EvaluateSmartMessagesForStage (stage, allMessages, signalsOnly); if (allMessages || (!signalsOnly)) status = SmartMessage::EvaluateAllMessages (mMessageArray, mChannelList, stage, GetObjectScope ()); return status; }
bool CoreBioComponent :: SetTriggersForAllMessages (SmartMessagingComm& comm, int numHigherObjects, int stage, bool allMessages, bool signalsOnly) { int i; bool status = true; comm.SMOStack [numHigherObjects] = (SmartMessagingObject*) this; int newNum = numHigherObjects + 1; for (i=1; i<=mNumberOfChannels; i++) mDataChannels [i]->SetTriggersForAllMessages (comm, newNum, stage, allMessages, signalsOnly); if (allMessages || (!signalsOnly)) status = SmartMessage::SetTriggersForAllMessages (comm, newNum, stage, GetObjectScope ()); return status; }
void DataSignal :: SetMessageValue (int scope, int location, bool value) { int myScope = GetObjectScope (); if (myScope == scope) { SmartMessage* msg = SmartMessage::GetSmartMessageForScopeAndElement (scope, location); msg->SetMessageValue (mMessageArray, mValueArray, location, value); if (value) { bool call = msg->EvaluateCall (mMessageArray); if (!call) mDoNotCall = true; } } }
JSObject * WrapperFactory::GetXrayWaiver(HandleObject obj) { // Object should come fully unwrapped but outerized. MOZ_ASSERT(obj == UncheckedUnwrap(obj)); MOZ_ASSERT(!js::GetObjectClass(obj)->ext.outerObject); XPCWrappedNativeScope *scope = GetObjectScope(obj); MOZ_ASSERT(scope); if (!scope->mWaiverWrapperMap) return nullptr; JSObject* xrayWaiver = scope->mWaiverWrapperMap->Find(obj); if (xrayWaiver) JS::ExposeObjectToActiveJS(xrayWaiver); return xrayWaiver; }
void DataSignal :: SetMessageValue (const SmartNotice& notice, bool value) { int scope = GetObjectScope (); if (notice.GetScope () == scope) { int index = notice.GetMessageIndex (); mMessageArray [index] = value; if (value) { SmartMessage* msg = SmartMessage::GetSmartMessageForScopeAndElement (scope, index); bool call = msg->EvaluateCall (mMessageArray); if (!call) mDoNotCall = true; } } }
int DataSignal :: AddAllSmartMessageReporters () { int k = GetObjectScope (); int size = SmartMessage::GetSizeOfArrayForScope (k); int i; int nMsgs = 0; SmartMessageReporter* newMsg; SmartMessage* nextSmartMsg; SmartMessageData target; SmartMessageData* smd; bool call; for (i=0; i<size; i++) { if (!mMessageArray [i]) continue; nextSmartMsg = SmartMessage::GetSmartMessageForScopeAndElement (k, i); call = nextSmartMsg->EvaluateCall (mMessageArray); if (!call) mDoNotCall = true; if (!nextSmartMsg->EvaluateReport (mMessageArray)) continue; target.SetIndex (i); smd = (SmartMessageData*) mMessageDataTable->Find (&target); newMsg = new SmartMessageReporter; newMsg->SetSmartMessage (nextSmartMsg); if (smd != NULL) newMsg->SetData (smd); newMsg->SetPriorityLevel (nextSmartMsg->EvaluateReportLevel (mMessageArray)); newMsg->SetRestrictionLevel (nextSmartMsg->EvaluateRestrictionLevel (mMessageArray)); newMsg->SetDoNotCall (!call); nMsgs = AddSmartMessageReporter (newMsg); } MergeAllSmartMessageReporters (); return nMsgs; }
void DataSignal :: SetMessageValue (int scope, int location, bool value, bool useVirtualMethod) { if (useVirtualMethod) SetMessageValue (scope, location, value); else if (scope == GetObjectScope ()) { mMessageArray [location] = value; if (value) { SmartMessage* msg = SmartMessage::GetSmartMessageForScopeAndElement (scope, location); bool call = msg->EvaluateCall (mMessageArray); if (!call) mDoNotCall = true; } } }
int CoreBioComponent :: AddAllSmartMessageReporters () { int k = GetObjectScope (); int size = SmartMessage::GetSizeOfArrayForScope (k); int i; int nMsgs = 0; SmartMessageReporter* newMsg; SmartMessage* nextSmartMsg; SmartMessageData target; SmartMessageData* smd; for (i=1; i<=mNumberOfChannels; i++) mDataChannels [i]->AddAllSmartMessageReporters (); for (i=0; i<size; i++) { if (!mMessageArray [i]) continue; nextSmartMsg = SmartMessage::GetSmartMessageForScopeAndElement (k, i); if (!nextSmartMsg->EvaluateReport (mMessageArray)) continue; target.SetIndex (i); smd = (SmartMessageData*) mMessageDataTable->Find (&target); newMsg = new SmartMessageReporter; newMsg->SetSmartMessage (nextSmartMsg); if (smd != NULL) newMsg->SetData (smd); newMsg->SetPriorityLevel (nextSmartMsg->EvaluateReportLevel (mMessageArray)); newMsg->SetRestrictionLevel (nextSmartMsg->EvaluateRestrictionLevel (mMessageArray)); nMsgs = AddSmartMessageReporter (newMsg); } MergeAllSmartMessageReporters (); return nMsgs; }
int CoreBioComponent :: AddAllSmartMessageReporters (SmartMessagingComm& comm, int numHigherObjects) { int k = GetObjectScope (); int size = SmartMessage::GetSizeOfArrayForScope (k); int i; int nMsgs = 0; SmartMessageReporter* newMsg; SmartMessage* nextSmartMsg; SmartMessageData target; SmartMessageData* smd; bool editable; bool enabled; bool hasExportProtocolInfo; bool report; bool mirror; bool displayExport; for (i=1; i<=mNumberOfChannels; i++) mDataChannels [i]->AddAllSmartMessageReporters (comm, numHigherObjects); for (i=0; i<size; i++) { nextSmartMsg = SmartMessage::GetSmartMessageForScopeAndElement (k, i); editable = nextSmartMsg->IsEditable (); hasExportProtocolInfo = nextSmartMsg->HasExportProtocolInfo (); if (!mMessageArray [i]) { enabled = false; if (!editable) continue; if (!hasExportProtocolInfo) continue; } else enabled = true; report = nextSmartMsg->EvaluateReportContingent (comm, numHigherObjects); mirror = nextSmartMsg->UseDefaultExportDisplayMode (); if (mirror) displayExport = report; else displayExport = nextSmartMsg->DisplayExportInfo (); if (!report && !displayExport) continue; target.SetIndex (i); smd = (SmartMessageData*) mMessageDataTable->Find (&target); newMsg = new SmartMessageReporter; newMsg->SetSmartMessage (nextSmartMsg); if (smd != NULL) newMsg->SetData (smd); newMsg->SetPriorityLevel (nextSmartMsg->EvaluateReportLevel (comm, numHigherObjects)); newMsg->SetRestrictionLevel (nextSmartMsg->EvaluateRestrictionLevel (comm, numHigherObjects)); newMsg->SetEditable (editable); newMsg->SetEnabled (enabled); newMsg->SetDisplayExportInfo (displayExport); newMsg->SetDisplayOsirisInfo (report); if (hasExportProtocolInfo) { newMsg->SetExportProtocolInformation (nextSmartMsg->GetExportProtocolList ()); SmartMessagingObject::InsertExportSpecificationsIntoTable (nextSmartMsg); } newMsg->ComputeViabilityOfExportInfo (); nMsgs = AddSmartMessageReporter (newMsg); } MergeAllSmartMessageReporters (); return nMsgs; }
bool DataSignal :: EvaluateAllReportLevels (int* const reportLevelMatrix) { return SmartMessage::EvaluateAllReportLevels (mMessageArray, reportLevelMatrix, GetObjectScope ()); }
bool DataSignal :: TestAllMessagesForCall () { return SmartMessage::TestAllMessagesForCall (mMessageArray, GetObjectScope ()); }
bool CoreBioComponent :: SetTriggersForAllMessages (bool* const higherMsgMatrix, int stage, bool allMessages, bool signalsOnly) { int i; bool status = true; for (i=1; i<=mNumberOfChannels; i++) mDataChannels [i]->SetTriggersForAllMessages (mMessageArray, stage, allMessages, signalsOnly); if (allMessages || (!signalsOnly)) status = SmartMessage::SetTriggersForAllMessages (mMessageArray, higherMsgMatrix, stage, GetObjectScope ()); return status; }
bool DataSignal :: SetTriggersForAllMessages (bool* const higherMsgMatrix, RGHashTable* messageDataTable, int higherScope, int stage) { if (stage <= mTriggerStageCompleted) return false; mTriggerStageCompleted = stage; double bp = GetApproximateBioID (); int ibp = (int) floor (bp + 0.5); return SmartMessage::SetTriggersForAllMessages (mMessageArray, higherMsgMatrix, messageDataTable, stage, GetObjectScope (), higherScope, ibp, mAlleleName); }
bool CoreBioComponent :: TestAllMessagesForCall () { return SmartMessage::TestAllMessagesForCall (mMessageArray, GetObjectScope ()); }
bool CoreBioComponent :: EvaluateAllReportLevels (int* const reportLevelMatrix) { return SmartMessage::EvaluateAllReportLevels (mMessageArray, reportLevelMatrix, GetObjectScope ()); }
void CoreBioComponent :: InitializeMessageData () { int size = SmartMessage::GetSizeOfArrayForScope (GetObjectScope ()); CoreBioComponent::InitializeMessageMatrix (mMessageArray, size); }
void DataSignal :: InitializeMessageData () { int size = SmartMessage::GetSizeOfArrayForScope (GetObjectScope ()); DataSignal::InitializeMessageMatrix (mMessageArray, size); }
int DataSignal :: AddAllSmartMessageReporters (SmartMessagingComm& comm, int numHigherObjects) { if (mReportersAdded) return 0; mReportersAdded = true; int k = GetObjectScope (); int size = SmartMessage::GetSizeOfArrayForScope (k); int i; int nMsgs = 0; SmartMessageReporter* newMsg; SmartMessage* nextSmartMsg; SmartMessageData target; SmartMessageData* smd; bool call; RGString exportProtocol; bool editable; bool enabled; bool hasExportProtocolInfo; bool report; bool mirror; bool displayExport; comm.SMOStack [numHigherObjects] = (SmartMessagingObject*) this; int topNum = numHigherObjects + 1; for (i=0; i<size; i++) { nextSmartMsg = SmartMessage::GetSmartMessageForScopeAndElement (k, i); editable = nextSmartMsg->IsEditable (); hasExportProtocolInfo = nextSmartMsg->HasExportProtocolInfo (); if (!mMessageArray [i]) { enabled = false; if (!editable) continue; if (!hasExportProtocolInfo) continue; } else enabled = true; call = nextSmartMsg->EvaluateCall (comm, topNum); if (!call) mDoNotCall = true; if (!nextSmartMsg->GetAllowPeakEdit ()) mAllowPeakEdit = false; report = nextSmartMsg->EvaluateReportContingent (comm, topNum); mirror = nextSmartMsg->UseDefaultExportDisplayMode (); if (mirror) displayExport = report; else displayExport = nextSmartMsg->DisplayExportInfo (); if (!report && !displayExport) continue; target.SetIndex (i); smd = (SmartMessageData*) mMessageDataTable->Find (&target); newMsg = new SmartMessageReporter; newMsg->SetSmartMessage (nextSmartMsg); if (smd != NULL) newMsg->SetData (smd); newMsg->SetPriorityLevel (nextSmartMsg->EvaluateReportLevel (comm, topNum)); newMsg->SetRestrictionLevel (nextSmartMsg->EvaluateRestrictionLevel (comm, topNum)); newMsg->SetDoNotCall (!call); newMsg->SetEditable (editable); newMsg->SetEnabled (enabled); newMsg->SetDisplayExportInfo (displayExport); newMsg->SetDisplayOsirisInfo (report); if (hasExportProtocolInfo) { newMsg->SetExportProtocolInformation (nextSmartMsg->GetExportProtocolList ()); SmartMessagingObject::InsertExportSpecificationsIntoTable (nextSmartMsg); } newMsg->ComputeViabilityOfExportInfo (); nMsgs = AddSmartMessageReporter (newMsg); } MergeAllSmartMessageReporters (); return nMsgs; }