title: WKUserScript not call in iOS10, but works in iOS9
body: <p>I'm having code which perfectly works in iOS 9, but not working in iOS 10, specifically doBar() not called. Here in WKWebView I'm injecting javascript code.</p>
  
  <pre><code>let jsFoo = "function doFoo() { window.webkit.messageHandlers.doFoo.postMessage(\"doFoo\"); }"
  let jsBar = "class MyInterface { static doBar() { window.webkit.messageHandlers.doBar.postMessage(\"doBar\"); } }"
  
  let fooScript = WKUserScript(source: jsFoo, injectionTime: .atDocumentEnd, forMainFrameOnly: true)
  let barScript = WKUserScript(source: jsBar, injectionTime: .atDocumentEnd, forMainFrameOnly: true)
  
  contentController.addUserScript(logoutScript)
  contentController.addUserScript(openPDFScript)
  
  contentController.add(self, name: "doFoo")
  contentController.add(self, name: "doBar")
  </code></pre>
  
  <p>In web page js code make calls:</p>
  
  <pre><code>window.doFoo() // works in both iOS 9 and iOS 10
  window.MyInterface.doBar() // works in iOS 9, but NOT working in iOS 10
  </code></pre>
  
  <p>Safari debugger shows that in iOS 10 window.MyInterface is undefined, however user-script with doBar code is present.</p>
  
  <p>How can I inject doBar properly, so it will work in iOS 10, assuming that web code I can't change?</p>