Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nw version 23.5 -load-extension :ERR_BLOCKED_BY_CLIENT #6004

Closed
chatcan opened this issue Jul 4, 2017 · 12 comments
Closed

nw version 23.5 -load-extension :ERR_BLOCKED_BY_CLIENT #6004

chatcan opened this issue Jul 4, 2017 · 12 comments

Comments

@chatcan
Copy link

chatcan commented Jul 4, 2017

package.json

{
  "main": "index.html",
  "name": "canhuang",
  "appname": "canhuang",
  "version": "1.0.0",
  "window": {
    "title": "v1.0.0",
    "toolbar": true,
    "width": 800,
    "height": 800,
    "frame": true
  },
  "chromium-args": "-load-extension=./extensions/ -ignore-certificate-errors",
  "webview": {
    "partitions": [
      {
        "name": "trusted",
        "accessible_resources": [
          "<all_urls>"
        ]
      }
    ]
  }
}

index.html

<!DOCTYPE html>
<html lang="zh-CN">

<head>
  <meta charset="utf-8">
</head>

<body>
  <div id="container" class="container"></div>
  <script src="index.js"></script>
</body>

</html>

index.js

global.contentDocument = document
require('./core.js')

if (nw.App.argv.indexOf('inspect') !== -1) {
  nw.Window.open('about:blank', {
    "show": false,
    "width": 799,
    "height": 799,
  }, (inspectWin) => {
    inspectWin.maximize()
    inspectWin.window.location = "chrome://inspect/#devices"
    inspectWin.show()
  })
}

core.js

var webview = document.createElement('webview')
var devtools = document.createElement('webview')

webview.setAttribute('style', 'height:300px;width:100%;position:absolute')
devtools.setAttribute('style', 'height:300px;width:100%;position:absolute;top:300px')
devtools.setAttribute('partition', 'trusted')

var container = global.contentDocument.getElementById('container')
container.appendChild(webview)
container.appendChild(devtools)

webview.src = 'https://mp.weixin.qq.com'

const devtoolsviewCommit = () => {
  devtools.removeEventListener('loadcommit', devtoolsviewCommit)
  webview.showDevTools(true, devtools)
}
devtools.addEventListener('loadcommit', devtoolsviewCommit)

devtools.src = 'about:blank'

in extension folder create 3 files: devtools.html、manifest.json、custom.html

devtools.html

<html>
<head>
</head>
<body>
<script >
"use strict"

// 添加appdata pannel
chrome.devtools.panels.create("custome",
  "",
  "custome.html",
  function(panel) {
    //console.log(panel)
  }
)

</script>
</body>
</html>

manifest.json

{
  "name": "wechat devtools extension",
  "version": "1.1",
  "description": "Extends the Developer Tools, adding appdata",
  "devtools_page": "devtools.html",
  "manifest_version": 2
}

custom.html

<html>
<head>
</head>
<body>
custom
</body>
</html>

if i use nw version 22.3 to run the project
devtools will add the custom pannel

but when using nw version 23.5
the custom pannel doesn't appear

use

nw23 . inspect

to show the inspect window

i see the following error tips

chrome-extension://clolcahimhommgjjmgkbkeccoihhkpfg/devtools.html Failed to load resource: net::ERR_BLOCKED_BY_CLIENT

is there any mistake ?

@Christywl
Copy link
Contributor

I can reproduce this issue on Linux with nwjs-sdk-0.23.5. The custom panel doesn't appear in the devtools page of the app window.

@frankhale
Copy link
Contributor

Related issue: #4878

@frankhale
Copy link
Contributor

Here is another simple example to demonstrate the issue: https://github.com/frankhale/nwjs-react-devtools-webview-example

@rogerwang
Copy link
Member

This is fixed in git and will be available in the next nightly build.

@frankhale
Copy link
Contributor

Thank you @rogerwang !!!

@rogerwang
Copy link
Member

OP's sample is working with this build: https://dl.nwjs.io/live-build/07-24-2017/nw23-890b720-3f64365-bdcc2a7-93e37d9/v0.23.7/

@rogerwang
Copy link
Member

PS: the "webview" section in package.json should be added into the "manifest.json" file of the extension.

@rogerwang
Copy link
Member

reopening due to regression.

@rogerwang rogerwang reopened this Jan 11, 2018
@frankhale
Copy link
Contributor

Thanks @rogerwang!! I just tested react-devtools in 0.27.4 to see if the regression is in there but it's still working as intended.

@rogerwang
Copy link
Member

This is fixed in git and will be available in the next nightly build.

@rogerwang
Copy link
Member

This was a regression since 0.25.0 and just fixed in https://dl.nwjs.io/live-build/01-12-2018/nw27-2b7d2db-2f0eedb-a3ef615-547fb57/v0.27.5/

rogerwang added a commit to nwjs/chromium.src that referenced this issue Oct 15, 2018
rogerwang added a commit that referenced this issue Oct 15, 2018
This copes with upstream change in site-per-process. CDT extension should
be loaded in webview guest process and site instance in this use case.
@rogerwang
Copy link
Member

The last commits fix regression. It will be available in the next nightly build and will be shipped with 0.34.0.

rogerwang added a commit to nwjs/chromium.src that referenced this issue Oct 19, 2018
rogerwang added a commit that referenced this issue Dec 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants