Skip to content

Commit 70157d7

Browse files
committed
Remove a redundant variable.
1 parent 27aec01 commit 70157d7

File tree

2 files changed

+18
-36
lines changed

2 files changed

+18
-36
lines changed

javascript/webdriver/promise.js

+9-27
Original file line numberDiff line numberDiff line change
@@ -1636,7 +1636,7 @@ webdriver.promise.ControlFlow.prototype.runInNewFrame_ = function(
16361636
webdriver.promise.popFlow_();
16371637
this.schedulingFrame_ = null;
16381638
}
1639-
newFrame.lockFrame();
1639+
newFrame.isLocked_ = true;
16401640

16411641
// If there was nothing scheduled in the new frame we can discard the
16421642
// frame and return immediately.
@@ -1833,13 +1833,13 @@ webdriver.promise.Frame_ = function(flow) {
18331833
this.pendingTask_ = null;
18341834

18351835
/**
1836-
* Whether this frame is active. A frame is considered active once one of its
1837-
* descendants has been removed for execution.
1836+
* Whether this frame is currently locked. A locked frame represents an
1837+
* executed function that has scheduled all of its tasks.
18381838
*
1839-
* Adding a sub-frame as a child to an active frame is an indication that
1840-
* a callback to a {@link webdriver.promise.Deferred} is being invoked and any
1841-
* tasks scheduled within it should have priority over previously scheduled
1842-
* tasks:
1839+
* <p>Once a frame becomes locked, any new frames which are added as children
1840+
* represent interrupts (such as a {@link webdriver.promise.Promise}
1841+
* callback) whose tasks must be given priority over those already scheduled
1842+
* within this frame. For example:
18431843
* <code><pre>
18441844
* var flow = webdriver.promise.controlFlow();
18451845
* flow.execute('start here', goog.nullFunction).then(function() {
@@ -1850,18 +1850,6 @@ webdriver.promise.Frame_ = function(flow) {
18501850
*
18511851
* @private {boolean}
18521852
*/
1853-
this.isActive_ = false;
1854-
1855-
/**
1856-
* Whether this frame is currently locked. A locked frame represents a callback
1857-
* or task function which has run to completion and scheduled all of its tasks.
1858-
*
1859-
* <p>Once a frame becomes {@link #isActive_ active}, any new frames which are
1860-
* added represent callbacks on a {@link webdriver.promise.Deferred}, whose
1861-
* tasks must be given priority over previously scheduled tasks.
1862-
*
1863-
* @private {boolean}
1864-
*/
18651853
this.isLocked_ = false;
18661854
};
18671855
goog.inherits(webdriver.promise.Frame_, webdriver.promise.Node_);
@@ -1925,12 +1913,6 @@ webdriver.promise.Frame_.prototype.setPendingTask = function(task) {
19251913
};
19261914

19271915

1928-
/** Locks this frame. */
1929-
webdriver.promise.Frame_.prototype.lockFrame = function() {
1930-
this.isLocked_ = true;
1931-
};
1932-
1933-
19341916
/**
19351917
* Adds a new node to this frame.
19361918
* @param {!(webdriver.promise.Frame_|webdriver.promise.Task_)} node
@@ -1946,7 +1928,7 @@ webdriver.promise.Frame_.prototype.addChild = function(node) {
19461928

19471929
node.setParent(this);
19481930

1949-
if (this.isActive_ && node instanceof webdriver.promise.Frame_) {
1931+
if (this.isLocked_ && node instanceof webdriver.promise.Frame_) {
19501932
var index = 0;
19511933
if (this.lastInsertedChild_ instanceof
19521934
webdriver.promise.Frame_) {
@@ -1967,7 +1949,7 @@ webdriver.promise.Frame_.prototype.addChild = function(node) {
19671949
* fist child.
19681950
*/
19691951
webdriver.promise.Frame_.prototype.getFirstChild = function() {
1970-
this.isActive_ = true;
1952+
this.isLocked_ = true;
19711953
this.lastInsertedChild_ = null;
19721954
return this.children_[0];
19731955
};

javascript/webdriver/test/promise_flow_test.js

+9-9
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ function testAddChild_withSubframes() {
183183
assertArrayEquals([task1, frame1], root.children_);
184184
assertArrayEquals([task2, task3], frame1.children_);
185185

186-
frame1.lockFrame();
186+
frame1.isLocked_ = true;
187187
var task4 = createTask('task4'), task5 = createTask('task5');
188188
root.addChild(task4);
189189
root.addChild(task5);
@@ -199,9 +199,9 @@ function testAddChild_withSubframes() {
199199
root.addChild(frame2);
200200
root.addChild(frame3);
201201
root.addChild(task6);
202-
frame3.lockFrame();
202+
frame3.isLocked_ = true;
203203
root.addChild(task7);
204-
frame2.lockFrame();
204+
frame2.isLocked_ = true;
205205
root.addChild(task8);
206206

207207
assertArrayEquals([task1, frame1, task4, task5, frame2, task8],
@@ -218,11 +218,11 @@ function testAddChild_insertingFramesIntoAnActiveFrame() {
218218
task1 = createTask('task1');
219219

220220
root.addChild(task1);
221-
root.isActive_ = true;
221+
root.isLocked_ = true;
222222
root.addChild(frame2);
223-
frame2.lockFrame();
223+
frame2.isLocked_ = true;
224224
root.addChild(frame3);
225-
frame3.lockFrame();
225+
frame3.isLocked_ = true;
226226

227227
assertArrayEquals([frame2, frame3, task1], root.children_);
228228
}
@@ -314,7 +314,7 @@ function testGetNextTask() {
314314
assertArrayEquals([task1, frame1], root.children_);
315315
assertArrayEquals([task2, task3], frame1.children_);
316316

317-
frame1.lockFrame();
317+
frame1.isLocked_ = true;
318318
root.addChild(task4);
319319
root.addChild(task5);
320320
assertArrayEquals([task1, frame1, task4, task5], root.children_);
@@ -324,9 +324,9 @@ function testGetNextTask() {
324324
root.addChild(frame2);
325325
root.addChild(frame3);
326326
root.addChild(task6);
327-
frame3.lockFrame();
327+
frame3.isLocked_ = true;
328328
root.addChild(task7);
329-
frame2.lockFrame();
329+
frame2.isLocked_ = true;
330330
root.addChild(task8);
331331

332332
assertArrayEquals([task1, frame1, task4, task5, frame2, task8],

0 commit comments

Comments
 (0)