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 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

@Christywl Christywl commented Jul 5, 2017

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

@frankhale frankhale commented Jul 17, 2017

Related issue: #4878

@frankhale
Copy link
Contributor

@frankhale frankhale commented Jul 17, 2017

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

@rogerwang
Copy link
Member

@rogerwang rogerwang commented Jul 24, 2017

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

@rogerwang rogerwang closed this Jul 24, 2017
@frankhale
Copy link
Contributor

@frankhale frankhale commented Jul 24, 2017

Thank you @rogerwang !!!

@rogerwang
Copy link
Member

@rogerwang rogerwang commented Jul 24, 2017

@rogerwang
Copy link
Member

@rogerwang rogerwang commented Jul 25, 2017

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

@rogerwang
Copy link
Member

@rogerwang rogerwang commented Jan 11, 2018

reopening due to regression.

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

@frankhale frankhale commented Jan 11, 2018

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

@rogerwang rogerwang commented Jan 12, 2018

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

@rogerwang rogerwang closed this Jan 12, 2018
rogerwang added a commit that referenced this issue Jan 12, 2018
@rogerwang
Copy link
Member

@rogerwang rogerwang commented Jan 12, 2018

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

@rogerwang rogerwang commented Oct 15, 2018

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 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
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants