From 017924de95b7a85a8451d21fa8a99803f79b7b88 Mon Sep 17 00:00:00 2001 From: Carlos Jeurissen <1038267+carlosjeurissen@users.noreply.github.com> Date: Thu, 5 Dec 2024 09:41:31 +0100 Subject: [PATCH] Add dnr-domaintype-thirdparty-wecg-731 --- .../README.md | 2 ++ .../sample-extension/background.js | 18 ++++++++++++++++++ .../sample-extension/manifest.json | 14 ++++++++++++++ 3 files changed, 34 insertions(+) create mode 100644 issues/dnr-domaintype-thirdparty-wecg-731/README.md create mode 100644 issues/dnr-domaintype-thirdparty-wecg-731/sample-extension/background.js create mode 100644 issues/dnr-domaintype-thirdparty-wecg-731/sample-extension/manifest.json diff --git a/issues/dnr-domaintype-thirdparty-wecg-731/README.md b/issues/dnr-domaintype-thirdparty-wecg-731/README.md new file mode 100644 index 0000000..e7f8160 --- /dev/null +++ b/issues/dnr-domaintype-thirdparty-wecg-731/README.md @@ -0,0 +1,2 @@ +WECG issue: +https://github.com/w3c/webextensions/issues/731 diff --git a/issues/dnr-domaintype-thirdparty-wecg-731/sample-extension/background.js b/issues/dnr-domaintype-thirdparty-wecg-731/sample-extension/background.js new file mode 100644 index 0000000..4ddb9aa --- /dev/null +++ b/issues/dnr-domaintype-thirdparty-wecg-731/sample-extension/background.js @@ -0,0 +1,18 @@ +// Listen for the extension being installed or updated +chrome.runtime.onInstalled.addListener(() => { + chrome.declarativeNetRequest.updateDynamicRules({ + addRules: [{ + id: 1, + action: { + type: 'block', + }, + condition: { + domainType: 'thirdParty', + urlFilter: 'iana.org', + resourceTypes: ['main_frame', 'sub_frame'], + }, + }], + }).then(() => { + console.log("Rules added"); + }); +}); diff --git a/issues/dnr-domaintype-thirdparty-wecg-731/sample-extension/manifest.json b/issues/dnr-domaintype-thirdparty-wecg-731/sample-extension/manifest.json new file mode 100644 index 0000000..4073240 --- /dev/null +++ b/issues/dnr-domaintype-thirdparty-wecg-731/sample-extension/manifest.json @@ -0,0 +1,14 @@ +{ + "manifest_version": 3, + "name": "DNR thirdParty domainType", + "version": "1.0", + "description": "Demo extension showcasing issues regarding thirdParty domainType in DNR.", + "permissions": [ "declarativeNetRequest" ], + "background": { + "scripts": ["background.js"], + "service_worker": "background.js" + }, + "host_permissions": [ + "" + ] +}