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)
- 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
Document any additional information that might be useful in resolving the problem, such as screen shots or other included attachments.
Hey! What version of the iOS did you see this on? What version of iOS is running in the iOS Simulator.
(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)
addendum; I get the same error if I have loaded HTML content into the view and then attempt loading the web inspector.
addendum #2; Here's a gist of a viewcontroller that reproduces the issue for me:
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.
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?
(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?
> 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.
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.
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!
*** Bug 155611 has been marked as a duplicate of this bug. ***
*** Bug 156991 has been marked as a duplicate of this bug. ***
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.