From e4923eaf8debfae05b064de4ff741772835dc75d Mon Sep 17 00:00:00 2001 From: eson <474420502@qq.com> Date: Mon, 16 Nov 2020 01:47:34 +0800 Subject: [PATCH] TODO: 1. server request url. get response --- myblock/background/worker.js | 22 ++++++++++++++++++++++ myblock/content/inject.js | 1 + myblock/manifest.json | 6 +++--- 3 files changed, 26 insertions(+), 3 deletions(-) diff --git a/myblock/background/worker.js b/myblock/background/worker.js index e69de29..67189cd 100644 --- a/myblock/background/worker.js +++ b/myblock/background/worker.js @@ -0,0 +1,22 @@ + +chrome.webRequest.onCompleted.addListener( + function (details) { + console.log(details); + console.log(document); + // return { responseHeaders: details.responseHeaders}; + }, + { + urls: [""], + types: [ + "main_frame", + "sub_frame", + "stylesheet", + "script", + "image", + "object", + "xmlhttprequest", + "other" + ] + }, + ["responseHeaders", "extraHeaders"] +); diff --git a/myblock/content/inject.js b/myblock/content/inject.js index e69de29..0519ecb 100644 --- a/myblock/content/inject.js +++ b/myblock/content/inject.js @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/myblock/manifest.json b/myblock/manifest.json index cff0ef4..a3bc5dd 100644 --- a/myblock/manifest.json +++ b/myblock/manifest.json @@ -1,6 +1,6 @@ { "background": { - "js": [ + "scripts": [ "background/worker.js" ] }, @@ -16,7 +16,7 @@ "content_scripts": [ { "all_frames": true, "js": [ "content/inject.js" ], - "matches": [ "*://*/*" ], + "matches": [ "" ], "run_at": "document_start" } ], "description": "block all", @@ -31,7 +31,7 @@ "key": "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAlurgt0Ykv740tjk1ebeiSX6UVVRRhxVvh+FvRMTe9PKzkAKUDEW2IjNUz1swxZA8ILnMvtyamAfiErTOxUFB8+zCADU/CK2YEhqUJo3tmHCg6EP2XJL220ZXjmIeft1AqJV1BmGRLhm8VnH8dJ2EThfcflx4JEdlh0/aLJr6UVjF2hPVX8JLAMTVjEfiC82KDNGgXDADqBm3E/6n+Dx+3KhgIYTXKIMk+qRVaOhjAJLh8a9OrDBwpylP5RDifTAyVVa9UOyoLNqynzC9oLabWUr1ovWAOiivhYknFCXnl5q971iNSFpmjc+ZW+aK+TRjMnJF84IeA170corVG3KgnwIDAQAB", "manifest_version": 2, "name": "MyBlock", - "permissions": [ "storage", "*://*/*", "activeTab", "webRequest", "webRequestBlocking","webNavigation", "tabs"], + "permissions": [ "storage","tabs" , "activeTab", "webRequest", "webRequestBlocking", "", "webNavigation"], "short_name": "myblock", "version": "0.1.0" }