Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[embedlite] Remove the no longer needed Enter/LeaveSecureJSContext. C…
…ontributes to JB#49549
  • Loading branch information
paveltkv committed Apr 22, 2020
1 parent fd81d8b commit 35cec21
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 40 deletions.
36 changes: 1 addition & 35 deletions embedding/embedlite/modules/EmbedLiteAppService.cpp
Expand Up @@ -66,8 +66,7 @@ namespace
}

EmbedLiteAppService::EmbedLiteAppService()
: mPushedSomething(0)
, mHandlingMessages(false)
: mHandlingMessages(false)
{
}

Expand Down Expand Up @@ -225,39 +224,6 @@ EmbedLiteAppService::HandleAsyncMessage(const char* aMessage, const nsString& aD
}
}

NS_IMETHODIMP EmbedLiteAppService::EnterSecureJSContext()
{
// nsIXPConnect *xpc = nsContentUtils::XPConnect();
// if (!xpc) {
// // If someone tries to push a cx when we don't have the relevant state,
// // it's probably safest to just crash.
// MOZ_CRASH();
// }

// Maybe just nsContentUtils::IsSafeToRunScript(), need to analyze embedlite-components
// or nsContentUtils::AddScriptBlocker() and nsContentUtils::RemoveScriptBlocker
// or nsContentUtils::EnterMicroTask and nsContentUtils::LeaveMicroTask

// if (!xpc::PushNullJSContext()) {
// MOZ_CRASH();
// }

mPushedSomething++;
return NS_OK;
}

NS_IMETHODIMP EmbedLiteAppService::LeaveSecureJSContext()
{
// MOZ_ASSERT(nsContentUtils::XPConnect());
// if (!mPushedSomething) {
// return NS_ERROR_FAILURE;
// }

// xpc::PopNullJSContext();
mPushedSomething--;
return NS_OK;
}

NS_IMETHODIMP
EmbedLiteAppService::AddContentListener(uint32_t aWinId, EmbedLiteContentController* listener)
{
Expand Down
1 change: 0 additions & 1 deletion embedding/embedlite/modules/EmbedLiteAppService.h
Expand Up @@ -39,7 +39,6 @@ class EmbedLiteAppService : public nsIObserver,
std::map<uint64_t, uint32_t> mIDMap;
typedef nsClassHashtable<nsCStringHashKey, nsTArray<nsCOMPtr<nsIEmbedMessageListener> > > MsgListenersArray;
MsgListenersArray mMessageListeners;
int mPushedSomething;
bool mHandlingMessages;
};

Expand Down
4 changes: 0 additions & 4 deletions embedding/embedlite/modules/nsIEmbedAppService.idl
Expand Up @@ -44,10 +44,6 @@ interface nsIEmbedAppService : nsISupports
void addMessageListener(in string name, in nsIEmbedMessageListener listener);
// Un Subscribe from specific JSON Message which EmbedView posting to content from UI
void removeMessageListener(in string name, in nsIEmbedMessageListener listener);
// Push Native secure JSContext into stuck in order to avoid security restrictions
// in case if XPCOM api was executed from non priveledged script, like prompt calls
void enterSecureJSContext();
void leaveSecureJSContext();
// Add listener for AZPC Gecko notifications (single/long/double tap..)
[noscript] void addContentListener(in uint32_t aId, in EmbedLiteContentController listener);
[noscript] void removeContentListener(in uint32_t aId, in EmbedLiteContentController listener);
Expand Down

0 comments on commit 35cec21

Please sign in to comment.