Skip to content

Commit fe07275

Browse files
vvto33RytoEX
authored andcommitted
Fix CSS injection for sites with strict CSP
This fix addresses an issue occurring on some pages where the response header includes `content-security-policy: require-trusted-types-for 'script'`.
1 parent 2a2879b commit fe07275

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

browser-client.cpp

+3-2
Original file line numberDiff line numberDiff line change
@@ -661,8 +661,9 @@ void BrowserClient::OnLoadEnd(CefRefPtr<CefBrowser>, CefRefPtr<CefFrame> frame,
661661

662662
std::string script;
663663
script += "const obsCSS = document.createElement('style');";
664-
script += "obsCSS.innerHTML = decodeURIComponent(\"" +
665-
uriEncodedCSS + "\");";
664+
script += "obsCSS.appendChild(document.createTextNode("
665+
"decodeURIComponent(\"" +
666+
uriEncodedCSS + "\")));";
666667
script += "document.querySelector('head').appendChild(obsCSS);";
667668

668669
frame->ExecuteJavaScript(script, "", 0);

0 commit comments

Comments
 (0)