Bug 154448 - Uncaught Exception: SecurityError: DOM Exception 18: An attempt was made to break through the security policy of the user agent.
Summary: Uncaught Exception: SecurityError: DOM Exception 18: An attempt was made to b...
Status: RESOLVED LATER
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (show other bugs)
Version: WebKit Nightly Build
Hardware: All All
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
: 155611 (view as bug list)
Depends on:
Blocks:
 
Reported: 2016-02-19 05:26 PST by Henrik Hartz
Modified: 2019-05-02 16:18 PDT (History)
10 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Henrik Hartz 2016-02-19 05:26:55 PST
-------
Auto-generated details:

Inspected URL:        (unknown)
Loading completed:    false
Frontend User Agent:  Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_3) AppleWebKit/602.1.20+ (KHTML, like Gecko)
Uncaught exceptions:
 - SecurityError: DOM Exception 18: An attempt was made to break through the security policy of the user agent. (at Setting.js:61:44)
 - ReferenceError: Can't find variable: InspectorBackend (at InspectorBackendCommands.js:32:17)
 - ReferenceError: Can't find variable: InspectorBackend (at Main.js:59:25)
-------

* STEPS TO REPRODUCE
1. What were you doing? Include setup or other preparations to reproduce the exception.
   - debugging a web view
2. Include explicit, accurate, and minimal steps taken. Do not include extraneous or irrelevant steps.
   - load a WKWebView instance in iOS simulator
   - use menu "Develop" -> "Simulator" -> "about: blank" (same result if the WKWebView has loaded content

* NOTES
Document any additional information that might be useful in resolving the problem, such as screen shots or other included attachments.
Comment 1 Radar WebKit Bug Importer 2016-02-19 05:27:06 PST
<rdar://problem/24740414>
Comment 2 Joseph Pecoraro 2016-02-19 09:41:01 PST
Hey! What version of the iOS did you see this on? What version of iOS is running in the iOS Simulator.
Comment 3 Henrik Hartz 2016-02-23 04:26:16 PST
(Sorry for the lag) This was observed using both 9.1 and 8.4 simulators, and a WKWebView prior to actual loading any content (as I need to debug some problems that happens as a HTML string is loaded in the WKWebView)
Comment 4 Henrik Hartz 2016-02-23 04:27:51 PST
addendum; I get the same error if I have loaded HTML content into the view and then attempt loading the web inspector.
Comment 5 Henrik Hartz 2016-02-23 04:35:38 PST
addendum #2; Here's a gist of a viewcontroller that reproduces the issue for me:

https://gist.github.com/hhartz/3c5356919e8962b3f6be
Comment 6 Joseph Pecoraro 2016-03-17 20:54:43 PDT
Is this still happening? This sounds like a frontend issue (Safari, or WebKit Nightly).

This sounds very similar to a recent bug that was fixed, Bug 155265.
Comment 7 Henrik Hartz 2016-03-18 01:05:08 PDT
Yes it's still happening with WebKit nightly, exact same exception messages logged. Can you suggest any additional steps that would help you identify/reproduce the issue?
Comment 8 Joseph Pecoraro 2016-03-24 11:52:00 PDT
(In reply to comment #7)
> Yes it's still happening with WebKit nightly, exact same exception messages
> logged. Can you suggest any additional steps that would help you
> identify/reproduce the issue?

Sorry for taking so long to reply. I was absolutely stumped. However, I think I stumbled across the problem!

In Safari's Preferences > Privacy, do you have Cookies blocked?

If you change the setting to "Allow from websites I visit" do things start working again?
Comment 9 Joseph Pecoraro 2016-03-24 11:53:16 PDT
> In Safari's Preferences > Privacy, do you have Cookies blocked?

I should be clear, the label is "Cookies and website data" since here the issue is localStorage data, not really cookies.
Comment 10 Henrik Hartz 2016-03-26 08:26:46 PDT
That's it, works fine if cookies are enabled. Does that mean this setting has to be enabled for Safari debugging to work? At the very least it would be better to improve the error message, but if a user really wants to block cookies and local storage the simulator target could be greyed out or something similar to indicate it won't work.
Comment 11 Timothy Hatcher 2016-03-28 10:09:03 PDT
This is a bug. You should not need to change the cookie/storage setting to use Web Inspector. We will need to override the setting for our WebView. Thanks for testing this for us!
Comment 12 Timothy Hatcher 2016-03-28 10:10:59 PDT
*** Bug 155611 has been marked as a duplicate of this bug. ***
Comment 13 Timothy Hatcher 2016-04-26 10:52:28 PDT
*** Bug 156991 has been marked as a duplicate of this bug. ***
Comment 14 Joseph Pecoraro 2016-04-26 13:21:36 PDT
Given that this was an issue based on a Safari Preferences, this issue turned out to indeed be a Safari side issue and the fix would be there. The Safari issue is tracked by the radar created by this bug (<rdar://problem/24740414>).

I'm going to close the bugzilla bug because there is no more action to be done in WebKit for this.