Closed Bug 1226293 Opened 9 years ago Closed 9 years ago

Greyhound website won't search schedules

Categories

(Core :: General, defect)

defect
Not set
normal

Tracking

()

VERIFIED FIXED
mozilla45
Tracking Status
firefox45 --- verified

People

(Reporter: jdm, Assigned: roc)

References

()

Details

(Keywords: regression, site-compat, testcase)

Attachments

(2 files)

STR:
1. Visit https://greyhound.ca/default.aspx
2. Choose "Toronto, ON" for Leaving From, and "Guelph, ON" for Going To
3. Press "Search schedules"

Expected:
Overlay explaining that a search is in progress, followed by navigating to search results.

Actual:
JS error: "TypeError: $find(...).get_selectedItem(...) is null"

I can reproduce this in the 11/18 nightly but not Developer Edition or Chrome.
So the basic problem is that on this RadComboBox object get_value returns "".  Then findItemByValue returns null because "" is falsy, etc.

get_value() just returns this._value, so something went wrong earlier...  Really need that regression range.  Josh, are you working on that?
Flags: needinfo?(josh)
Yes.
Flags: needinfo?(josh)
[Tracking Requested - why for this release]: Website bustage.
I think we're bombing out somewhere related to the "Discount Type:" select (Telerik RadComboBox control widget thingy). If you pick something no value is displayed.

$find('ctl00_body_search_discounts').get_selectedItem()._text in "Companion Fare" in Chrome, but "" in Nightly.
(uhhh, it seems like someone is working on this site... this line was commented out between refreshes and now the search works for me (w/ some additional console errors):

//    var discount = $find(SearchReferences.ListDiscounts).get_value();
Ugh. We should have saved as "web page, complete" up front.  :(
Now it's back to not working. Sorry for the noise. Looking into how the RadComboBox expects to get its _text property.
Apparently Firefox returns "" for innerText if the element is hidden. Testcase coming.
(In reply to Kohei Yoshino [:kohei] from comment #9)
> Apparently Firefox returns "" for innerText if the element is hidden.
> Testcase coming.

If that's the case, then that explains RadComboBoxItem.prototype.get_text returning "":

get_text: function() {
    if (this._text !== null) {
        return this._removeEmTags(this._text);
    }
    if ((this._text = this._properties.getValue('text', null)) != null) {
        return this._removeEmTags(this._text);
    }
    if (!this.get_element()) {
        return '';
    }
    var c = this.get_textElement();
    if (!c) {
        return '';
    }
    if (typeof(c.innerText) != 'undefined') {
        this._text = c.innerText;
    } else {
        this._text = c.textContent;
    }
    if ($telerik.isSafari2) {
        this._text = c.innerHTML;
    }
    return this._removeEmTags(this._text);
},
Attached file testcase
The console should say "Mozilla Firefox developers" but the actual output is "Mozilla Firefox".
Yeah, so GetInnerText will fall back on GetTextContent in the no-frame case but only if we have no style context or are styled display:none or are not in the document.

Should we just always fall back?
Flags: needinfo?(roc)
Oops, yes! The spec and the implementation (and the tests) should check whether we're in a display:none subtree instead of just display:none.
Flags: needinfo?(roc)
Assignee: nobody → roc
Does it have to be a display:none subtree?  For example, could it be some random block inside SVG but not inside foreignObject, which doesn't get rendered as a result?
(In reply to Boris Zbarsky [:bz] from comment #14)
> Does it have to be a display:none subtree?  For example, could it be some
> random block inside SVG but not inside foreignObject, which doesn't get
> rendered as a result?

As discussed on IRC, that would be hard to spec properly.

I've updated the spec to say that we fall back to textContent if the element *or any ancestor* is display:none and I'm about to attach my patch.
Bug 1226293. innerText for non-display:none elements with display:none ancestors should use textContent. r=bz
Attachment #8689902 - Flags: review?(bzbarsky)
Comment on attachment 8689902 [details]
MozReview Request: Bug 1226293. innerText for non-display:none elements with display:none ancestors should use textContent. r=bz

https://reviewboard.mozilla.org/r/25743/#review23219

::: dom/html/nsGenericHTMLElement.cpp:3337
(Diff revision 1)
> -      nsComputedDOMStyle::GetStyleContextForElementNoFlush(this, nullptr, nullptr);
> +    if (!presShell || !IsInComposedDoc() ||

if !IsInComposedDoc(), then nsComputedDOMStyle::GetPresShellForContent will return null, no?  So I don't think you need the check.

Speccing the !presShell condition will be hard, by the way.  Not much we can do about that, though.

::: testing/web-platform/tests/innerText/getter-tests.js:76
(Diff revision 1)
>  

It would be good to have tests for the <div> in <svg> case, both with and without display:none on the div (and possibly with an extra level of nesting, with the display:none on the inner thing, too, as a separate test), just to ensure that part works correctly.

r=me
Attachment #8689902 - Flags: review?(bzbarsky) → review+
https://hg.mozilla.org/integration/mozilla-inbound/rev/ef653e3a6b0d21190af39dab7cc0716974dbf0f8
Bug 1226293. innerText for non-display:none elements with display:none ancestors should use textContent. r=bz
https://hg.mozilla.org/mozilla-central/rev/ef653e3a6b0d
https://hg.mozilla.org/mozilla-central/rev/a97d93737072
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla45
Verified fixed in today's Nightly.
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: