Created attachment 419048 [details] Example html document Overview: If an iframe has the sandbox attribute without allow-script, then Safari web extension event listeners won't get called in the iframe. This is contrary to Google Chrome, which does allow extension event listeners in a sandbox iframe. Moreover, Content-Security-Policy script-src 'none' also still allows extension event listeners. So iframe sandbox should only prevent web page script, not extension script. Steps to Reproduce: 1. Put the attached "index.html" document in /Users/Shared (to avoid Mac TCC issues) 2. cd /Users/Shared 3. /usr/bin/python -m SimpleHTTPServer 8000 4. Build and run the attached sample Xcode project "SandboxTest" 5. Open Safari 6. Select "Allow Unsigned Extensions" from the Develop menu. 7. Open Safari Preferences Extensions pane. 8. Enable the SandboxTest extension. 9. Select "Always Allow on Every Website..." 10. Open http://localhost:8000 11. Open the web inspector console 12. Click inside the sandbox iframe Actual Results: [Error] Blocked script execution in 'https://example.org/' because the document's frame is sandboxed and the 'allow-scripts' permission is not set. Expected Results: [Log] SandboxTest mousedown: – "H1" (content.js, line 7) Additional Information: This bug also affects Safari app extensions and affects Safari 14 on Catalina and Mojave on Intel Macs.
Created attachment 419049 [details] Sample Xcode project
You can see from the console log that the extension content script itself does get run in the sandbox iframe. So it's just the script's event listener that doesn't get called.
<rdar://problem/73898565>
*** This bug has been marked as a duplicate of bug 218086 ***