Closed Bug 988305 Opened 6 years ago Closed 6 years ago

UITour: getConfiguration("availableTargets") does not always work

Categories

(Firefox :: General, defect)

defect
Not set

Tracking

()

RESOLVED FIXED
Firefox 31
Tracking Status
firefox29 --- fixed
firefox30 --- fixed
firefox31 --- fixed

People

(Reporter: agibson, Assigned: MattN)

References

Details

(Whiteboard: [Australis:P3-])

Attachments

(1 file, 1 obsolete file)

When testing getConfiguration("availableTargets") in the Australis UITour we noticed the callback was not firing in some cases:

STR:

Go to this page in the latest Nightly:

https://www.mozilla.org/en-US/firefox/tour/

Then open the console and paste:

Mozilla.UITour.getConfiguration('availableTargets', function (data) { console.log(data.targets); });

Expected results:

You *should* see something like:

Array [ "pinnedTab", "accountStatus", "addons", "appMenu", "backForward", "bookmarks", "customize", "help", "home", "quit", 4 more… ]

Actual results:

This is the email reply from the person who experienced the bug:

"It doesn't print out anything at all for me. Even when I put a
"console.log('test')" inside the callback, I get nothing (the statement
itself returns undefined but that's expected).

OS X Mountain Lion, Nightly 31.0a1 (2014-03-26)"
Note it works for me fine, I can't reproduce it or figure out why the callback is not firing for some folks.
Blocks: 988151
Could you have them do the following to get more data:
1) open the Browser Console (Tools > Web Developer > Browser Console)
2) Shut off "Net" and "CSS" filters by clicking the buttons so they don't look depressed.
3) click "Clear" to clear the current output
4) Open a page that calls getConfiguration("availableTargets")
5) Copy the output from the console (excluding the Mozilla dino if you want) and paste it into an attachment here.

Thanks
Flags: needinfo?(agibson)
CC'ing :mkelly - can you please provide the info requested in comment 2?

Note: We don't have a page that currently calls getConfiguration("availiableTargets") directly, so you will need to paste the code into the console as per the original description.
Flags: needinfo?(agibson) → needinfo?(mkelly)
Attached file console_log_getConfiguration.txt (obsolete) —
Attaching the log output when I follow the instructions (incl. agibson's info on going to the page). I also took a screencast in case I did something wrong: http://screencast.com/t/Yh7OO7HdBv

Let me know if there's anything else I can provide!
Flags: needinfo?(mkelly)
This was on the latest nightly, by the way (31.0a1 (2014-03-27)).
Can you please follow the steps more closely and use the "Browser Console" for the steps in comment 2, not the "Web Console"? You will still need to use the Web Console for calling Mozilla.UITour.getConfiguration('availableTargets', function (data) { console.log(data.targets); });

Thanks
Flags: needinfo?(mkelly)
(In reply to Matthew N. [:MattN] from comment #6)
> Can you please follow the steps more closely and use the "Browser Console"
> for the steps in comment 2, not the "Web Console"?

Well of course I would miss the important bit. Doh!

Output is one line, let me know if you prefer it as an attachment:

15:24:46.279 Argument 1 of Document.getAnonymousElementByAttribute is not an object. UITour.jsm:111
Flags: needinfo?(mkelly)
You probably never use the Browser Console so it's understandable.

That line is very likely relevant.

Could you make sure I look at the proper line by doing the following:
1) Load resource:///modules/UITour.jsm in a tab
2) Hit Command-U to View Source.
3) Hit Command-L to Jump to a line and enter "111" then OK.
4) It should be a line in the "targets" Map. Could you copy line 111 and some context (e.g. the target array) here so I can be sure it's referring to the line I think?

Thanks again
Flags: needinfo?(mkelly)
No prob bob! Here's the target array (line 111 is the "searchbar-engine-button" line):

["searchProvider", {
  query: (aDocument) => {
    let searchbar = aDocument.getElementById("searchbar");
    return aDocument.getAnonymousElementByAttribute(searchbar,
                                                    "anonid",
                                                    "searchbar-engine-button");
  },
  widgetName: "search-container",
}],

So, fun fact, I do not have the search box in my toolbar; I removed it and only have the URL bar. Perhaps that's why an element with #searchbar isn't being found and causing all the ruckus?
Flags: needinfo?(mkelly)
Sure enough, putting the search bar back in my toolbar makes the STR from comment 1 work; the data targets are logged and there's no error in the browser console anymore. Yay!
Thanks! I can reproduce and the problem makes sense. Patch coming up.
Assignee: nobody → MattN+bmo
Status: NEW → ASSIGNED
OS: Mac OS X → All
Hardware: x86 → All
Whiteboard: [Australis:P3-]
Attachment #8398261 - Flags: review?(bmcbride) → review+
Comment on attachment 8398261 [details] [diff] [review]
v.1 catch exceptions from a target's query function

[Approval Request Comment]
Bug caused by (feature/regressing bug #): new API from bug 936195 made this more obvious in Fx29's tour but this has been an issue since near the beginning of UITour when we added query functions to find a target. If a user has moved certain targets to the customization palette (aka. removing them) then trying to annotate them could cause an uncaught exception.
User impact if declined: The Fx29 tour won't be able to know what targets are available and/or it might annotate something that has been removed.
Testing completed (on m-c, etc.): manually on OS X and with a browser chrome test
Risk to taking this patch (and alternatives if risky): Patch is basically just adding a try…catch around calling targetQuery. The rest is reducing duplication to reduce errors from accidental divergence of similar code.
String or IDL/UUID changes made by this patch: None
Attachment #8398261 - Flags: approval-mozilla-beta?
Attachment #8398261 - Flags: approval-mozilla-aurora?
https://hg.mozilla.org/mozilla-central/rev/58be325eaf5c
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 31
Attachment #8398261 - Flags: approval-mozilla-beta?
Attachment #8398261 - Flags: approval-mozilla-beta+
Attachment #8398261 - Flags: approval-mozilla-aurora?
Attachment #8398261 - Flags: approval-mozilla-aurora+
This depends on bug 941862 for uplift.
You need to log in before you can comment on or make changes to this bug.