OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.


Help: OASIS Mailing Lists Help | MarkMail Help

docbook-apps message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]

Subject: Re: [docbook-apps] Issue with WebHelp search deleting the sidebar

Interesting observation. I may have found a possible explanation.

The error is thrown from the line at [1].

            var stemmedWord=stemmer(word);
                stemQueryMap[stemmer(word)] = word;
            } else {

stemQueryMap is a _javascript_ array. 'length' is a default property that return the number of elements of the given array. An assignment like stemQueryMap["length"] = "length" will modify this 'length' property. Since the new value is not an integer, Chrome's _javascript_ engine goes haywire.

>>  You can recover from this by clearing the cookies. <<

Best possible fix for this is that JS engines should start treating 'length' as a keyword. Since that is a long shot, easiest workaround is to patch the nwSearchFnt.js IMO - where we ask it to treat 'length' as a special keyword. 

We should do this for all the Array objects in there such as stemmedWordsList, cleanwordsList, wordsList.

@Janice, are you interested in sending a GitHub pull request for this? :)

[1] https://github.com/docbook/xslt10-stylesheets/blob/master/xsl/webhelp/template/search/nwSearchFnt.js#L383
[2] https://developer.mozilla.org/en-US/docs/Web/_javascript_/Reference/Global_Objects/Array/length

Best regards,

On Tue, Oct 17, 2017 at 9:11 AM, Peter Desjardins <peter.desjardins.us@gmail.com> wrote:
I can confirm that I see the same behavior in our webhelp. Searching
for the term "length" will result in the same JS error.

The search function is working as expected otherwise. Interesting problem!


On Mon, Oct 16, 2017 at 5:00 PM, Janice Manwiller <janice@sqrrl.com> wrote:
> This issue has been reported by a couple of internal users of our WebHelp.
> Has anyone run into something similar? And if so, any ideas of how to
> address?
> I have never seen the behavior myself.
> Our WebHelp is built using the Maven docbx plugin.
> When using the WebHelp in Chrome, the user issues a search - in this case,
> specifically for the term "length".
> They get no results, and the search/contents sidebar disappears. They are
> unable to get it back unless they restart Chrome, which destroys all of
> their work in the main application.
> The Chrome console has the following:
> nwSearchFnt.js:383 Uncaught RangeError: Invalid array length
>     at tokenize (nwSearchFnt.js:383)
>     at Effectuer_recherche (nwSearchFnt.js:158)
>     at Verifie (nwSearchFnt.js:100)
>     at HTMLDocument.<anonymous> (main.js:68)
>     at o (jquery-1.7.2.min.js:2)
>     at Object.fireWith (jquery-1.7.2.min.js:2)
>     at Function.ready (jquery-1.7.2.min.js:2)
>     at HTMLDocument.B (jquery-1.7.2.min.js:2)
> Any help is appreciated.
> Thanks,
> Janice
> --
> Janice Manwiller
> Principal Technical Writer
> Sqrrl Data, Inc.
> www.sqrrl.com | @SqrrlData

To unsubscribe, e-mail: docbook-apps-unsubscribe@lists.oasis-open.org
For additional commands, e-mail: docbook-apps-help@lists.oasis-open.org

Kasun Gajasinghe
Senior Software Engineer; WSO2 Inc.; http://wso2.com,

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]