Closed
Bug 1207689
Opened 10 years ago
Closed 10 years ago
places.remove_all_history() does not set context to chrome
Categories
(Testing :: Firefox UI Tests, defect)
Testing
Firefox UI Tests
Tracking
(firefox45 fixed)
RESOLVED
FIXED
mozilla45
| Tracking | Status | |
|---|---|---|
| firefox45 | --- | fixed |
People
(Reporter: mschifer, Assigned: utvar, Mentored)
References
Details
(Whiteboard: [lang=py])
Attachments
(1 file, 1 obsolete file)
Executing places.remove_all_history() while in 'content' context will throw an exception
def test_history(self):
with self.marionette.using_context('content'):
self.marionette.navigate('http://mozilla.org')
self.places.remove_all_history()
execute_async_script @places.py, line 129
inline javascript, line 3
src: " let hs = Cc["@mozilla.org/browser/nav-history-service;1"]"
Comment 1•10 years ago
|
||
Reason therefore is that Cc is not available while staying in content context, but only in chrome context. Given that for most of the other API methods we automatically switch to chrome, we should do it here too with using_context.
Mentor: hskupin
Component: Marionette → Firefox UI Tests
Product: Testing → Mozilla QA
QA Contact: hskupin
Whiteboard: [lang=py][good first bug]
Updated•10 years ago
|
Assignee: nobody → utvar
Attachment #8666411 -
Flags: review?(hskupin)
Comment 3•10 years ago
|
||
Comment on attachment 8666411 [details] [review]
github pull request
Oh, wait. I think it's my fault. We actually should not have to switch the scope, but maybe have. I would first try to expand Cc to `Components.classes` only and if that doesn't work we can switch to chrome. But then please with using_context() and not set_context(). The latter doesn't switch back to the original scope after the code has been run.
Attachment #8666411 -
Flags: review?(hskupin) → review-
Comment 4•10 years ago
|
||
Utvar, while checking some other older bugs for this Bugzilla component I found bug 1141266 which is actually the same underlying problem. Fixing that other bug will implicitly also fix this bug. And I think pushing a full fix for the problem makes more sense as only fixing a single instance. Would you like to fix them all and take bug 1141266 instead?
Depends on: 1141266
Flags: needinfo?(utvar)
Whimboo, I'm glad to try working on bug 1141266, in order to fix both bugs. So when it's ready, I should create just one PR for bug 1141266, against branch mozilla-central?
Flags: needinfo?(utvar) → needinfo?(hskupin)
Comment 6•10 years ago
|
||
That is totally correct. Yes. Thanks for taking the other bug!
Flags: needinfo?(hskupin)
Whiteboard: [lang=py][good first bug] → [lang=py][good first bug][will be fixed by bug 1141266]
Comment 7•10 years ago
|
||
So bug 1141266 actually didn't fix this specific issue here. Thinking more about it I think that we are doing the right thing here and specifically should not allow to run methods targeted for chrome in content scope.
Chris, do you think it would make sense to setup a decorator which let us bind methods to a specific scope if there is a restriction? That way we could raise way better understandable failure messages in case the wrong scope is being used.
Flags: needinfo?(cmanchester)
Whiteboard: [lang=py][good first bug][will be fixed by bug 1141266] → [lang=py][good first bug]
Comment 8•10 years ago
|
||
Until we know what to do here I will put this bug back into new state.
Assignee: utvar → nobody
Whiteboard: [lang=py][good first bug] → [lang=py]
Comment 9•10 years ago
|
||
I think you've identified the issue here, most of the methods in places.py will require chrome scope.
Between adding using_context to each method or implementing a decorator, both seem reasonable.
Flags: needinfo?(cmanchester)
Comment 10•10 years ago
|
||
Hm, so what I forgot is that we actually cannot read the current scope. Because of that I don't see a way to determine if the correct scope has been set for a method. Unless we have a decorator which explicitly tries to access some scope specific elements or methods. Not sure if that is what we want compared to the implicit scope switching. Personally I don't like the latter. What do you think Chris?
Flags: needinfo?(cmanchester)
Comment 11•10 years ago
|
||
I don't think implicit scope switching will be a hazard for most tests (I see we do it in a number of places already). If it's a concern in certain cases, I think a general try/except with a logged warning about the method being chrome/content only would work.
Flags: needinfo?(cmanchester)
Comment 12•10 years ago
|
||
Sorry for being late in the reply. So lets take the way in implicitly switching the scope in those helper methods which really need a defined scope. For that we should not use "self.marionette.set_context()" but "self.marionette.using_context()".
utvar, do you still want to do this change for the broken method in the places module?
Flags: needinfo?(utvar)
| Assignee | ||
Comment 14•10 years ago
|
||
Attachment #8682129 -
Flags: review?(hskupin)
Comment 15•10 years ago
|
||
Comment on attachment 8682129 [details] [review]
Github pull request
Looks fine to me. Just fix the small nit I was pointing out and we can get your PR merged. Thanks.
Attachment #8682129 -
Flags: review?(hskupin) → review+
| Assignee | ||
Comment 16•10 years ago
|
||
Comment on attachment 8682129 [details] [review]
Github pull request
I removed the line as you requested, but one of the Linux checks failed with what appears to be an install error. Okay to proceed to squash these commits anyway?
Attachment #8682129 -
Flags: review+ → review?(hskupin)
Updated•10 years ago
|
Attachment #8666411 -
Attachment is obsolete: true
Comment 17•10 years ago
|
||
Yeah, looks like the installer has not been correctly downloaded. Looks like to be related to bug 1219934. I have restarted this Travis build but I expect it to become green. I will do the review now and if all is fine we can get it merged.
Comment 18•10 years ago
|
||
PR got merged to mozilla-central as:
https://github.com/mozilla/firefox-ui-tests/commit/03db9c3f7f53a9d35dbe74da7911745cf0307dea
Thanks Utvar for this fix! If you want another challenge please let me know.
Assignee: nobody → utvar
Status: NEW → RESOLVED
Closed: 10 years ago
status-firefox45:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → Firefox 45
Comment 19•10 years ago
|
||
Comment on attachment 8682129 [details] [review]
Github pull request
Add missing r+
Attachment #8682129 -
Flags: review?(hskupin) → review+
Updated•10 years ago
|
Product: Mozilla QA → Testing
You need to log in
before you can comment on or make changes to this bug.
Description
•