Closed
Bug 911797
Opened 11 years ago
Closed 8 years ago
xulrunner window.open oddness
Categories
(Toolkit Graveyard :: XULRunner, defect)
Tracking
(Not tracked)
RESOLVED
INCOMPLETE
People
(Reporter: laszlo, Unassigned)
Details
(Whiteboard: [bugday-20131021])
User Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/30.0.1595.0 Safari/537.36 Steps to reproduce: This is somehow related to https://bugzilla.mozilla.org/show_bug.cgi?id=385472 which is resolved invalid, although I don't think it's right that way. We have a xulrunner with a <window> and a <browser> element within. The browser element loads some random site which has a window.open in it somewhere. The preferences for opening new windows are: pref("browser.link.open_newwindow.restriction", 0); pref("browser.link.open_newwindow", 1); Actual results: If ANY window.open gets called (doesn't matter if on some event or at load time), the xulrunner exits gracefully, the window disappears, the process exits without any exit code (0). No stack trace, strace()-ing the process shows now SIGSEGV. Firing up the xulrunner with -jsconsole and looking at what happens, changes the behavior: it exits on the second window.open call, the first window.open call outputs this to the console: Error: NS_ERROR_FAILURE: Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIDOMJSWindow.open] Expected results: The window.open-ed url either should've open a new window, or load in the same window as a fallback. In order to fix that, I had to create the same code for the chrome level of our xulrunner: var windowMediator = Components.classes["@mozilla.org/appshell/window-mediator;1"] .getService(Components.interfaces.nsIWindowMediator); var topChromeWindow = windowMediator.getMostRecentWindow(null); topChromeWindow.browserDOMWindow = { openURI: function(uri, domWindow, where, context) { var newWindow = window.openDialog(); return newWindow; } };
Reporter | ||
Comment 1•11 years ago
|
||
There's a typo: No stack trace, strace()-ing the process shows _no_ SIGSEGV.
Updated•11 years ago
|
Component: Untriaged → XULRunner
Product: Firefox → Toolkit
Whiteboard: [bugday-20131021]
Comment 2•10 years ago
|
||
This only works if you've created your own browser dom window window.browserDOMWindow = new MyBrowserDOMWindow();
If you want window.open() to open a new tab, implement nsIBrowserDOMWindow.openURI() and create tabs there. See firefox's browser.js file as a reference. If you want window.open() to open a new window, you need to set browser.chromeURL in the pref: pref("browser.chromeURL", "chrome://myapp/content/mybrowser.xul"); and in mybrowser.xul you put a <xul:browser> with type="content-primary": <?xml version="1.0"?> <?xml-stylesheet href="chrome://global/skin" type="text/css"?> <xul:window title ="xulshell" xmlns:xul ="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" sizemode = "maximized" width ="800" height ="600"> <xul:script type="application/javascript" src="chrome://myapp/content/mybrowser.js" /> <xul:tooltip id="aHTMLTooltip" page="true"/> <xul:browser flex="1" id ="browser" src ="" type="content-primary" tooltip="aHTMLTooltip" /> </xul:window> and xulrunner will use this <xul:browser> to load the url of window.open().
Comment 4•8 years ago
|
||
XULRunner has been removed from the Mozilla tree: see https://groups.google.com/forum/#!topic/mozilla.dev.platform/_rFMunG2Bgw for context. I am closing all the bugs currently in the XULRunner bugzilla component, in preparation for moving this component to the graveyard. If this bug is still valid in a XULRunner-less world, it will need to be moved to a different bugzilla component to be reopened.
Status: UNCONFIRMED → RESOLVED
Closed: 8 years ago
Resolution: --- → INCOMPLETE
Assignee | ||
Updated•8 years ago
|
Product: Toolkit → Toolkit Graveyard
You need to log in
before you can comment on or make changes to this bug.
Description
•