Bug 1539884 - Part 17: Mark nsIScriptLoaderObserver::scriptEvaluated as can_run_script r=masayuki

Depends on D134107

Differential Revision: https://phabricator.services.mozilla.com/D134108
This commit is contained in:
Kagami Sascha Rosylight 2021-12-17 13:27:52 +00:00
parent 6a8c77d944
commit d5c873e8f4
4 changed files with 10 additions and 5 deletions

View File

@ -111,8 +111,10 @@ class ScriptLoadRequest
GetScriptElement()->ScriptAvailable(aResult, GetScriptElement(),
isInlineClassicScript, mURI, mLineNo);
}
void FireScriptEvaluated(nsresult aResult) {
GetScriptElement()->ScriptEvaluated(aResult, GetScriptElement(), mIsInline);
// TODO: Convert this to MOZ_CAN_RUN_SCRIPT (bug 1415230)
MOZ_CAN_RUN_SCRIPT_BOUNDARY void FireScriptEvaluated(nsresult aResult) {
RefPtr<nsIScriptElement> scriptElement = GetScriptElement();
scriptElement->ScriptEvaluated(aResult, scriptElement, mIsInline);
}
bool IsPreload() const {

View File

@ -2099,8 +2099,8 @@ void ScriptLoader::FireScriptEvaluated(nsresult aResult,
ScriptLoadRequest* aRequest) {
for (int32_t i = 0; i < mObservers.Count(); i++) {
nsCOMPtr<nsIScriptLoaderObserver> obs = mObservers[i];
obs->ScriptEvaluated(aResult, aRequest->GetScriptElement(),
aRequest->mIsInline);
RefPtr<nsIScriptElement> scriptElement = aRequest->GetScriptElement();
obs->ScriptEvaluated(aResult, scriptElement, aRequest->mIsInline);
}
aRequest->FireScriptEvaluated(aResult);

View File

@ -552,7 +552,9 @@ class ScriptLoader final : public ScriptLoaderInterface {
nsresult ProcessRequest(ScriptLoadRequest* aRequest) override;
nsresult CompileOffThreadOrProcessRequest(ScriptLoadRequest* aRequest);
void FireScriptAvailable(nsresult aResult, ScriptLoadRequest* aRequest);
void FireScriptEvaluated(nsresult aResult, ScriptLoadRequest* aRequest);
// TODO: Convert this to MOZ_CAN_RUN_SCRIPT (bug 1415230)
MOZ_CAN_RUN_SCRIPT_BOUNDARY void FireScriptEvaluated(
nsresult aResult, ScriptLoadRequest* aRequest);
// Implements https://html.spec.whatwg.org/#execute-the-script-block
nsresult EvaluateScriptElement(ScriptLoadRequest* aRequest);

View File

@ -41,6 +41,7 @@ interface nsIScriptLoaderObserver : nsISupports {
* @param aElement The element being processed.
* @param aIsInline Is this an inline script or externally loaded?
*/
[can_run_script]
void scriptEvaluated(in nsresult aResult,
in nsIScriptElement aElement,
in boolean aIsInline);