Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-61937

Need API in QtWebEngine for calling blink::WebSecurityPolicy::addOriginAccessWhitelistEntry

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Incomplete
    • P3: Somewhat important
    • None
    • 5.9.1
    • WebEngine
    • None
    • Linux, X11, qt5.git branch 5.9, qtwebengine.git 1eed5a43

    Description

      I'm trying to implement support for "about:konqueror" using

      page()->setContent(htmlData, "text/html", "about:konqueror")

      where the html data loads icons and css stylesheets from file:/// URLs. This however leads to the following error:

      Not allowed to load local resource: file:///usr/share/icons/breeze/places/32/user-home.svg

      I tried many things to get around this. The only thing that I found to work was to switch to a different scheme than "about" (I tried "konq") and to add this line:

      blink::WebSecurityPolicy::addOriginAccessWhitelistEntry(blink::WebURL(GURL("konq:")), "file", "", true);

      to ContentRendererClientQt::RenderThreadStarted.
      It doesn't work with "about:" because shouldTreatAsUniqueOrigin() returns true for "about:", because shouldTreatURLSchemeAsNoAccess() returns true for { "about", "javascript", "data" },
      and addOriginAccessWhitelistEntry asserts that the origin is NOT "unique", i.e. it cannot be done for one of these schemes.

      It seems to me that the support for Chrome's about: went down a bit too much into blink, but whatever. I can switch to another scheme, I guess.

      Can there be an API in QtWebEngine for registering schemes that should be allowed to load local files?
      (I'm going to need this for many more schemes than the "about" replacement... "man:/ls" also generates HTML which needs to load local files, etc.)

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            qt_webengine_team Qt WebEngine Team
            dfaure_kdab David Faure
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes