     }
     
     func webView(_ webView: WKWebView, didFinish navigation: WKNavigation) {
+        Swift.print("webView:didFinish:")
         if let pageTitle = webView.title {
-            let hwc = self.view.window?.windowController as! HeliumPanelController
-            let doc = hwc.document as! Document
-            var title = pageTitle;
-            if title.isEmpty { title = doc.displayName }
-            let notif = Notification(name: Notification.Name(rawValue: "HeliumUpdateTitle"),
-                                     object: title, userInfo: ["hwc":hwc]);
-            NotificationCenter.default.post(notif)
+            if let hwc = self.view.window?.windowController {
+                let doc = hwc.document as! Document
+                var title = pageTitle;
+                if title.isEmpty { title = doc.displayName }
+                let notif = Notification(name: Notification.Name(rawValue: "HeliumUpdateTitle"),
+                                         object: title, userInfo: ["hwc":hwc]);
+                NotificationCenter.default.post(notif)
+            }
         }
     }
     
     func webView(_ webView: WKWebView, didFinishLoad navigation: WKNavigation) {
+        Swift.print("webView:didFinishLoad:")
     }
     
     var videoFileReferencedURL = false

            if let progress = change?[NSKeyValueChangeKey(rawValue: "new")] as? Float {
                let percent = progress * 100
                var title = NSString(format: "Loading... %.2f%%", percent)
                if percent == 100 {
                    videoFileReferencedURL = false
                    let url = (self.webView.url)

                    if (url?.isFileURL)! {
                        if let original = (url! as NSURL).resolvedFinderAlias() {
                            self.loadURL(url: original)
                            return
                        }
                    }

                    let notif = Notification(name: Notification.Name(rawValue: "HeliumNewURL"), object: url);
                    NotificationCenter.default.post(notif)

                    // once loaded update window title,size with video name,dimension
                    if let urlTitle = (self.webView.url?.absoluteString) {
                        title = urlTitle as NSString

                        if let track = AVURLAsset(url: url!, options: nil).tracks.first {

                            //    if it's a video file, get and set window content size to its dimentions
                            if track.mediaType == AVMediaTypeVideo {
                                title = url!.lastPathComponent as NSString
                                webSize = track.naturalSize
                                webView.window?.setContentSize(webSize)
                                webView.bounds.size = webSize

                            }

                            //  Wait for URL to finish
                            let videoPlayer = AVPlayer(url: url)
                            let item = videoPlayer.currentItem
                            NotificationCenter.default.addObserver(self, selector: #selector(WebViewController.playerDidFinishPlaying(_:)),
                                                                             name: NSNotification.Name.AVPlayerItemDidPlayToEndTime, object: item)
