External links in opened windows don't open in default browser and mailto-problem

4 views
Skip to first unread message

TCP

unread,
Oct 28, 2009, 8:23:04 AM10/28/09
to mozilla-labs-prism
Hi,

I've got two problems.
1. When I open an external link in an opened window, prism opens the
url in a new window instead of using the default browser. When I open
the same link in the main application-window everything works the way
it should.
I did some debug and found out that when the link is clicked in the
opened window the function "createChromeWindow2" (webrunner.js) gets
an empty "uri"-parameter and because of that it can't check whether
the link is external and should be opened in the default browser.
I've tried a lot but I couldn't get it working properly.

2. When I click on a mailto inside my application my registered mailto-
protocoll-site isn't opened in a new window, instead of that it loads
it in my actual selected window or iframe.
At first I've had the same problem with mailtos from external
programs, but I changed the following in the "handle"-function
(components\nsCommandLineHandler.js):

"...
// Check for an existing window and reuse it if there is one
if (win) {
if (protocolURI) {
var ios = Cc["@mozilla.org/network/io-service;1"]
.getService(Ci.nsIIOService);

if (ios.extractScheme(uriSpec)=="mailto") {
try {
var x = Math.round((screen.availWidth - 800) / 2);
var y = Math.round((screen.availHeight - 600) / 2);
} catch(e) {
var x = 300;
var y = 200;
}
var featureString="scrollbars=no, dependent=yes,
resizable=yes, left=" + x + ",top=" + y + ",width=800, height=600";

var newWin = win.open(protocolURI, "NewMail",
featureString);
//win.open
(protocolURI,"NewMail","scrollbars=no,dependent=yes,resizable=yes");
} else {
win.document.getElementById("browser_content").loadURI
(WebAppProperties.uri, null, null);
}
}

aCmdLine.preventDefault = true;
return;
}"

I've found the function where the mailto gets assigned ("newURI" in
components\nsPlatformGlue.js) but I don't have a clue what happens
after that.

Matthew Gertner

unread,
Nov 2, 2009, 11:09:44 AM11/2/09
to mozilla-l...@googlegroups.com
Good finds. Can you file bugs about both of these issues in Bugzilla?
Please include as much description as possible (e.g. copy/paste from
your post).

Cheers,
Matt

TCP

unread,
Nov 5, 2009, 8:30:29 AM11/5/09
to mozilla-labs-prism
Okay, I filed this bugs in Bugzilla.

I know that there are many other bugs and therefore it will probably
take a while until these two get fixed.
I tried to fix it by myself but got stucked on some points. It would
be very helpful if I would know:
- which function determines whether the url should be directed
directly to the default browser or if "createChromeWindow2" should get
called (basically I need to know which function calls
"createChromeWindow2").
- where to look for the function which calls the "newURI" function /
which function handles the whole process.

I did a lot debug with venkman and searched through every file that is
delivered with prism but I can't find the right places.
I would be grateful for every hint!

Regards!

On 2 Nov., 17:09, Matthew Gertner <matthew.gert...@gmail.com> wrote:
> Good finds. Can you file bugs about both of these issues in Bugzilla?
> Please include as much description as possible (e.g. copy/paste from
> your post).
>
> Cheers,
> Matt
>

TCP

unread,
Nov 19, 2009, 10:47:23 AM11/19/09
to mozilla-labs-prism
Hi!
I've found a solution for the first problem.
To get it to work you have to change following in the startup-function
(webrunner.js):

"...
if (!window.arguments || !window.arguments[0] || !(window.arguments
[0] instanceof Ci.nsICommandLine)) {
// Not the main window, so we're done
var browser = this._getBrowser();
browser.webProgress.addProgressListener(this,
Ci.nsIWebProgress.NOTIFY_ALL);
var openedURL = gPrefService.getCharPref
("shd.browser.opened.url");
var uriFixup = Cc["@mozilla.org/docshell/urifixup;1"].getService
(Ci.nsIURIFixup);
this._uri = uriFixup.createFixupURI(openedURL,
Ci.nsIURIFixup.FIXUP_FLAG_NONE);
this._currentDomain = this._getBaseDomain(this._uri);
return;
}
..."

The ugly thing is that I can't find a possibility at this point to get
the new url.
What I've done to get it working is to write the url in the prefs when
prism opens a new window with "createChromeWindow2" (webrunner.js).
If somebody can recommend a better way to get the url let me know!

Regards!

Matthew Gertner

unread,
Dec 15, 2009, 11:13:15 AM12/15/09
to mozilla-l...@googlegroups.com
If I'm understanding correctly, this looks problematic to me since the
WebRunner object is a singleton and you're changing one of the
attributes (_uri). Handling of popup windows is problematic in Prism
for reasons like this, and I think it needs a bit of an architectural
overhaul. Thanks for filing those bugs. I'll definitely keep this
issue in mind as I am already planning some big changes to the
architecture.

Matt
> --
>
> You received this message because you are subscribed to the Google Groups "mozilla-labs-prism" group.
> To post to this group, send email to mozilla-l...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/mozilla-labs-prism?hl=.
>
>
>
Reply all
Reply to author
Forward
0 new messages