MCPcopy Create free account
hub / github.com/LeFroid/Viper-Browser / initWebChannelScript

Method initWebChannelScript

src/app/BrowserScripts.cpp:39–64  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

37}
38
39void BrowserScripts::initWebChannelScript()
40{
41 QString webChannelJS;
42 QFile webChannelFile(QLatin1String(":/qtwebchannel/qwebchannel.js"));
43 if (webChannelFile.open(QIODevice::ReadOnly))
44 webChannelJS = webChannelFile.readAll();
45 webChannelFile.close();
46
47 QString webChannelSetup;
48 QFile webChannelSetupFile(QLatin1String(":/WebChannelSetup.js"));
49 if (webChannelSetupFile.open(QIODevice::ReadOnly))
50 {
51 webChannelSetup = webChannelSetupFile.readAll();
52 webChannelSetup = webChannelSetup.arg(webChannelJS);
53 }
54 webChannelSetupFile.close();
55
56 QWebEngineScript webChannelScript;
57 webChannelScript.setInjectionPoint(QWebEngineScript::DocumentCreation);
58 webChannelScript.setName(QLatin1String("viper-web-channel"));
59 webChannelScript.setRunsOnSubFrames(true);
60 webChannelScript.setWorldId(QWebEngineScript::ApplicationWorld);
61 webChannelScript.setSourceCode(webChannelSetup);
62
63 m_globalScripts.push_back(webChannelScript);
64}
65
66void BrowserScripts::initFaviconScript()
67{

Callers

nothing calls this directly

Calls 1

setNameMethod · 0.80

Tested by

no test coverage detected