From 8dcd06dc20aea427661ca272960bbcef53e4321d Mon Sep 17 00:00:00 2001 From: Sebastian Benz Date: Tue, 8 Oct 2024 13:47:52 +0000 Subject: [PATCH] Update web accessible resource samples to use dynamic URLs (#1317) --- .../web-accessible-resources/index.html | 32 +++++++++++++++++++ .../web-accessible-resources/manifest.json | 9 ++++-- .../sample.favicon-cs/manifest.json | 3 +- .../tutorial.custom-cursor/manifest.json | 3 +- 4 files changed, 43 insertions(+), 4 deletions(-) diff --git a/api-samples/web-accessible-resources/index.html b/api-samples/web-accessible-resources/index.html index 1d2b15cd1f..c6f700a29e 100644 --- a/api-samples/web-accessible-resources/index.html +++ b/api-samples/web-accessible-resources/index.html @@ -55,6 +55,13 @@

Web Accessible Resources Demo

to build the image's URL at runtime.

+

+ The third example shows the second website again, but this time using the + `use_dynamic_urls` flag which only allows resources to be accessed through + a dynamic ID. The id is regenerated when the browser restarts or the + extension reloads. +

+ @@ -92,6 +99,20 @@

Web Accessible Resources Demo

+ + + + + + + + + +
web-accessible-resources-2.glitch.me Dynamically injected
+ test3.png + web-accessible-resources-3.glitch.meStatically referenced with use_dynamic_url
+ test4.png + web-accessible-resources-3.glitch.meDynamically injected with use_dynamic_url
@@ -119,5 +140,16 @@

Web Accessible Resources Demo

height="200" > +
+
+ https://web-accessible-resources-3.glitch.me/ can access image + test4.png +
+ +
diff --git a/api-samples/web-accessible-resources/manifest.json b/api-samples/web-accessible-resources/manifest.json index 2714338717..eea7b2e0ef 100644 --- a/api-samples/web-accessible-resources/manifest.json +++ b/api-samples/web-accessible-resources/manifest.json @@ -11,7 +11,8 @@ { "matches": [ "https://web-accessible-resources-1.glitch.me/*", - "https://web-accessible-resources-2.glitch.me/*" + "https://web-accessible-resources-2.glitch.me/*", + "https://web-accessible-resources-3.glitch.me/*" ], "all_frames": true, "js": ["content-script.js"] @@ -24,7 +25,11 @@ }, { "resources": ["test3.png", "test4.png"], - "matches": ["https://web-accessible-resources-2.glitch.me/*"], + "matches": ["https://web-accessible-resources-2.glitch.me/*"] + }, + { + "resources": ["test3.png", "test4.png"], + "matches": ["https://web-accessible-resources-3.glitch.me/*"], "use_dynamic_url": true } ], diff --git a/functional-samples/sample.favicon-cs/manifest.json b/functional-samples/sample.favicon-cs/manifest.json index c7c90af9db..0f5a482559 100644 --- a/functional-samples/sample.favicon-cs/manifest.json +++ b/functional-samples/sample.favicon-cs/manifest.json @@ -14,7 +14,8 @@ "web_accessible_resources": [ { "resources": ["_favicon/*"], - "matches": [""] + "matches": [""], + "use_dynamic_url": true } ] } diff --git a/functional-samples/tutorial.custom-cursor/manifest.json b/functional-samples/tutorial.custom-cursor/manifest.json index b94fbe563b..f515f328cf 100644 --- a/functional-samples/tutorial.custom-cursor/manifest.json +++ b/functional-samples/tutorial.custom-cursor/manifest.json @@ -16,7 +16,8 @@ "web_accessible_resources": [ { "resources": ["dino.png", "dino-pointer.png"], - "matches": ["https://developer.chrome.com/*"] + "matches": ["https://developer.chrome.com/*"], + "use_dynamic_urls": true } ], "permissions": ["storage"],