Closed
Bug 1081006
Opened 10 years ago
Closed 10 years ago
Improve windows.waitForWindowState to also accept ID of the window to catch
Categories
(Mozilla QA Graveyard :: Mozmill Tests, defect, P1)
Mozilla QA Graveyard
Mozmill Tests
Tracking
(firefox32 wontfix, firefox33 wontfix, firefox34 fixed, firefox35 fixed, firefox36 fixed, firefox-esr31 wontfix)
People
(Reporter: danisielm, Assigned: danisielm)
References
Details
(Whiteboard: [sprint])
Attachments
(1 file, 4 obsolete files)
As I've seen in bug 908649, on the unknownContentType dialog, this doesn't have a specific type but an ID. There might be also other dialogs for which would be great to wait for the ID. Let's improve the waitForWindowState to also accept catching the windows by their ID.
Assignee | ||
Comment 1•10 years ago
|
||
Here is the fix.
Attachment #8503008 -
Flags: review?(andrei.eftimie)
Attachment #8503008 -
Flags: review?(andreea.matei)
Assignee | ||
Comment 2•10 years ago
|
||
Updated the comment a bit.
Attachment #8503008 -
Attachment is obsolete: true
Attachment #8503008 -
Flags: review?(andrei.eftimie)
Attachment #8503008 -
Flags: review?(andreea.matei)
Attachment #8503011 -
Flags: review?(andrei.eftimie)
Attachment #8503011 -
Flags: review?(andreea.matei)
Assignee | ||
Comment 3•10 years ago
|
||
Working on this I just noticed we missed to add curly braces in that if statement when implementing the method. :D Added it here.
Attachment #8503011 -
Attachment is obsolete: true
Attachment #8503011 -
Flags: review?(andrei.eftimie)
Attachment #8503011 -
Flags: review?(andreea.matei)
Attachment #8503024 -
Flags: review?(andrei.eftimie)
Attachment #8503024 -
Flags: review?(andreea.matei)
Assignee | ||
Updated•10 years ago
|
Comment 4•10 years ago
|
||
Comment on attachment 8503024 [details] [diff] [review] fix_2.patch Review of attachment 8503024 [details] [diff] [review]: ----------------------------------------------------------------- lgtm. As noted below, if you can add a short test for the ID as well it would be great. With that ask a review from Henrik please. ::: lib/windows.js @@ +215,5 @@ > assert.waitFor(() => { > return observer.getWindows().some(aWindow => { > var windowType = aWindow.document.documentElement.getAttribute("windowtype"); > + var windowId = aWindow.document.documentElement.id; > + if (windowType === aSpec.type || windowId === aSpec.id) { It would be great to also have a short test for ID (if it's feasible).
Attachment #8503024 -
Flags: review?(andrei.eftimie)
Attachment #8503024 -
Flags: review?(andreea.matei)
Attachment #8503024 -
Flags: review+
Assignee | ||
Comment 5•10 years ago
|
||
Thanks, updated!
Attachment #8503024 -
Attachment is obsolete: true
Attachment #8504095 -
Flags: review?(hskupin)
Comment 6•10 years ago
|
||
Comment on attachment 8504095 [details] [diff] [review] fix_v2.patch Review of attachment 8504095 [details] [diff] [review]: ----------------------------------------------------------------- ::: lib/windows.js @@ +180,5 @@ > * Callback function that triggers the window's state changing > * @param {object} aSpec > * Information about the window to handle > + * @param {string} [aSpec.id] > + * Id of the window to wait for remove 'to wait for'. @@ +195,5 @@ > > var aEventType = OBSERVER_WINDOW_READY; > if (aSpec.state === WINDOW_STATES.open) { > + assert.ok(aSpec.type || aSpec.id, > + "Type or Id of the window to open has been specified"); 'ID' @@ +215,5 @@ > assert.waitFor(() => { > return observer.getWindows().some(aWindow => { > var windowType = aWindow.document.documentElement.getAttribute("windowtype"); > + var windowId = aWindow.document.documentElement.id; > + if (windowType === aSpec.type || windowId === aSpec.id) { What if the window doesn't have a type (undefined) set, and the call to this method also passes in undefined for aSpec.type? We would get the wrong window. Actually we even missed this with the original landing, but given that type was required for open it was not that terrible. Here we have to fix that for sure.
Attachment #8504095 -
Flags: review?(hskupin) → review-
Comment 7•10 years ago
|
||
(In reply to Henrik Skupin (:whimboo) from comment #6) > What if the window doesn't have a type (undefined) set, and the call to this > method also passes in undefined for aSpec.type? We would get the wrong > window. Actually we even missed this with the original landing, but given > that type was required for open it was not that terrible. Here we have to > fix that for sure. Definitively worth looking into. From my (limited) testing if `windowtype` does not exist, we get `null`, not `undefined`. So this might be a non issue. > document.documentElement.getAttribute("windowtype") // null
Assignee | ||
Comment 8•10 years ago
|
||
Indeed getAttribute returns null or "" in case the attribute doesn't exist, so the comparison will return false as expected. https://developer.mozilla.org/en-US/docs/Web/API/element.getAttribute Thanks Andrei and Henrik for review! Will update shortly.
Assignee | ||
Comment 9•10 years ago
|
||
Fixed those 2 nits.
Attachment #8504095 -
Attachment is obsolete: true
Attachment #8504549 -
Flags: review?(andrei.eftimie)
Attachment #8504549 -
Flags: review?(andreea.matei)
Comment 10•10 years ago
|
||
Comment on attachment 8504549 [details] [diff] [review] fix_v3.patch Review of attachment 8504549 [details] [diff] [review]: ----------------------------------------------------------------- Passing the r flag back to Henrik for comment 7 and comment 8 regarding undefined vs null windowtype
Attachment #8504549 -
Flags: review?(hskupin)
Attachment #8504549 -
Flags: review?(andrei.eftimie)
Attachment #8504549 -
Flags: review?(andreea.matei)
Attachment #8504549 -
Flags: review+
Updated•10 years ago
|
Whiteboard: [sprint]
Updated•10 years ago
|
Attachment #8504549 -
Flags: review?(hskupin) → review+
Assignee | ||
Comment 11•10 years ago
|
||
Comment on attachment 8504549 [details] [diff] [review] fix_v3.patch Applies cleanly on all branches (default, aurora & beta).
Attachment #8504549 -
Flags: checkin?(andrei.eftimie)
Assignee | ||
Updated•10 years ago
|
status-firefox36:
--- → affected
Comment 12•10 years ago
|
||
remote: https://hg.mozilla.org/qa/mozmill-tests/rev/709838de6f38 (default) remote: https://hg.mozilla.org/qa/mozmill-tests/rev/2086648a2082 (mozilla-aurora) remote: https://hg.mozilla.org/qa/mozmill-tests/rev/11146005f037 (mozilla-beta)
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Updated•10 years ago
|
Attachment #8504549 -
Flags: checkin?(andrei.eftimie) → checkin+
Updated•5 years ago
|
Product: Mozilla QA → Mozilla QA Graveyard
You need to log in
before you can comment on or make changes to this bug.
Description
•