Chrome changed the devtools url
chrome-devtools:// to devtools://
28b21a67f0
This commit is contained in:
parent
aa00b19c92
commit
cf5224140b
13 changed files with 14 additions and 16 deletions
|
@ -2080,7 +2080,7 @@ v8::Local<v8::Value> WebContents::GetLastWebPreferences(
|
||||||
}
|
}
|
||||||
|
|
||||||
bool WebContents::IsRemoteModuleEnabled() const {
|
bool WebContents::IsRemoteModuleEnabled() const {
|
||||||
if (web_contents()->GetVisibleURL().SchemeIs("chrome-devtools")) {
|
if (web_contents()->GetVisibleURL().SchemeIs("devtools")) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (auto* web_preferences = WebContentsPreferences::From(web_contents())) {
|
if (auto* web_preferences = WebContentsPreferences::From(web_contents())) {
|
||||||
|
|
|
@ -500,7 +500,7 @@ void AtomBrowserClient::AppendExtraCommandLineSwitches(
|
||||||
|
|
||||||
content::WebContents* web_contents = GetWebContentsFromProcessID(process_id);
|
content::WebContents* web_contents = GetWebContentsFromProcessID(process_id);
|
||||||
if (web_contents) {
|
if (web_contents) {
|
||||||
if (web_contents->GetVisibleURL().SchemeIs("chrome-devtools")) {
|
if (web_contents->GetVisibleURL().SchemeIs("devtools")) {
|
||||||
command_line->AppendSwitch(switches::kDisableRemoteModule);
|
command_line->AppendSwitch(switches::kDisableRemoteModule);
|
||||||
}
|
}
|
||||||
auto* web_preferences = WebContentsPreferences::From(web_contents);
|
auto* web_preferences = WebContentsPreferences::From(web_contents);
|
||||||
|
|
|
@ -23,9 +23,7 @@ const char kChromeUIDevToolsHost[] = "devtools";
|
||||||
const char kChromeUIDevToolsBundledPath[] = "bundled";
|
const char kChromeUIDevToolsBundledPath[] = "bundled";
|
||||||
|
|
||||||
std::string PathWithoutParams(const std::string& path) {
|
std::string PathWithoutParams(const std::string& path) {
|
||||||
return GURL(std::string("chrome-devtools://devtools/") + path)
|
return GURL(std::string("devtools://devtools/") + path).path().substr(1);
|
||||||
.path()
|
|
||||||
.substr(1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string GetMimeTypeForPath(const std::string& path) {
|
std::string GetMimeTypeForPath(const std::string& path) {
|
||||||
|
|
|
@ -54,14 +54,14 @@ const double kPresetZoomFactors[] = {0.25, 0.333, 0.5, 0.666, 0.75, 0.9,
|
||||||
2.5, 3.0, 4.0, 5.0};
|
2.5, 3.0, 4.0, 5.0};
|
||||||
|
|
||||||
const char kChromeUIDevToolsURL[] =
|
const char kChromeUIDevToolsURL[] =
|
||||||
"chrome-devtools://devtools/bundled/devtools_app.html?"
|
"devtools://devtools/bundled/devtools_app.html?"
|
||||||
"remoteBase=%s&"
|
"remoteBase=%s&"
|
||||||
"can_dock=%s&"
|
"can_dock=%s&"
|
||||||
"toolbarColor=rgba(223,223,223,1)&"
|
"toolbarColor=rgba(223,223,223,1)&"
|
||||||
"textColor=rgba(0,0,0,1)&"
|
"textColor=rgba(0,0,0,1)&"
|
||||||
"experiments=true";
|
"experiments=true";
|
||||||
const char kChromeUIDevToolsRemoteFrontendBase[] =
|
const char kChromeUIDevToolsRemoteFrontendBase[] =
|
||||||
"https://chrome-devtools-frontend.appspot.com/";
|
"https://devtools-frontend.appspot.com/";
|
||||||
const char kChromeUIDevToolsRemoteFrontendPath[] = "serve_file";
|
const char kChromeUIDevToolsRemoteFrontendPath[] = "serve_file";
|
||||||
|
|
||||||
const char kDevToolsBoundsPref[] = "electron.devtools.bounds";
|
const char kDevToolsBoundsPref[] = "electron.devtools.bounds";
|
||||||
|
|
|
@ -35,7 +35,7 @@ const char kModuleCacheKey[] = "native-module-cache";
|
||||||
|
|
||||||
bool IsDevTools(content::RenderFrame* render_frame) {
|
bool IsDevTools(content::RenderFrame* render_frame) {
|
||||||
return render_frame->GetWebFrame()->GetDocument().Url().ProtocolIs(
|
return render_frame->GetWebFrame()->GetDocument().Url().ProtocolIs(
|
||||||
"chrome-devtools");
|
"devtools");
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IsDevToolsExtension(content::RenderFrame* render_frame) {
|
bool IsDevToolsExtension(content::RenderFrame* render_frame) {
|
||||||
|
|
|
@ -34,7 +34,7 @@ filenames = {
|
||||||
"lib/browser/api/view.js",
|
"lib/browser/api/view.js",
|
||||||
"lib/browser/api/web-contents.js",
|
"lib/browser/api/web-contents.js",
|
||||||
"lib/browser/api/web-contents-view.js",
|
"lib/browser/api/web-contents-view.js",
|
||||||
"lib/browser/chrome-devtools.js",
|
"lib/browser/devtools.js",
|
||||||
"lib/browser/chrome-extension.js",
|
"lib/browser/chrome-extension.js",
|
||||||
"lib/browser/crash-reporter-init.js",
|
"lib/browser/crash-reporter-init.js",
|
||||||
"lib/browser/default-menu.ts",
|
"lib/browser/default-menu.ts",
|
||||||
|
|
|
@ -50,7 +50,7 @@ const getEditMenuItems = function () {
|
||||||
|
|
||||||
const isChromeDevTools = function (pageURL) {
|
const isChromeDevTools = function (pageURL) {
|
||||||
const { protocol } = url.parse(pageURL)
|
const { protocol } = url.parse(pageURL)
|
||||||
return protocol === 'chrome-devtools:'
|
return protocol === 'devtools:'
|
||||||
}
|
}
|
||||||
|
|
||||||
const assertChromeDevTools = function (contents, api) {
|
const assertChromeDevTools = function (contents, api) {
|
|
@ -154,7 +154,7 @@ if (packageJson.v8Flags != null) {
|
||||||
app._setDefaultAppPaths(packagePath)
|
app._setDefaultAppPaths(packagePath)
|
||||||
|
|
||||||
// Load the chrome devtools support.
|
// Load the chrome devtools support.
|
||||||
require('@electron/internal/browser/chrome-devtools')
|
require('@electron/internal/browser/devtools')
|
||||||
|
|
||||||
// Load the chrome extension support.
|
// Load the chrome extension support.
|
||||||
require('@electron/internal/browser/chrome-extension')
|
require('@electron/internal/browser/chrome-extension')
|
||||||
|
|
|
@ -94,7 +94,7 @@ if (preloadScript) {
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (window.location.protocol) {
|
switch (window.location.protocol) {
|
||||||
case 'chrome-devtools:': {
|
case 'devtools:': {
|
||||||
// Override some inspector APIs.
|
// Override some inspector APIs.
|
||||||
require('@electron/internal/renderer/inspector')
|
require('@electron/internal/renderer/inspector')
|
||||||
break
|
break
|
||||||
|
|
|
@ -109,7 +109,7 @@ const { hasSwitch } = process.electronBinding('command_line')
|
||||||
const contextIsolation = hasSwitch('context-isolation')
|
const contextIsolation = hasSwitch('context-isolation')
|
||||||
|
|
||||||
switch (window.location.protocol) {
|
switch (window.location.protocol) {
|
||||||
case 'chrome-devtools:': {
|
case 'devtools:': {
|
||||||
// Override some inspector APIs.
|
// Override some inspector APIs.
|
||||||
require('@electron/internal/renderer/inspector')
|
require('@electron/internal/renderer/inspector')
|
||||||
break
|
break
|
||||||
|
|
|
@ -190,7 +190,7 @@ describe('webContents module', () => {
|
||||||
w.webContents.setDevToolsWebContents(devtools.webContents)
|
w.webContents.setDevToolsWebContents(devtools.webContents)
|
||||||
w.webContents.openDevTools()
|
w.webContents.openDevTools()
|
||||||
await promise
|
await promise
|
||||||
expect(devtools.getURL().startsWith('chrome-devtools://devtools')).to.be.true()
|
expect(devtools.getURL().startsWith('devtools://devtools')).to.be.true()
|
||||||
const result = await devtools.webContents.executeJavaScript('InspectorFrontendHost.constructor.name')
|
const result = await devtools.webContents.executeJavaScript('InspectorFrontendHost.constructor.name')
|
||||||
expect(result).to.equal('InspectorFrontendHostImpl')
|
expect(result).to.equal('InspectorFrontendHostImpl')
|
||||||
devtools.destroy()
|
devtools.destroy()
|
||||||
|
|
|
@ -401,7 +401,7 @@ describe('chromium feature', () => {
|
||||||
}).catch(done)
|
}).catch(done)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
b = window.open('chrome-devtools://devtools/bundled/inspector.html', '', 'nodeIntegration=no,show=no')
|
b = window.open('devtools://devtools/bundled/inspector.html', '', 'nodeIntegration=no,show=no')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('disables JavaScript when it is disabled on the parent window', (done) => {
|
it('disables JavaScript when it is disabled on the parent window', (done) => {
|
||||||
|
|
|
@ -787,7 +787,7 @@ describe('<webview> tag', function () {
|
||||||
|
|
||||||
// Its WebContents should be a DevTools.
|
// Its WebContents should be a DevTools.
|
||||||
const devtools = webview2.getWebContents()
|
const devtools = webview2.getWebContents()
|
||||||
assert.ok(devtools.getURL().startsWith('chrome-devtools://devtools'))
|
assert.ok(devtools.getURL().startsWith('devtools://devtools'))
|
||||||
|
|
||||||
const name = await devtools.executeJavaScript('InspectorFrontendHost.constructor.name')
|
const name = await devtools.executeJavaScript('InspectorFrontendHost.constructor.name')
|
||||||
document.body.removeChild(webview2)
|
document.body.removeChild(webview2)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue