Commit 44303861 authored by Jüri Valdmann's avatar Jüri Valdmann
Browse files

Run non-MainWorld DocumentCreation scripts even if JS disabled


Fixes regression, introduced by the fix for QTBUG-66011, where setting
JavascriptEnabled to false stops all scripts from running instead of only
MainWorld scripts (as documented). Only the DocumentCreation injection point is
affected.

The original change which introduced the regression consisted of moving the
DocumentCreation injection point from

    ContentRendererClient::RunScriptsAtDocumentStart

to

    RenderFrameObserver::DidClearWindowObject.

The problem of scripts not working on view-source URLs was fixed by this move,
but it turns out that the call to DidClearWindowObject happens to be conditional
on Document::CanExecuteScripts and this is, of course, false if JS is disabled.
Hence the regression.

This new patch moves the injection point again to a task launched from

    RenderFrameObserver::DidCommitProvisionalLoad.

DidCommitProvisionalLoad and DidClearWindowObject are both indirectly called
from DocumentLoader::InstallNewDocument, however the former is called before the
Document is opened and is therefore too early for script execution. As such, the
execution is delayed by posting a task which, in theory, should be scheduled
very soon after the normal call to DidClearWindowObject.

Fixes: QTBUG-74304
Change-Id: Iac8714bcc5651c287b73181811af26996d955af5
Reviewed-by: default avatarAllan Sandfeld Jensen <allan.jensen@qt.io>
parent 2b623019
Showing with 50 additions and 8 deletions
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment