Browse Source

Only remove webview when non-null

Kevin Sawicki 8 years ago
parent
commit
cc183524fd
1 changed files with 5 additions and 3 deletions
  1. 5 3
      spec/api-session-spec.js

+ 5 - 3
spec/api-session-spec.js

@@ -25,10 +25,12 @@ describe('session module', function () {
   })
 
   afterEach(function () {
-    if (!document.body.contains(webview)) {
-      document.body.appendChild(webview)
+    if (webview != null) {
+      if (!document.body.contains(webview)) {
+        document.body.appendChild(webview)
+      }
+      webview.remove()
     }
-    webview.remove()
 
     return closeWindow(w).then(function () { w = null })
   })