Closed Bug 1228721 Opened 9 years ago Closed 9 years ago

vtt.jsm - navigator is not defined

Categories

(Core :: Audio/Video: Playback, defect, P2)

defect

Tracking

()

RESOLVED FIXED
mozilla45
Tracking Status
firefox45 --- fixed

People

(Reporter: jruderman, Assigned: rillian)

References

Details

(Keywords: regression, testcase)

Attachments

(3 files)

Attached file testcase
JavaScript error: resource://gre/modules/vtt.jsm, line 729: ReferenceError: navigator is not defined

https://hg.mozilla.org/mozilla-central/rev/e715a8fc69e6 pulled in two instances of:

    var isIE8 = (/MSIE\s8\.0/).test(navigator.userAgent);

I guess |navigator| doesn't exist in the context where the code is running.
Hmm. I guess we can patch this out. Is there a more general way to leave the test but avoid the error? Something like,

var isIE8 = (navigator != undefined) && (/MSIE\s8\.0/).test(navigator.userAgent);
Try this as the first sub-expression:

(typeof navigator !== 'undefined')

Using 'typeof' lets you avoid errors or warnings when it doesn't exist in scope.
Priority: -- → P2
Good point. Jesse, do you feel qualified to review the patch over at https://github.com/mozilla/vtt.js/pull/347 ?
Assignee: nobody → giles
Flags: needinfo?(jruderman)
It looks good to me, but I'd feel weird commenting with r+ on a project I didn't know existed until 2 minutes ago.
Flags: needinfo?(jruderman)
Ok, I'll find someone else. Rick isn't around much anymore, and none of the media peers are js experts.
If you're a peer, I suppose you could say I "wrote" the patch and you "reviewed" it.
This is slightly dodgy, using the gecko-navigator branch of https://github.com/rillian/vtt.js. I don't want to use upstream master because of the issues with the code from bug 1167492.

This shouldn't cause any problems updating to the next release once those changes are sorted out, however.
Attachment #8694404 - Flags: review?(kinetik)
Attachment #8694404 - Flags: review?(kinetik) → review+
https://hg.mozilla.org/mozilla-central/rev/6a6f51dd501d
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla45
Please also fix the other instance in vtt.js.
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Oops. There's another navigator access in BoxPosition().
Attachment #8695351 - Flags: review?(kinetik)
Attachment #8695351 - Flags: review?(kinetik) → review+
https://hg.mozilla.org/mozilla-central/rev/56507104b00b
Status: REOPENED → RESOLVED
Closed: 9 years ago9 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: