Bug 826037 - Re-introduce an obsolete private browsing service in order to not break all Jetpack add-ons; r=jdm

This commit is contained in:
Ehsan Akhgari 2013-01-02 16:41:32 -05:00
parent db50648ef1
commit 9e4ef49c27
6 changed files with 66 additions and 3 deletions

View File

@ -11,9 +11,7 @@ include $(DEPTH)/config/autoconf.mk
MODULE = privatebrowsing
ifndef MOZ_PER_WINDOW_PRIVATE_BROWSING
DIRS = src
endif
TEST_DIRS += test

View File

@ -15,6 +15,15 @@ LIBRARY_NAME = privatebrowsing_s
FORCE_STATIC_LIB = 1
USE_STATIC_LIBS = 1
ifdef MOZ_PER_WINDOW_PRIVATE_BROWSING
EXTRA_COMPONENTS = \
nsPrivateBrowsingServiceObsolete.manifest \
nsPrivateBrowsingServiceObsolete.js \
$(NULL)
else
CPPSRCS = \
nsPrivateBrowsingServiceWrapper.cpp \
$(NULL)
@ -29,4 +38,6 @@ EXTRA_PP_COMPONENTS = \
nsPrivateBrowsingService.js \
$(NULL)
endif
include $(topsrcdir)/config/rules.mk

View File

@ -0,0 +1,21 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
const Ci = Components.interfaces;
// This dummy object just emulates the old nsIPrivateBrowsingService, and is
// non-functional in every aspect. It is only used to make Jetpack work
// again.
function PrivateBrowsingService() {
}
PrivateBrowsingService.prototype = {
classID: Components.ID("{ba0e4d3d-7be2-41a0-b723-a7c16b22ebe9}"),
QueryInterface: XPCOMUtils.generateQI([Ci.nsIPrivateBrowsingService])
};
this.NSGetFactory = XPCOMUtils.generateNSGetFactory([PrivateBrowsingService]);

View File

@ -0,0 +1,15 @@
# WebappRT doesn't need these instructions, and they don't necessarily work
# with it, but it does use a GRE directory that the GRE shares with Firefox,
# so in order to prevent the instructions from being processed for WebappRT,
# we need to restrict them to the applications that depend on them, i.e.:
#
# b2g: {3c2e2abc-06d4-11e1-ac3b-374f68613e61}
# browser: {ec8030f7-c20a-464f-9b0e-13a3a9e97384}
# mobile/android: {aa3c5121-dab2-40e2-81ca-7ea25febc110}
# mobile/xul: {a23983c0-fd0e-11dc-95ff-0800200c9a66}
#
# In theory we should do this for all these instructions, but in practice it is
# sufficient to do it for the app-startup one, and the file is simpler that way.
component {ba0e4d3d-7be2-41a0-b723-a7c16b22ebe9} nsPrivateBrowsingServiceObsolete.js
contract @mozilla.org/privatebrowsing;1 {ba0e4d3d-7be2-41a0-b723-a7c16b22ebe9}

View File

@ -125,7 +125,9 @@ ifdef MOZ_TOOLKIT_SEARCH
XPIDLSRCS += nsIBrowserSearchService.idl
endif
ifndef MOZ_PER_WINDOW_PRIVATE_BROWSING
ifdef MOZ_PER_WINDOW_PRIVATE_BROWSING
XPIDLSRCS += nsIPrivateBrowsingServiceObsolete.idl
else
XPIDLSRCS += nsIPrivateBrowsingService.idl
endif

View File

@ -0,0 +1,16 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsISupports.idl"
[scriptable, uuid(7ad4b7f1-5a88-41aa-9b40-713009bc57b3)]
interface nsIPrivateBrowsingService : nsISupports
{
// This space is intentionally left blank!
// This is a remnant from the old dying global private browsing service.
// You should fix your code to not rely on this interface, as it will
// be removed completely soon.
};