Skip to content

Commit 2d7f2d8

Browse files
authored
Merge f6611f1 into e5086fc
2 parents e5086fc + f6611f1 commit 2d7f2d8

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

client/karma.js

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ var util = require('../common/util')
44

55
function Karma (socket, iframe, opener, navigator, location, document) {
66
var startEmitted = false
7-
var reloadingContext = false
7+
var karmaNavigating = false
88
var self = this
99
var queryParams = util.parseQueryParams(location.search)
1010
var browserId = queryParams.id || util.generateId('manual-')
@@ -80,6 +80,8 @@ function Karma (socket, iframe, opener, navigator, location, document) {
8080

8181
var childWindow = null
8282
function navigateContextTo (url) {
83+
karmaNavigating = true
84+
console.log('karmaNavigating', karmaNavigating)
8385
if (self.config.useIframe === false) {
8486
// run in new window
8587
if (self.config.runInParent === false) {
@@ -89,9 +91,12 @@ function Karma (socket, iframe, opener, navigator, location, document) {
8991
childWindow.close()
9092
}
9193
childWindow = opener(url)
94+
karmaNavigating = false
95+
console.log('karmaNavigating', karmaNavigating)
9296
// run context on parent element (client_with_context)
9397
// using window.__karma__.scriptUrls to get the html element strings and load them dynamically
9498
} else if (url !== 'about:blank') {
99+
karmaNavigating = false
95100
var loadScript = function (idx) {
96101
if (idx < window.__karma__.scriptUrls.length) {
97102
var parser = new DOMParser()
@@ -123,20 +128,20 @@ function Karma (socket, iframe, opener, navigator, location, document) {
123128
// run in iframe
124129
} else {
125130
iframe.src = policy.createURL(url)
131+
karmaNavigating = false
132+
console.log('karmaNavigating', karmaNavigating)
126133
}
127134
}
128135

129136
this.onbeforeunload = function () {
130-
if (!reloadingContext) {
137+
if (!karmaNavigating) {
131138
// TODO(vojta): show what test (with explanation about jasmine.UPDATE_INTERVAL)
132139
self.error('Some of your tests did a full page reload!')
133140
}
134-
reloadingContext = false
141+
karmaNavigating = false
135142
}
136143

137144
function clearContext () {
138-
reloadingContext = true
139-
140145
navigateContextTo('about:blank')
141146
}
142147

@@ -259,9 +264,11 @@ function Karma (socket, iframe, opener, navigator, location, document) {
259264
}
260265

261266
socket.on('execute', function (cfg) {
267+
console.log('-----------------------execute')
262268
// Delay our navigation to the next event in case the clearContext has not completed.
263269
setTimeout(function allowClearContextToComplete () {
264270
// reset startEmitted and reload the iframe
271+
console.log('allowClearContextToComplete')
265272
startEmitted = false
266273
self.config = cfg
267274

0 commit comments

Comments
 (0)