Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

privatebrowsing in xulrunner

6 views
Skip to first unread message

Bullja

unread,
Nov 20, 2009, 4:26:48 AM11/20/09
to
Hi,
as I understand, XULRunner isn't build with the privatebrowsing-
interfaces. Currently in my application there always appears an
warning + error message in the error console, because a function in
globalOverlay.js does try to access the nsIPrivateBrowsingService.
What about creating ifdefs for disabling/enabling functions which try
to access privatebrowsing interfaces?

To reproduce:
* Use XULRunner 1.9.2 or newer
* Open Error Console via window.open("chrome://global/content/
console.xul", "_blank",

"chrome,extrachrome,menubar,resizable,scrollbars,status,toolbar");
* Close the error console
* Open the error console again and you see this two messages:

Warning: reference to undefined property Components.classes
['@mozilla.org/privatebrowsing;1']
Source File: chrome://global/content/globalOverlay.js
Line: 17
Error: this.console.appendItem is not a function
Source File: chrome://global/content/consoleBindings.xml
Line: 83

The warning occur in this function (line 17):
1.
function closeWindow(aClose, aPromptFunction)
2.
{
3.
//@line 5 "e:\builds\moz2_slave\mozilla-1.9.2-win32-xulrunner
\build\toolkit\content\globalOverlay.js"
4.
var windowCount = 0;
5.
var wm = Components.classes["@mozilla.org/appshell/window-
mediator;1"]
6.
.getService
(Components.interfaces.nsIWindowMediator);
7.
var e = wm.getEnumerator(null);
8.

9.
while (e.hasMoreElements()) {
10.
var w = e.getNext();
11.
if (++windowCount == 2)
12.
break;
13.
}
14.

15.
var inPrivateBrowsing = false;
16.
try {
17.
var pbSvc = Components.classes["@mozilla.org/privatebrowsing;
1"]
18.
.getService
(Components.interfaces.nsIPrivateBrowsingService);
19.
inPrivateBrowsing = pbSvc.privateBrowsingEnabled;
20.
} catch(e) {
21.
// safe to ignore
22.
return f
23.
}
24.

25.
// If we're down to the last window and someone tries to shut
down, check to make sure we can!
26.
if (windowCount == 1 && !canQuitApplication())
27.
return false;
28.
else if (windowCount != 1 || inPrivateBrowsing)
29.
//@line 30 "e:\builds\moz2_slave\mozilla-1.9.2-win32-xulrunner
\build\toolkit\content\globalOverlay.js"
30.
if (typeof(aPromptFunction) == "function" && !aPromptFunction
())
31.
return false;
32.

33.
if (aClose)
34.
window.close();
35.

36.
return true;
37.
}

Kind Regards

Neil

unread,
Nov 21, 2009, 7:14:28 PM11/21/09
to
Bullja wrote:

>as I understand, XULRunner isn't build with the privatebrowsing-interfaces. Currently in my application there always appears an warning + error message in the error console, because a function in globalOverlay.js does try to access the nsIPrivateBrowsingService.
>
>
This was introduced by bug 468565, and might be fixed by bug 502307,
although only for XulRunner 1.9.3 or newer.

>What about creating ifdefs for disabling/enabling functions which try to access privatebrowsing interfaces?
>
>To reproduce:
>* Use XULRunner 1.9.2 or newer
>
>

Or 1.9.1 or SeaMonkey 2.0 or Thunderbird 3.0, if you have the
appropriate preferences set.

--
Warning: May contain traces of nuts.

0 new messages