Closed Bug 455278 Opened 16 years ago Closed 16 years ago

chrome mochitest redirect fails in fennec

Categories

(Testing :: Mochitest, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: blassey, Assigned: Gavin)

References

Details

Attachments

(1 file, 1 obsolete file)

error is: Error: win.getWebNavigation is not a function Source File: http://localhost:8888/redirect.js Line: 51 the js that is failing is: var windowMediator = Cc['@mozilla.org/appshell/window-mediator;1']. getService(Ci.nsIWindowMediator); var win = windowMediator.getMostRecentWindow("navigator:browser"); win.getWebNavigation().loadURI(aURL + location.search, null, null, null, null);
The easy fix would be to add the getWebNavigation() helper to fennec chrome (we'll probably end up doing that anyways for Firefox extension compat), but perhaps we should fix that mochitest code to use something more generic. I think the following would work: let webNav = window.QueryInterface(Ci.nsIInterfaceRequestor) .getInterface(Ci.nsIWebNavigation) .QueryInterface(Ci.nsIDocShellTreeItem) .treeOwner.primaryContentShell .QueryInterface(Ci.nsIWebNavigation);
Attached patch gavin's code as a patch (obsolete) — Splinter Review
for some reason using let doesn't work.
Attachment #338635 - Flags: review?
Attachment #338635 - Flags: review? → review?(robert_sayre)
Attachment #338635 - Flags: review?(robert_sayre) → review?(sayrer)
Comment on attachment 338635 [details] [diff] [review] gavin's code as a patch Shouldn't that be |win| instead of |window|? Or do you really want to run it againstd the current window as opposed to the most recent navigator window? let probably didn't work because this stuff is not being loaded right; that's worth filing a bug on.
Yeah, it should be win.
Blocks: 450708
Actually, this file is loaded in the content docshell anyways, so we can just use window.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIWebNavigation) directly. Or maybe even just set document.location? I guess that might run into security checks.
Component: General → Testing
OS: Linux → All
Product: Fennec → Core
QA Contact: general → testing
Hardware: PC → All
Attached patch patchSplinter Review
Assignee: nobody → gavin.sharp
Attachment #338635 - Attachment is obsolete: true
Status: NEW → ASSIGNED
Attachment #339323 - Flags: review?(sayrer)
Attachment #338635 - Flags: review?(sayrer)
I'll add this comment: // Can't just set window.location because of security restrictions // that don't care about our UniversalXPConnectness
Attachment #339323 - Flags: review?(sayrer) → review+
Status: ASSIGNED → RESOLVED
Closed: 16 years ago
Keywords: checkin-needed
Resolution: --- → FIXED
Target Milestone: --- → mozilla1.9.1b1
Component: Testing → Chrome
Product: Core → Testing
QA Contact: testing → chrome
Target Milestone: mozilla1.9.1b1 → ---
Version: Trunk → unspecified
Component: Mochitest Chrome → Mochitest
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: