mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-08 10:44:56 +00:00
merge mozilla-inbound to mozilla-central a=merge
This commit is contained in:
commit
5c08a87874
@ -36,7 +36,12 @@ ProxyAccessible::GetCOMInterface(void** aOutAccessible) const
|
||||
AccessibleWrap* wrap = WrapperFor(this);
|
||||
bool isDefunct = false;
|
||||
ProxyAccessible* thisPtr = const_cast<ProxyAccessible*>(this);
|
||||
thisPtr->mCOMProxy = wrap->GetIAccessibleFor(kChildIdSelf, &isDefunct);
|
||||
// NB: Don't pass CHILDID_SELF here, use the absolute MSAA ID. Otherwise
|
||||
// GetIAccessibleFor will recurse into this function and we will just
|
||||
// overflow the stack.
|
||||
VARIANT realId = {VT_I4};
|
||||
realId.ulVal = wrap->GetExistingID();
|
||||
thisPtr->mCOMProxy = wrap->GetIAccessibleFor(realId, &isDefunct);
|
||||
}
|
||||
|
||||
RefPtr<IAccessible> addRefed = mCOMProxy;
|
||||
|
@ -229,7 +229,6 @@ DEFAULT_TEST_PREFS = {
|
||||
'browser.newtabpage.introShown': True,
|
||||
# Disable useragent updates.
|
||||
'general.useragent.updates.enabled': False,
|
||||
'dom.apps.customization.enabled': True,
|
||||
'media.eme.enabled': True,
|
||||
'media.eme.apiVisible': True,
|
||||
# Don't forceably kill content processes after a timeout
|
||||
|
@ -37,7 +37,6 @@
|
||||
"browser.pagethumbnails.capturing_disabled": true,
|
||||
"browser.download.panel.shown": true,
|
||||
"general.useragent.updates.enabled": false,
|
||||
"dom.apps.customization.enabled": true,
|
||||
"media.eme.enabled": true,
|
||||
"media.eme.apiVisible": true,
|
||||
"dom.ipc.tabs.shutdownTimeoutSecs": 0,
|
||||
|
@ -876,13 +876,6 @@ pref("gfx.screen-mirroring.enabled", true);
|
||||
// The url of the page used to display network error details.
|
||||
pref("b2g.neterror.url", "net_error.html");
|
||||
|
||||
// Enable PAC generator for B2G.
|
||||
pref("network.proxy.pac_generator", true);
|
||||
|
||||
// List of app origins to apply browsing traffic proxy setting, separated by
|
||||
// comma. Specify '*' in the list to apply to all apps.
|
||||
pref("network.proxy.browsing.app_origins", "app://system.gaiamobile.org");
|
||||
|
||||
// Enable Web Speech synthesis API
|
||||
pref("media.webspeech.synth.enabled", true);
|
||||
|
||||
@ -938,7 +931,6 @@ pref("browser.autofocus", false);
|
||||
pref("dom.wakelock.enabled", true);
|
||||
|
||||
// Enable webapps add-ons
|
||||
pref("dom.apps.customization.enabled", true);
|
||||
pref("dom.apps.reviewer_paths", "/reviewers/,/extension/reviewers/");
|
||||
|
||||
// New implementation to unify touch-caret and selection-carets.
|
||||
|
@ -35,10 +35,6 @@ XPCOMUtils.defineLazyServiceGetter(this, "uuidgen",
|
||||
"@mozilla.org/uuid-generator;1",
|
||||
"nsIUUIDGenerator");
|
||||
|
||||
XPCOMUtils.defineLazyServiceGetter(this, "gPACGenerator",
|
||||
"@mozilla.org/pac-generator;1",
|
||||
"nsIPACGenerator");
|
||||
|
||||
// Once Bug 731746 - Allow chrome JS object to implement nsIDOMEventTarget
|
||||
// is resolved this helper could be removed.
|
||||
var SettingsListener = {
|
||||
@ -481,40 +477,6 @@ setUpdateTrackingId();
|
||||
});
|
||||
})();
|
||||
|
||||
// =================== Proxy server ======================
|
||||
(function setupBrowsingProxySettings() {
|
||||
function setPAC() {
|
||||
let usePAC;
|
||||
try {
|
||||
usePAC = Services.prefs.getBoolPref('network.proxy.pac_generator');
|
||||
} catch (ex) {}
|
||||
|
||||
if (usePAC) {
|
||||
Services.prefs.setCharPref('network.proxy.autoconfig_url',
|
||||
gPACGenerator.generate());
|
||||
Services.prefs.setIntPref('network.proxy.type',
|
||||
Ci.nsIProtocolProxyService.PROXYCONFIG_PAC);
|
||||
}
|
||||
}
|
||||
|
||||
SettingsListener.observe('browser.proxy.enabled', false, function(value) {
|
||||
Services.prefs.setBoolPref('network.proxy.browsing.enabled', value);
|
||||
setPAC();
|
||||
});
|
||||
|
||||
SettingsListener.observe('browser.proxy.host', '', function(value) {
|
||||
Services.prefs.setCharPref('network.proxy.browsing.host', value);
|
||||
setPAC();
|
||||
});
|
||||
|
||||
SettingsListener.observe('browser.proxy.port', 0, function(value) {
|
||||
Services.prefs.setIntPref('network.proxy.browsing.port', value);
|
||||
setPAC();
|
||||
});
|
||||
|
||||
setPAC();
|
||||
})();
|
||||
|
||||
// ======================= Dogfooders FOTA ==========================
|
||||
if (AppConstants.MOZ_B2G_RIL) {
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "AppsUtils",
|
||||
|
@ -624,9 +624,6 @@
|
||||
@RESPATH@/components/TestInterfaceJSMaplike.js
|
||||
#endif
|
||||
|
||||
@RESPATH@/components/PACGenerator.js
|
||||
@RESPATH@/components/PACGenerator.manifest
|
||||
|
||||
; Modules
|
||||
@RESPATH@/modules/*
|
||||
|
||||
|
@ -2,15 +2,16 @@
|
||||
// event.clipboardData.
|
||||
|
||||
add_task(function*() {
|
||||
var searchbar = document.getElementById("searchbar");
|
||||
var textbox = document.createElement("textbox");
|
||||
document.documentElement.appendChild(textbox);
|
||||
|
||||
searchbar.focus();
|
||||
searchbar.value = "Text";
|
||||
searchbar.select();
|
||||
textbox.focus();
|
||||
textbox.value = "Text";
|
||||
textbox.select();
|
||||
|
||||
yield new Promise((resolve, reject) => {
|
||||
searchbar.addEventListener("copy", function copyEvent(event) {
|
||||
searchbar.removeEventListener("copy", copyEvent, true);
|
||||
textbox.addEventListener("copy", function copyEvent(event) {
|
||||
textbox.removeEventListener("copy", copyEvent, true);
|
||||
event.clipboardData.setData("text/plain", "Alternate");
|
||||
// For this test, it doesn't matter that the file isn't actually a file.
|
||||
event.clipboardData.setData("application/x-moz-file", "Sample");
|
||||
@ -36,11 +37,11 @@ add_task(function*() {
|
||||
});
|
||||
is (output, "Passed", "Paste file");
|
||||
|
||||
searchbar.focus();
|
||||
textbox.focus();
|
||||
|
||||
yield new Promise((resolve, reject) => {
|
||||
searchbar.addEventListener("paste", function copyEvent(event) {
|
||||
searchbar.removeEventListener("paste", copyEvent, true);
|
||||
textbox.addEventListener("paste", function copyEvent(event) {
|
||||
textbox.removeEventListener("paste", copyEvent, true);
|
||||
|
||||
let dt = event.clipboardData;
|
||||
is(dt.types.length, 3, "number of types");
|
||||
@ -55,5 +56,7 @@ add_task(function*() {
|
||||
EventUtils.synthesizeKey("v", { accelKey: true });
|
||||
});
|
||||
|
||||
document.documentElement.removeChild(textbox);
|
||||
|
||||
yield BrowserTestUtils.removeTab(tab);
|
||||
});
|
||||
|
@ -569,9 +569,6 @@
|
||||
@RESPATH@/components/TestInterfaceJSMaplike.js
|
||||
#endif
|
||||
|
||||
@RESPATH@/components/PACGenerator.js
|
||||
@RESPATH@/components/PACGenerator.manifest
|
||||
|
||||
; [Extensions]
|
||||
@RESPATH@/components/extensions-toolkit.manifest
|
||||
@RESPATH@/browser/components/extensions-browser.manifest
|
||||
|
@ -31,7 +31,6 @@
|
||||
#include "mozilla/HashFunctions.h"
|
||||
|
||||
#include "nsIAppsService.h"
|
||||
#include "mozIApplication.h"
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
|
@ -918,12 +918,9 @@ cargo_build_flags += --verbose
|
||||
# We need to run cargo unconditionally, because cargo is the only thing that
|
||||
# has full visibility into how changes in Rust sources might affect the final
|
||||
# build.
|
||||
#
|
||||
# XXX: We're passing `-C debuginfo=1` to rustc to work around an llvm-dsymutil
|
||||
# crash (bug 1301751). This should be temporary until we upgrade to Rust 1.12.
|
||||
force-cargo-build:
|
||||
$(REPORT_BUILD)
|
||||
env CARGO_TARGET_DIR=. RUSTC=$(RUSTC) RUSTFLAGS='-C debuginfo=1' $(CARGO) build $(cargo_build_flags) --
|
||||
env CARGO_TARGET_DIR=. RUSTC=$(RUSTC) $(CARGO) build $(cargo_build_flags) --
|
||||
|
||||
$(RUST_LIBRARY_FILE): force-cargo-build
|
||||
endif # CARGO_FILE
|
||||
|
@ -99,13 +99,7 @@ function tunnelToInnerBrowser(outer, inner) {
|
||||
// even though it's not true. Since the actions the browser UI performs are sent
|
||||
// down to the inner browser by this tunnel, the tab's remoteness effectively is the
|
||||
// remoteness of the inner browser.
|
||||
Object.defineProperty(outer, "isRemoteBrowser", {
|
||||
get() {
|
||||
return true;
|
||||
},
|
||||
configurable: true,
|
||||
enumerable: true,
|
||||
});
|
||||
outer.setAttribute("remote", "true");
|
||||
|
||||
// Clear out any cached state that references the current non-remote XBL binding,
|
||||
// such as form fill controllers. Otherwise they will remain in place and leak the
|
||||
@ -222,11 +216,13 @@ function tunnelToInnerBrowser(outer, inner) {
|
||||
// Reset overridden XBL properties and methods. Deleting the override
|
||||
// means it will fallback to the original XBL binding definitions which
|
||||
// are on the prototype.
|
||||
delete outer.isRemoteBrowser;
|
||||
delete outer.hasContentOpener;
|
||||
delete outer.docShellIsActive;
|
||||
delete outer.preserveLayers;
|
||||
|
||||
// Reset @remote since this is now back to a regular, non-remote browser
|
||||
outer.setAttribute("remote", "false");
|
||||
|
||||
// Delete the PopupNotifications getter added for permission doorhangers
|
||||
delete inner.ownerGlobal.PopupNotifications;
|
||||
|
||||
|
@ -324,6 +324,8 @@ ResponsiveUI.prototype = {
|
||||
});
|
||||
yield this.swap.start();
|
||||
|
||||
this.tab.addEventListener("BeforeTabRemotenessChange", this);
|
||||
|
||||
// Notify the inner browser to start the frame script
|
||||
yield message.request(this.toolWindow, "start-frame-script");
|
||||
|
||||
@ -350,18 +352,21 @@ ResponsiveUI.prototype = {
|
||||
// gracefully, but that shouldn't be a problem since the tab will go away.
|
||||
// So, skip any yielding when we're about to close the tab.
|
||||
let isWindowClosing = options && options.reason === "unload";
|
||||
let isTabClosing = (options && options.reason === "TabClose") || isWindowClosing;
|
||||
let isTabContentDestroying =
|
||||
isWindowClosing || (options && (options.reason === "TabClose" ||
|
||||
options.reason === "BeforeTabRemotenessChange"));
|
||||
|
||||
// Ensure init has finished before starting destroy
|
||||
if (!isTabClosing) {
|
||||
if (!isTabContentDestroying) {
|
||||
yield this.inited;
|
||||
}
|
||||
|
||||
this.tab.removeEventListener("TabClose", this);
|
||||
this.tab.removeEventListener("BeforeTabRemotenessChange", this);
|
||||
this.browserWindow.removeEventListener("unload", this);
|
||||
this.toolWindow.removeEventListener("message", this);
|
||||
|
||||
if (!isTabClosing) {
|
||||
if (!isTabContentDestroying) {
|
||||
// Notify the inner browser to stop the frame script
|
||||
yield message.request(this.toolWindow, "stop-frame-script");
|
||||
}
|
||||
@ -378,7 +383,7 @@ ResponsiveUI.prototype = {
|
||||
// The actor handles clearing any overrides itself, so it's not necessary to clear
|
||||
// anything on shutdown client side.
|
||||
let clientClosed = this.client.close();
|
||||
if (!isTabClosing) {
|
||||
if (!isTabContentDestroying) {
|
||||
yield clientClosed;
|
||||
}
|
||||
this.client = this.emulationFront = null;
|
||||
@ -411,8 +416,9 @@ ResponsiveUI.prototype = {
|
||||
case "message":
|
||||
this.handleMessage(event);
|
||||
break;
|
||||
case "unload":
|
||||
case "BeforeTabRemotenessChange":
|
||||
case "TabClose":
|
||||
case "unload":
|
||||
ResponsiveUIManager.closeIfNeeded(browserWindow, tab, {
|
||||
reason: event.type,
|
||||
});
|
||||
|
@ -32,7 +32,8 @@ support-files =
|
||||
[browser_permission_doorhanger.js]
|
||||
[browser_resize_cmd.js]
|
||||
[browser_screenshot_button.js]
|
||||
[browser_shutdown_close_sync.js]
|
||||
[browser_tab_close.js]
|
||||
[browser_tab_remoteness_change.js]
|
||||
[browser_toolbox_computed_view.js]
|
||||
[browser_toolbox_rule_view.js]
|
||||
[browser_toolbox_swap_browsers.js]
|
||||
|
@ -7,13 +7,6 @@
|
||||
|
||||
const TEST_URL = "http://example.com/";
|
||||
|
||||
function waitForClientClose(ui) {
|
||||
return new Promise(resolve => {
|
||||
info("RDM's debugger client is now closed");
|
||||
ui.client.addOneTimeListener("closed", resolve);
|
||||
});
|
||||
}
|
||||
|
||||
add_task(function* () {
|
||||
let tab = yield addTab(TEST_URL);
|
||||
|
@ -0,0 +1,44 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
"use strict";
|
||||
|
||||
// Verify RDM closes synchronously when tabs change remoteness.
|
||||
|
||||
const TEST_URL = "http://example.com/";
|
||||
|
||||
add_task(function* () {
|
||||
let tab = yield addTab(TEST_URL);
|
||||
|
||||
let { ui } = yield openRDM(tab);
|
||||
let clientClosed = waitForClientClose(ui);
|
||||
|
||||
closeRDM(tab, {
|
||||
reason: "BeforeTabRemotenessChange",
|
||||
});
|
||||
|
||||
// This flag is set at the end of `ResponsiveUI.destroy`. If it is true
|
||||
// without yielding on `closeRDM` above, then we must have closed
|
||||
// synchronously.
|
||||
is(ui.destroyed, true, "RDM closed synchronously");
|
||||
|
||||
yield clientClosed;
|
||||
yield removeTab(tab);
|
||||
});
|
||||
|
||||
add_task(function* () {
|
||||
let tab = yield addTab(TEST_URL);
|
||||
|
||||
let { ui } = yield openRDM(tab);
|
||||
let clientClosed = waitForClientClose(ui);
|
||||
|
||||
// Load URL that requires the main process, forcing a remoteness flip
|
||||
yield load(tab.linkedBrowser, "about:robots");
|
||||
|
||||
// This flag is set at the end of `ResponsiveUI.destroy`. If it is true without
|
||||
// yielding on `closeRDM` itself and only removing the tab, then we must have closed
|
||||
// synchronously in response to tab closing.
|
||||
is(ui.destroyed, true, "RDM closed synchronously");
|
||||
|
||||
yield clientClosed;
|
||||
});
|
@ -336,3 +336,10 @@ function addDeviceForTest(device) {
|
||||
ok(removeDevice(device), `Removed Test Device "${device.name}" from the list.`);
|
||||
});
|
||||
}
|
||||
|
||||
function waitForClientClose(ui) {
|
||||
return new Promise(resolve => {
|
||||
info("RDM's debugger client is now closed");
|
||||
ui.client.addOneTimeListener("closed", resolve);
|
||||
});
|
||||
}
|
||||
|
@ -43,7 +43,6 @@
|
||||
#include "nsIDOMStorage.h"
|
||||
#include "nsIContentViewer.h"
|
||||
#include "nsIDocumentLoaderFactory.h"
|
||||
#include "nsIMozBrowserFrame.h"
|
||||
#include "nsCURILoader.h"
|
||||
#include "nsDocShellCID.h"
|
||||
#include "nsDOMCID.h"
|
||||
@ -1253,10 +1252,6 @@ nsDocShell::LoadURI(nsIURI* aURI,
|
||||
return NS_OK; // JS may not handle returning of an error code
|
||||
}
|
||||
|
||||
if (DoAppRedirectIfNeeded(aURI, aLoadInfo, aFirstParty)) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIURI> referrer;
|
||||
nsCOMPtr<nsIURI> originalURI;
|
||||
bool loadReplace = false;
|
||||
@ -6729,32 +6724,6 @@ nsDocShell::ForceRefreshURIFromTimer(nsIURI* aURI,
|
||||
return ForceRefreshURI(aURI, aDelay, aMetaRefresh);
|
||||
}
|
||||
|
||||
bool
|
||||
nsDocShell::DoAppRedirectIfNeeded(nsIURI* aURI,
|
||||
nsIDocShellLoadInfo* aLoadInfo,
|
||||
bool aFirstParty)
|
||||
{
|
||||
uint32_t appId = nsIDocShell::GetAppId();
|
||||
|
||||
if (appId != nsIScriptSecurityManager::NO_APP_ID &&
|
||||
appId != nsIScriptSecurityManager::UNKNOWN_APP_ID) {
|
||||
nsCOMPtr<nsIAppsService> appsService =
|
||||
do_GetService(APPS_SERVICE_CONTRACTID);
|
||||
NS_ASSERTION(appsService, "No AppsService available");
|
||||
nsCOMPtr<nsIURI> redirect;
|
||||
nsresult rv = appsService->GetRedirect(appId, aURI, getter_AddRefs(redirect));
|
||||
if (NS_SUCCEEDED(rv) && redirect) {
|
||||
rv = LoadURI(redirect, aLoadInfo, nsIWebNavigation::LOAD_FLAGS_NONE,
|
||||
aFirstParty);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocShell::ForceRefreshURI(nsIURI* aURI, int32_t aDelay, bool aMetaRefresh)
|
||||
{
|
||||
@ -7460,10 +7429,6 @@ nsDocShell::OnRedirectStateChange(nsIChannel* aOldChannel,
|
||||
return;
|
||||
}
|
||||
|
||||
if (DoAppRedirectIfNeeded(newURI, nullptr, false)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Below a URI visit is saved (see AddURIVisit method doc).
|
||||
// The visit chain looks something like:
|
||||
// ...
|
||||
@ -10808,35 +10773,6 @@ nsDocShell::DoURILoad(nsIURI* aURI,
|
||||
"DoURILoad thinks this is a document and InternalLoad does not");
|
||||
}
|
||||
|
||||
|
||||
// For mozWidget, display a load error if we navigate to a page which is not
|
||||
// claimed in |widgetPages|.
|
||||
// When we go to display a load error for an invalid mozWidget page, we will
|
||||
// try to load an about:neterror page, which is also an invalid mozWidget
|
||||
// page. To avoid recursion, we skip this check if aURI's scheme is "about".
|
||||
|
||||
// The goal is to prevent leaking sensitive information of an invalid page of
|
||||
// an app, so allowing about:blank would not be conflict to the goal.
|
||||
bool isAbout = false;
|
||||
rv = aURI->SchemeIs("about", &isAbout);
|
||||
if (NS_SUCCEEDED(rv) && !isAbout &&
|
||||
nsIDocShell::GetIsApp()) {
|
||||
nsCOMPtr<Element> frameElement = mScriptGlobal->AsOuter()->GetFrameElementInternal();
|
||||
if (frameElement) {
|
||||
nsCOMPtr<nsIMozBrowserFrame> browserFrame = do_QueryInterface(frameElement);
|
||||
// |GetReallyIsApp| indicates the browser frame is a valid app or widget.
|
||||
// Here we prevent navigating to an app or widget which loses its validity
|
||||
// by loading invalid page or other way.
|
||||
if (browserFrame && !browserFrame->GetReallyIsApp()) {
|
||||
nsCOMPtr<nsIObserverService> serv = services::GetObserverService();
|
||||
if (serv) {
|
||||
serv->NotifyObservers(GetDocument(), "invalid-widget", nullptr);
|
||||
}
|
||||
return NS_ERROR_MALFORMED_URI;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// open a channel for the url
|
||||
nsCOMPtr<nsIChannel> channel;
|
||||
|
||||
|
@ -727,12 +727,6 @@ protected:
|
||||
// Convenience method for getting our parent docshell. Can return null
|
||||
already_AddRefed<nsDocShell> GetParentDocshell();
|
||||
|
||||
// Check if we have an app redirect registered for the URI and redirect if
|
||||
// needed. Returns true if a redirect happened, false otherwise.
|
||||
bool DoAppRedirectIfNeeded(nsIURI* aURI,
|
||||
nsIDocShellLoadInfo* aLoadInfo,
|
||||
bool aFirstParty);
|
||||
|
||||
// Check if aURI is about:newtab.
|
||||
bool IsAboutNewtab(nsIURI* aURI);
|
||||
|
||||
|
@ -17,9 +17,6 @@ Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
Cu.import("resource://gre/modules/Promise.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "UserCustomizations",
|
||||
"resource://gre/modules/UserCustomizations.jsm");
|
||||
|
||||
const APPS_SERVICE_CID = Components.ID("{05072afa-92fe-45bf-ae22-39b69c117058}");
|
||||
|
||||
function AppsService()
|
||||
@ -116,15 +113,6 @@ AppsService.prototype = {
|
||||
throw Cr.NS_ERROR_NOT_IMPLEMENTED;
|
||||
},
|
||||
|
||||
getRedirect: function getRedirect(aLocalId, aURI) {
|
||||
debug("getRedirect for " + aLocalId + " " + aURI.spec);
|
||||
if (this.isInvalidId(aLocalId)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
throw Cr.NS_ERROR_NOT_IMPLEMENTED;
|
||||
},
|
||||
|
||||
getScopeByLocalId: function(aLocalId) {
|
||||
debug("getScopeByLocalId( " + aLocalId + " )");
|
||||
if (this.isInvalidId(aLocalId)) {
|
||||
@ -135,16 +123,6 @@ AppsService.prototype = {
|
||||
return null;
|
||||
},
|
||||
|
||||
isExtensionResource: function(aURI) {
|
||||
// This is only expected to be used by NeckoParent, and will not work
|
||||
// properly in child processes.
|
||||
if (Services.appinfo.processType != Ci.nsIXULRuntime.PROCESS_TYPE_DEFAULT) {
|
||||
throw Cr.NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
return UserCustomizations.isFromExtension(aURI);
|
||||
},
|
||||
|
||||
classID : APPS_SERVICE_CID,
|
||||
QueryInterface : XPCOMUtils.generateQI([Ci.nsIAppsService])
|
||||
}
|
||||
|
@ -53,15 +53,6 @@ mozIApplication.prototype = {
|
||||
return (perm === Ci.nsIPermissionManager.ALLOW_ACTION);
|
||||
},
|
||||
|
||||
hasWidgetPage: function(aPageURL) {
|
||||
let uri = Services.io.newURI(aPageURL, null, null);
|
||||
let filepath = AppsUtils.getFilePath(uri.path);
|
||||
let eliminatedUri = Services.io.newURI(uri.prePath + filepath, null, null);
|
||||
let equalCriterion = aUrl => Services.io.newURI(aUrl, null, null)
|
||||
.equals(eliminatedUri);
|
||||
return this.widgetPages.find(equalCriterion) !== undefined;
|
||||
},
|
||||
|
||||
get principal() {
|
||||
if (this._principal) {
|
||||
return this._principal;
|
||||
@ -122,8 +113,6 @@ function _setAppProperties(aObj, aApp) {
|
||||
aObj.storeId = aApp.storeId || "";
|
||||
aObj.storeVersion = aApp.storeVersion || 0;
|
||||
aObj.role = aApp.role || "";
|
||||
aObj.redirects = aApp.redirects;
|
||||
aObj.widgetPages = aApp.widgetPages || [];
|
||||
aObj.kind = aApp.kind;
|
||||
aObj.enabled = aApp.enabled !== undefined ? aApp.enabled : true;
|
||||
aObj.sideloaded = aApp.sideloaded;
|
||||
@ -855,10 +844,6 @@ ManifestHelper.prototype = {
|
||||
return this._localeProp("package_path");
|
||||
},
|
||||
|
||||
get widgetPages() {
|
||||
return this._localeProp("widgetPages");
|
||||
},
|
||||
|
||||
get size() {
|
||||
return this._manifest["size"] || 0;
|
||||
},
|
||||
|
@ -1,132 +0,0 @@
|
||||
/* 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/. */
|
||||
|
||||
"use strict";
|
||||
|
||||
// Manages registration of message managers from child processes and
|
||||
// broadcasting messages to them.
|
||||
|
||||
this.EXPORTED_SYMBOLS = ["MessageBroadcaster"];
|
||||
|
||||
this.MessageBroadcaster = {
|
||||
appGetter: null,
|
||||
children: [],
|
||||
|
||||
init: function(aAppGetter) {
|
||||
if (!aAppGetter || typeof aAppGetter !== "function") {
|
||||
throw "MessageBroadcaster.init needs a function parameter";
|
||||
}
|
||||
this.appGetter = aAppGetter;
|
||||
},
|
||||
|
||||
// We manage refcounting of listeners per message manager.
|
||||
addMessageListener: function(aMsgNames, aApp, aMm) {
|
||||
aMsgNames.forEach(aMsgName => {
|
||||
let manifestURL = aApp && aApp.manifestURL;
|
||||
if (!(aMsgName in this.children)) {
|
||||
this.children[aMsgName] = [];
|
||||
}
|
||||
|
||||
let mmFound = this.children[aMsgName].some(mmRef => {
|
||||
if (mmRef.mm === aMm) {
|
||||
mmRef.refCount++;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
if (!mmFound) {
|
||||
this.children[aMsgName].push({
|
||||
mm: aMm,
|
||||
refCount: 1
|
||||
});
|
||||
}
|
||||
|
||||
// If the state reported by the registration is outdated, update it now.
|
||||
if (manifestURL && ((aMsgName === 'Webapps:FireEvent') ||
|
||||
(aMsgName === 'Webapps:UpdateState'))) {
|
||||
let app = this.appGetter(aApp.manifestURL);
|
||||
if (app && ((aApp.installState !== app.installState) ||
|
||||
(aApp.downloading !== app.downloading))) {
|
||||
debug("Got a registration from an outdated app: " +
|
||||
manifestURL);
|
||||
let aEvent ={
|
||||
type: app.installState,
|
||||
app: app,
|
||||
manifestURL: app.manifestURL,
|
||||
manifest: app.manifest
|
||||
};
|
||||
aMm.sendAsyncMessage(aMsgName, aEvent);
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
removeMessageListener: function(aMsgNames, aMm) {
|
||||
if (aMsgNames.length === 1 &&
|
||||
aMsgNames[0] === "Webapps:Internal:AllMessages") {
|
||||
for (let msgName in this.children) {
|
||||
let msg = this.children[msgName];
|
||||
|
||||
for (let mmI = msg.length - 1; mmI >= 0; mmI -= 1) {
|
||||
let mmRef = msg[mmI];
|
||||
if (mmRef.mm === aMm) {
|
||||
msg.splice(mmI, 1);
|
||||
}
|
||||
}
|
||||
|
||||
if (msg.length === 0) {
|
||||
delete this.children[msgName];
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
aMsgNames.forEach(aMsgName => {
|
||||
if (!(aMsgName in this.children)) {
|
||||
return;
|
||||
}
|
||||
|
||||
let removeIndex;
|
||||
this.children[aMsgName].some((mmRef, index) => {
|
||||
if (mmRef.mm === aMm) {
|
||||
mmRef.refCount--;
|
||||
if (mmRef.refCount === 0) {
|
||||
removeIndex = index;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
if (removeIndex) {
|
||||
this.children[aMsgName].splice(removeIndex, 1);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
// Some messages can be listened by several content processes:
|
||||
// Webapps:AddApp
|
||||
// Webapps:RemoveApp
|
||||
// Webapps:Install:Return:OK
|
||||
// Webapps:Uninstall:Return:OK
|
||||
// Webapps:Uninstall:Broadcast:Return:OK
|
||||
// Webapps:FireEvent
|
||||
// Webapps:checkForUpdate:Return:OK
|
||||
// Webapps:UpdateState
|
||||
broadcastMessage: function(aMsgName, aContent) {
|
||||
if (!(aMsgName in this.children)) {
|
||||
return;
|
||||
}
|
||||
this.children[aMsgName].forEach((mmRef) => {
|
||||
mmRef.mm.sendAsyncMessage(aMsgName, this.formatMessage(aContent));
|
||||
});
|
||||
},
|
||||
|
||||
formatMessage: function(aData) {
|
||||
let msg = aData;
|
||||
delete msg["mm"];
|
||||
return msg;
|
||||
},
|
||||
}
|
@ -268,11 +268,6 @@ this.PermissionsTable = { geolocation: {
|
||||
privileged: DENY_ACTION,
|
||||
certified: ALLOW_ACTION
|
||||
},
|
||||
"embed-widgets": {
|
||||
app: DENY_ACTION,
|
||||
privileged: ALLOW_ACTION,
|
||||
certified: ALLOW_ACTION
|
||||
},
|
||||
"background-sensors": {
|
||||
app: DENY_ACTION,
|
||||
privileged: DENY_ACTION,
|
||||
|
@ -1,177 +0,0 @@
|
||||
/* 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/. */
|
||||
|
||||
"use strict";
|
||||
|
||||
const Cu = Components.utils;
|
||||
const Cc = Components.classes;
|
||||
const Ci = Components.interfaces;
|
||||
|
||||
this.EXPORTED_SYMBOLS = ["UserCustomizations"];
|
||||
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
Cu.import("resource://gre/modules/AppsUtils.jsm");
|
||||
Cu.import("resource://gre/modules/Extension.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "ValueExtractor",
|
||||
"resource://gre/modules/ValueExtractor.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyServiceGetter(this, "console",
|
||||
"@mozilla.org/consoleservice;1",
|
||||
"nsIConsoleService");
|
||||
|
||||
function debug(aMsg) {
|
||||
if (!UserCustomizations._debug) {
|
||||
return;
|
||||
}
|
||||
dump("-*-*- UserCustomizations " + aMsg + "\n");
|
||||
}
|
||||
|
||||
function log(aStr) {
|
||||
console.logStringMessage(aStr);
|
||||
}
|
||||
|
||||
this.UserCustomizations = {
|
||||
extensions: new Map(), // id -> extension. Needed to disable extensions.
|
||||
appId: new Set(),
|
||||
|
||||
register: function(aApp) {
|
||||
if (!this._enabled || !aApp.enabled || aApp.role != "addon") {
|
||||
debug("Rejecting registration (global enabled=" + this._enabled +
|
||||
") (app role=" + aApp.role +
|
||||
", enabled=" + aApp.enabled + ")");
|
||||
return;
|
||||
}
|
||||
|
||||
debug("Starting customization registration for " + aApp.manifestURL + "\n");
|
||||
|
||||
let extension = new Extension({
|
||||
id: AppsUtils.computeHash(aApp.manifestURL),
|
||||
resourceURI: Services.io.newURI(aApp.origin + "/", null, null)
|
||||
});
|
||||
|
||||
this.extensions.set(aApp.manifestURL, extension);
|
||||
let uri = Services.io.newURI(aApp.origin, null, null);
|
||||
debug(`Adding ${uri.host} to appId set`);
|
||||
this.appId.add(uri.host);
|
||||
|
||||
extension.startup()
|
||||
.then(() => { })
|
||||
.catch((err) => {
|
||||
debug(`extension.startup failed: ${err}`);
|
||||
this.appId.delete(uri.host);
|
||||
});
|
||||
},
|
||||
|
||||
unregister: function(aApp) {
|
||||
if (!this._enabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
debug("Starting customization unregistration for " + aApp.manifestURL);
|
||||
if (this.extensions.has(aApp.manifestURL)) {
|
||||
this.extensions.get(aApp.manifestURL).shutdown();
|
||||
this.extensions.delete(aApp.manifestURL);
|
||||
let uri = Services.io.newURI(aApp.origin, null, null);
|
||||
this.appId.delete(uri.host);
|
||||
}
|
||||
},
|
||||
|
||||
isFromExtension: function(aURI) {
|
||||
if (!aURI && Services.prefs.getBoolPref("webextensions.tests")) {
|
||||
// That's the case in mochitests because of the packaging setup:
|
||||
// aURI is expected to be the appURI from the jarChannel but there is
|
||||
// no real app associated to mochitest's jar:remoteopenfile:/// uris.
|
||||
return true;
|
||||
}
|
||||
return this.appId.has(aURI.host);
|
||||
},
|
||||
|
||||
// Checks that this is a valid extension manifest.
|
||||
// The format is documented at https://developer.chrome.com/extensions/manifest
|
||||
checkExtensionManifest: function(aManifest) {
|
||||
if (!aManifest) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const extractor = new ValueExtractor(console);
|
||||
const manifestVersionSpec = {
|
||||
objectName: "extension manifest",
|
||||
object: aManifest,
|
||||
property: "manifest_version",
|
||||
expectedType: "number",
|
||||
trim: true
|
||||
}
|
||||
|
||||
const nameSpec = {
|
||||
objectName: "extension manifest",
|
||||
object: aManifest,
|
||||
property: "name",
|
||||
expectedType: "string",
|
||||
trim: true
|
||||
}
|
||||
|
||||
const versionSpec = {
|
||||
objectName: "extension manifest",
|
||||
object: aManifest,
|
||||
property: "version",
|
||||
expectedType: "string",
|
||||
trim: true
|
||||
}
|
||||
|
||||
let res =
|
||||
extractor.extractValue(manifestVersionSpec) !== undefined &&
|
||||
extractor.extractValue(nameSpec) !== undefined &&
|
||||
extractor.extractValue(versionSpec) !== undefined;
|
||||
|
||||
return res;
|
||||
},
|
||||
|
||||
// Converts a chrome extension manifest into a webapp manifest.
|
||||
convertManifest: function(aManifest) {
|
||||
if (!aManifest) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// Set the type to privileged to ensure we only allow signed addons.
|
||||
let result = {
|
||||
"type": "privileged",
|
||||
"name": aManifest.name,
|
||||
"role": "addon"
|
||||
}
|
||||
|
||||
if (aManifest.description) {
|
||||
result.description = aManifest.description;
|
||||
}
|
||||
|
||||
if (aManifest.icons) {
|
||||
result.icons = aManifest.icons;
|
||||
}
|
||||
|
||||
if (aManifest.version) {
|
||||
result.version = aManifest.version;
|
||||
}
|
||||
|
||||
// chrome extension manifests have a single 'author' property, that we
|
||||
// map to 'developer.name'.
|
||||
// Note that it has to match the one in the mini-manifest.
|
||||
if (aManifest.author) {
|
||||
result.developer = {
|
||||
name: aManifest.author
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
},
|
||||
|
||||
init: function() {
|
||||
this._enabled = false;
|
||||
try {
|
||||
this._enabled = Services.prefs.getBoolPref("dom.apps.customization.enabled");
|
||||
} catch(e) {}
|
||||
},
|
||||
}
|
||||
|
||||
UserCustomizations.init();
|
@ -17,10 +17,8 @@ EXTRA_COMPONENTS += [
|
||||
|
||||
EXTRA_JS_MODULES += [
|
||||
'AppsServiceChild.jsm',
|
||||
'MessageBroadcaster.jsm',
|
||||
'PermissionsInstaller.jsm',
|
||||
'PermissionsTable.jsm',
|
||||
'UserCustomizations.jsm',
|
||||
]
|
||||
|
||||
EXTRA_PP_JS_MODULES += [
|
||||
|
@ -1,66 +0,0 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
var {classes: Cc, interfaces: Ci, utils: Cu} = Components;
|
||||
|
||||
Cu.import("resource:///modules/AppsUtils.jsm");
|
||||
Cu.import("resource:///modules/Services.jsm");
|
||||
|
||||
add_test(function test_has_widget_criterion() {
|
||||
|
||||
// follow the logic |_saveWidgetsFullPath|
|
||||
let baseUri = Services.io.newURI('http://example.com', null, null);
|
||||
let resolve = (aPage)=>{
|
||||
let filepath = AppsUtils.getFilePath(aPage);
|
||||
|
||||
return baseUri.resolve(filepath);
|
||||
};
|
||||
|
||||
let widgetPages = ['/widget.html',
|
||||
'/foo/bar.html'];
|
||||
let resolvedWidgetPages = widgetPages.map(resolve);
|
||||
|
||||
let app = new mozIApplication({widgetPages:resolvedWidgetPages});
|
||||
|
||||
let widgetPageCheck = aPage => app.hasWidgetPage(baseUri.resolve(aPage));
|
||||
|
||||
Assert.ok(widgetPageCheck('/widget.html'), 'should pass for identical path');
|
||||
Assert.ok(widgetPageCheck('/foo/bar.html'), 'should pass for identical path');
|
||||
|
||||
Assert.ok(!widgetPageCheck('/wrong.html'), 'should not pass for wrong path');
|
||||
Assert.ok(!widgetPageCheck('/WIDGET.html'), 'should be case _sensitive_ for path');
|
||||
Assert.ok(!widgetPageCheck('/widget.HTML'), 'should be case _sensitive_ for file extension');
|
||||
|
||||
Assert.ok(widgetPageCheck('/widget.html?aQuery'), 'should be query insensitive');
|
||||
Assert.ok(widgetPageCheck('/widget.html#aHash'), 'should be hash insensitive');
|
||||
Assert.ok(widgetPageCheck('/widget.html?aQuery=aquery#aHash'),
|
||||
'should be hash/query insensitive');
|
||||
|
||||
Assert.ok(widgetPageCheck('HTTP://example.com/widget.html'),
|
||||
'should be case insensitive for protocol');
|
||||
Assert.ok(widgetPageCheck('http://EXAMPLE.COM/widget.html'),
|
||||
'should be case insensitive for domain');
|
||||
Assert.ok(widgetPageCheck('http://example.com:80/widget.html'),
|
||||
'should pass for default port');
|
||||
|
||||
Assert.ok(widgetPageCheck('HTTP://EXAMPLE.COM:80/widget.html?QueryA=queryA&QueryB=queryB#aHash'),
|
||||
'should pass for a really mess one');
|
||||
|
||||
Assert.ok(!widgetPageCheck('foo://example.com/widget.html'),
|
||||
'should not pass for wrong protocol');
|
||||
Assert.ok(!widgetPageCheck('https://example.com/widget.html'),
|
||||
'should not pass for wrong protocol');
|
||||
Assert.ok(!widgetPageCheck('/wrong/widget.html'),
|
||||
'should not pass for additional path');
|
||||
Assert.ok(!widgetPageCheck('/bar.html'),
|
||||
'should not pass for reduced path');
|
||||
Assert.ok(!widgetPageCheck('http://username:password@example.com/widget.html'),
|
||||
'should not pass for userinfo');
|
||||
Assert.ok(!widgetPageCheck('http://example.com:8080/widget.html'),
|
||||
'should not pass non-default port');
|
||||
run_next_test();
|
||||
});
|
||||
|
||||
function run_test() {
|
||||
run_next_test();
|
||||
}
|
@ -34,7 +34,6 @@ add_test(() => {
|
||||
storeId: "aStoreId",
|
||||
storeVersion: 1,
|
||||
role: "aRole",
|
||||
redirects: "aRedirects",
|
||||
kind: "aKind",
|
||||
enabled: true,
|
||||
sideloaded: false
|
||||
|
@ -1,6 +1,5 @@
|
||||
[DEFAULT]
|
||||
|
||||
[test_has_widget_criterion.js]
|
||||
[test_manifestSanitizer.js]
|
||||
[test_manifestHelper.js]
|
||||
[test_moziapplication.js]
|
||||
|
@ -1765,22 +1765,6 @@ nsFrameLoader::GetOwnerIsMozBrowserOrAppFrame(bool* aResult)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
bool
|
||||
nsFrameLoader::OwnerIsWidget()
|
||||
{
|
||||
nsCOMPtr<nsIMozBrowserFrame> browserFrame = do_QueryInterface(mOwnerContent);
|
||||
return browserFrame ? browserFrame->GetReallyIsWidget() : false;
|
||||
}
|
||||
|
||||
|
||||
// The xpcom getter version
|
||||
NS_IMETHODIMP
|
||||
nsFrameLoader::GetOwnerIsWidget(bool* aResult)
|
||||
{
|
||||
*aResult = OwnerIsWidget();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
bool
|
||||
nsFrameLoader::OwnerIsAppFrame()
|
||||
{
|
||||
|
@ -248,12 +248,6 @@ private:
|
||||
*/
|
||||
bool OwnerIsMozBrowserOrAppFrame();
|
||||
|
||||
/**
|
||||
* Is this a frameloader for a bona fide <iframe mozwidget>? (I.e., does the
|
||||
* frame return true for nsIMozBrowserFrame::GetReallyIsWidget()?)
|
||||
*/
|
||||
bool OwnerIsWidget();
|
||||
|
||||
/**
|
||||
* Is this a frameloader for a bona fide <iframe mozapp>? (I.e., does the
|
||||
* frame return true for nsIMozBrowserFrame::GetReallyIsApp()?)
|
||||
|
@ -102,7 +102,6 @@ GK_ATOM(anonid, "anonid")
|
||||
GK_ATOM(anonlocation, "anonlocation")
|
||||
GK_ATOM(any, "any")
|
||||
GK_ATOM(mozapp, "mozapp")
|
||||
GK_ATOM(mozwidget, "mozwidget")
|
||||
GK_ATOM(applet, "applet")
|
||||
GK_ATOM(applyImports, "apply-imports")
|
||||
GK_ATOM(applyTemplates, "apply-templates")
|
||||
|
@ -213,12 +213,6 @@ interface nsIFrameLoader : nsISupports
|
||||
*/
|
||||
readonly attribute boolean ownerIsMozBrowserOrAppFrame;
|
||||
|
||||
/**
|
||||
* Find out whether the owner content really is a widget. If this attribute
|
||||
* returns true, |ownerIsMozBrowserOrAppFrame| must return true.
|
||||
*/
|
||||
readonly attribute boolean ownerIsWidget;
|
||||
|
||||
/**
|
||||
* The last known width of the frame. Reading this property will not trigger
|
||||
* a reflow, and therefore may not reflect the current state of things. It
|
||||
|
@ -70,7 +70,6 @@ var OBSERVED_EVENTS = [
|
||||
'xpcom-shutdown',
|
||||
'audio-playback',
|
||||
'activity-done',
|
||||
'invalid-widget',
|
||||
'will-launch-app'
|
||||
];
|
||||
|
||||
@ -397,9 +396,6 @@ BrowserElementChild.prototype = {
|
||||
case 'xpcom-shutdown':
|
||||
this._shuttingDown = true;
|
||||
break;
|
||||
case 'invalid-widget':
|
||||
sendAsyncMsg('error', { type: 'invalid-widget' });
|
||||
break;
|
||||
case 'will-launch-app':
|
||||
// If the launcher is not visible, let's ignore the message.
|
||||
if (!docShell.isActive) {
|
||||
|
@ -177,13 +177,6 @@ BrowserElementParent::DispatchOpenWindowEvent(Element* aOpenerFrameElement,
|
||||
return BrowserElementParent::OPEN_WINDOW_IGNORED;
|
||||
}
|
||||
|
||||
// Do not dispatch a mozbrowseropenwindow event of a widget to its embedder
|
||||
nsCOMPtr<nsIMozBrowserFrame> browserFrame =
|
||||
do_QueryInterface(aOpenerFrameElement);
|
||||
if (browserFrame && browserFrame->GetReallyIsWidget()) {
|
||||
return BrowserElementParent::OPEN_WINDOW_CANCELLED;
|
||||
}
|
||||
|
||||
nsEventStatus status = nsEventStatus_eIgnore;
|
||||
bool dispatchSucceeded =
|
||||
DispatchCustomDOMEvent(aOpenerFrameElement,
|
||||
|
@ -319,9 +319,6 @@ BrowserElementParent.prototype = {
|
||||
|
||||
_setupMessageListener: function() {
|
||||
this._mm = this._frameLoader.messageManager;
|
||||
this._isWidget = this._frameLoader
|
||||
.QueryInterface(Ci.nsIFrameLoader)
|
||||
.ownerIsWidget;
|
||||
this._mm.addMessageListener('browser-element-api:call', this);
|
||||
this._mm.loadFrameScript("chrome://global/content/extensions.js", true);
|
||||
},
|
||||
@ -389,7 +386,7 @@ BrowserElementParent.prototype = {
|
||||
|
||||
if (aMsg.data.msg_name in mmCalls) {
|
||||
return mmCalls[aMsg.data.msg_name].apply(this, arguments);
|
||||
} else if (!this._isWidget && aMsg.data.msg_name in mmSecuritySensitiveCalls) {
|
||||
} else if (aMsg.data.msg_name in mmSecuritySensitiveCalls) {
|
||||
return mmSecuritySensitiveCalls[aMsg.data.msg_name].apply(this, arguments);
|
||||
}
|
||||
},
|
||||
@ -428,10 +425,8 @@ BrowserElementParent.prototype = {
|
||||
}
|
||||
};
|
||||
|
||||
// 1. We don't handle password-only prompts.
|
||||
// 2. We don't handle for widget case because of security concern.
|
||||
if (authDetail.isOnlyPassword ||
|
||||
this._frameLoader.QueryInterface(Ci.nsIFrameLoader).ownerIsWidget) {
|
||||
// We don't handle password-only prompts.
|
||||
if (authDetail.isOnlyPassword) {
|
||||
cancelCallback();
|
||||
return;
|
||||
}
|
||||
|
@ -40,16 +40,6 @@ nsBrowserElement::IsBrowserElementOrThrow(ErrorResult& aRv)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
nsBrowserElement::IsNotWidgetOrThrow(ErrorResult& aRv)
|
||||
{
|
||||
if (!mOwnerIsWidget) {
|
||||
return true;
|
||||
}
|
||||
aRv.Throw(NS_ERROR_DOM_INVALID_NODE_TYPE_ERR);
|
||||
return false;
|
||||
}
|
||||
|
||||
void
|
||||
nsBrowserElement::InitBrowserElementAPI()
|
||||
{
|
||||
@ -58,8 +48,6 @@ nsBrowserElement::InitBrowserElementAPI()
|
||||
NS_ENSURE_TRUE_VOID(frameLoader);
|
||||
nsresult rv = frameLoader->GetOwnerIsMozBrowserOrAppFrame(&isMozBrowserOrApp);
|
||||
NS_ENSURE_SUCCESS_VOID(rv);
|
||||
rv = frameLoader->GetOwnerIsWidget(&mOwnerIsWidget);
|
||||
NS_ENSURE_SUCCESS_VOID(rv);
|
||||
|
||||
if (!isMozBrowserOrApp) {
|
||||
return;
|
||||
@ -149,7 +137,6 @@ nsBrowserElement::SendMouseEvent(const nsAString& aType,
|
||||
ErrorResult& aRv)
|
||||
{
|
||||
NS_ENSURE_TRUE_VOID(IsBrowserElementOrThrow(aRv));
|
||||
NS_ENSURE_TRUE_VOID(IsNotWidgetOrThrow(aRv));
|
||||
|
||||
nsresult rv = mBrowserElementAPI->SendMouseEvent(aType,
|
||||
aX,
|
||||
@ -177,7 +164,6 @@ nsBrowserElement::SendTouchEvent(const nsAString& aType,
|
||||
ErrorResult& aRv)
|
||||
{
|
||||
NS_ENSURE_TRUE_VOID(IsBrowserElementOrThrow(aRv));
|
||||
NS_ENSURE_TRUE_VOID(IsNotWidgetOrThrow(aRv));
|
||||
|
||||
if (aIdentifiers.Length() != aCount ||
|
||||
aXs.Length() != aCount ||
|
||||
@ -210,7 +196,6 @@ void
|
||||
nsBrowserElement::GoBack(ErrorResult& aRv)
|
||||
{
|
||||
NS_ENSURE_TRUE_VOID(IsBrowserElementOrThrow(aRv));
|
||||
NS_ENSURE_TRUE_VOID(IsNotWidgetOrThrow(aRv));
|
||||
|
||||
nsresult rv = mBrowserElementAPI->GoBack();
|
||||
|
||||
@ -223,7 +208,6 @@ void
|
||||
nsBrowserElement::GoForward(ErrorResult& aRv)
|
||||
{
|
||||
NS_ENSURE_TRUE_VOID(IsBrowserElementOrThrow(aRv));
|
||||
NS_ENSURE_TRUE_VOID(IsNotWidgetOrThrow(aRv));
|
||||
|
||||
nsresult rv = mBrowserElementAPI->GoForward();
|
||||
|
||||
@ -236,7 +220,6 @@ void
|
||||
nsBrowserElement::Reload(bool aHardReload, ErrorResult& aRv)
|
||||
{
|
||||
NS_ENSURE_TRUE_VOID(IsBrowserElementOrThrow(aRv));
|
||||
NS_ENSURE_TRUE_VOID(IsNotWidgetOrThrow(aRv));
|
||||
|
||||
nsresult rv = mBrowserElementAPI->Reload(aHardReload);
|
||||
|
||||
@ -249,7 +232,6 @@ void
|
||||
nsBrowserElement::Stop(ErrorResult& aRv)
|
||||
{
|
||||
NS_ENSURE_TRUE_VOID(IsBrowserElementOrThrow(aRv));
|
||||
NS_ENSURE_TRUE_VOID(IsNotWidgetOrThrow(aRv));
|
||||
|
||||
nsresult rv = mBrowserElementAPI->Stop();
|
||||
|
||||
@ -264,7 +246,6 @@ nsBrowserElement::Download(const nsAString& aUrl,
|
||||
ErrorResult& aRv)
|
||||
{
|
||||
NS_ENSURE_TRUE(IsBrowserElementOrThrow(aRv), nullptr);
|
||||
NS_ENSURE_TRUE(IsNotWidgetOrThrow(aRv), nullptr);
|
||||
|
||||
nsCOMPtr<nsIDOMDOMRequest> req;
|
||||
nsCOMPtr<nsIXPConnectWrappedJS> wrappedObj = do_QueryInterface(mBrowserElementAPI);
|
||||
@ -295,7 +276,6 @@ already_AddRefed<DOMRequest>
|
||||
nsBrowserElement::PurgeHistory(ErrorResult& aRv)
|
||||
{
|
||||
NS_ENSURE_TRUE(IsBrowserElementOrThrow(aRv), nullptr);
|
||||
NS_ENSURE_TRUE(IsNotWidgetOrThrow(aRv), nullptr);
|
||||
|
||||
nsCOMPtr<nsIDOMDOMRequest> req;
|
||||
nsresult rv = mBrowserElementAPI->PurgeHistory(getter_AddRefs(req));
|
||||
@ -315,7 +295,6 @@ nsBrowserElement::GetScreenshot(uint32_t aWidth,
|
||||
ErrorResult& aRv)
|
||||
{
|
||||
NS_ENSURE_TRUE(IsBrowserElementOrThrow(aRv), nullptr);
|
||||
NS_ENSURE_TRUE(IsNotWidgetOrThrow(aRv), nullptr);
|
||||
|
||||
nsCOMPtr<nsIDOMDOMRequest> req;
|
||||
nsresult rv = mBrowserElementAPI->GetScreenshot(aWidth, aHeight, aMimeType,
|
||||
@ -337,7 +316,6 @@ void
|
||||
nsBrowserElement::Zoom(float aZoom, ErrorResult& aRv)
|
||||
{
|
||||
NS_ENSURE_TRUE_VOID(IsBrowserElementOrThrow(aRv));
|
||||
NS_ENSURE_TRUE_VOID(IsNotWidgetOrThrow(aRv));
|
||||
|
||||
nsresult rv = mBrowserElementAPI->Zoom(aZoom);
|
||||
|
||||
@ -350,7 +328,6 @@ already_AddRefed<DOMRequest>
|
||||
nsBrowserElement::GetCanGoBack(ErrorResult& aRv)
|
||||
{
|
||||
NS_ENSURE_TRUE(IsBrowserElementOrThrow(aRv), nullptr);
|
||||
NS_ENSURE_TRUE(IsNotWidgetOrThrow(aRv), nullptr);
|
||||
|
||||
nsCOMPtr<nsIDOMDOMRequest> req;
|
||||
nsresult rv = mBrowserElementAPI->GetCanGoBack(getter_AddRefs(req));
|
||||
@ -367,7 +344,6 @@ already_AddRefed<DOMRequest>
|
||||
nsBrowserElement::GetCanGoForward(ErrorResult& aRv)
|
||||
{
|
||||
NS_ENSURE_TRUE(IsBrowserElementOrThrow(aRv), nullptr);
|
||||
NS_ENSURE_TRUE(IsNotWidgetOrThrow(aRv), nullptr);
|
||||
|
||||
nsCOMPtr<nsIDOMDOMRequest> req;
|
||||
nsresult rv = mBrowserElementAPI->GetCanGoForward(getter_AddRefs(req));
|
||||
@ -384,7 +360,6 @@ already_AddRefed<DOMRequest>
|
||||
nsBrowserElement::GetContentDimensions(ErrorResult& aRv)
|
||||
{
|
||||
NS_ENSURE_TRUE(IsBrowserElementOrThrow(aRv), nullptr);
|
||||
NS_ENSURE_TRUE(IsNotWidgetOrThrow(aRv), nullptr);
|
||||
|
||||
nsCOMPtr<nsIDOMDOMRequest> req;
|
||||
nsresult rv = mBrowserElementAPI->GetContentDimensions(getter_AddRefs(req));
|
||||
@ -403,7 +378,6 @@ nsBrowserElement::FindAll(const nsAString& aSearchString,
|
||||
ErrorResult& aRv)
|
||||
{
|
||||
NS_ENSURE_TRUE_VOID(IsBrowserElementOrThrow(aRv));
|
||||
NS_ENSURE_TRUE_VOID(IsNotWidgetOrThrow(aRv));
|
||||
|
||||
uint32_t caseSensitivity;
|
||||
if (aCaseSensitivity == BrowserFindCaseSensitivity::Case_insensitive) {
|
||||
@ -424,7 +398,6 @@ nsBrowserElement::FindNext(BrowserFindDirection aDirection,
|
||||
ErrorResult& aRv)
|
||||
{
|
||||
NS_ENSURE_TRUE_VOID(IsBrowserElementOrThrow(aRv));
|
||||
NS_ENSURE_TRUE_VOID(IsNotWidgetOrThrow(aRv));
|
||||
|
||||
uint32_t direction;
|
||||
if (aDirection == BrowserFindDirection::Backward) {
|
||||
@ -444,7 +417,6 @@ void
|
||||
nsBrowserElement::ClearMatch(ErrorResult& aRv)
|
||||
{
|
||||
NS_ENSURE_TRUE_VOID(IsBrowserElementOrThrow(aRv));
|
||||
NS_ENSURE_TRUE_VOID(IsNotWidgetOrThrow(aRv));
|
||||
|
||||
nsresult rv = mBrowserElementAPI->ClearMatch();
|
||||
|
||||
@ -633,7 +605,6 @@ already_AddRefed<DOMRequest>
|
||||
nsBrowserElement::GetMuted(ErrorResult& aRv)
|
||||
{
|
||||
NS_ENSURE_TRUE(IsBrowserElementOrThrow(aRv), nullptr);
|
||||
NS_ENSURE_TRUE(IsNotWidgetOrThrow(aRv), nullptr);
|
||||
|
||||
nsCOMPtr<nsIDOMDOMRequest> req;
|
||||
nsresult rv = mBrowserElementAPI->GetMuted(getter_AddRefs(req));
|
||||
@ -650,7 +621,6 @@ void
|
||||
nsBrowserElement::Mute(ErrorResult& aRv)
|
||||
{
|
||||
NS_ENSURE_TRUE_VOID(IsBrowserElementOrThrow(aRv));
|
||||
NS_ENSURE_TRUE_VOID(IsNotWidgetOrThrow(aRv));
|
||||
|
||||
nsresult rv = mBrowserElementAPI->Mute();
|
||||
|
||||
@ -663,7 +633,6 @@ void
|
||||
nsBrowserElement::Unmute(ErrorResult& aRv)
|
||||
{
|
||||
NS_ENSURE_TRUE_VOID(IsBrowserElementOrThrow(aRv));
|
||||
NS_ENSURE_TRUE_VOID(IsNotWidgetOrThrow(aRv));
|
||||
|
||||
nsresult rv = mBrowserElementAPI->Unmute();
|
||||
|
||||
@ -676,7 +645,6 @@ already_AddRefed<DOMRequest>
|
||||
nsBrowserElement::GetVolume(ErrorResult& aRv)
|
||||
{
|
||||
NS_ENSURE_TRUE(IsBrowserElementOrThrow(aRv), nullptr);
|
||||
NS_ENSURE_TRUE(IsNotWidgetOrThrow(aRv), nullptr);
|
||||
|
||||
nsCOMPtr<nsIDOMDOMRequest> req;
|
||||
nsresult rv = mBrowserElementAPI->GetVolume(getter_AddRefs(req));
|
||||
@ -693,7 +661,6 @@ void
|
||||
nsBrowserElement::SetVolume(float aVolume, ErrorResult& aRv)
|
||||
{
|
||||
NS_ENSURE_TRUE_VOID(IsBrowserElementOrThrow(aRv));
|
||||
NS_ENSURE_TRUE_VOID(IsNotWidgetOrThrow(aRv));
|
||||
|
||||
nsresult rv = mBrowserElementAPI->SetVolume(aVolume);
|
||||
|
||||
@ -720,7 +687,6 @@ nsBrowserElement::ExecuteScript(const nsAString& aScript,
|
||||
ErrorResult& aRv)
|
||||
{
|
||||
NS_ENSURE_TRUE(IsBrowserElementOrThrow(aRv), nullptr);
|
||||
NS_ENSURE_TRUE(IsNotWidgetOrThrow(aRv), nullptr);
|
||||
|
||||
nsCOMPtr<nsIDOMDOMRequest> req;
|
||||
nsCOMPtr<nsIXPConnectWrappedJS> wrappedObj = do_QueryInterface(mBrowserElementAPI);
|
||||
|
@ -34,7 +34,7 @@ class ErrorResult;
|
||||
class nsBrowserElement
|
||||
{
|
||||
public:
|
||||
nsBrowserElement() : mOwnerIsWidget(false) {}
|
||||
nsBrowserElement() {}
|
||||
virtual ~nsBrowserElement() {}
|
||||
|
||||
void SetVisible(bool aVisible, ErrorResult& aRv);
|
||||
@ -136,8 +136,6 @@ protected:
|
||||
|
||||
private:
|
||||
bool IsBrowserElementOrThrow(ErrorResult& aRv);
|
||||
bool IsNotWidgetOrThrow(ErrorResult& aRv);
|
||||
bool mOwnerIsWidget;
|
||||
};
|
||||
|
||||
} // namespace mozilla
|
||||
|
@ -507,10 +507,6 @@ nsGenericHTMLFrameElement::GetReallyIsBrowserOrApp(bool *aOut)
|
||||
uint32_t permission = nsIPermissionManager::DENY_ACTION;
|
||||
nsresult rv = permMgr->TestPermissionFromPrincipal(principal, "browser", &permission);
|
||||
NS_ENSURE_SUCCESS(rv, NS_OK);
|
||||
if (permission != nsIPermissionManager::ALLOW_ACTION) {
|
||||
rv = permMgr->TestPermissionFromPrincipal(principal, "embed-widgets", &permission);
|
||||
NS_ENSURE_SUCCESS(rv, NS_OK);
|
||||
}
|
||||
*aOut = permission == nsIPermissionManager::ALLOW_ACTION;
|
||||
return NS_OK;
|
||||
}
|
||||
@ -527,20 +523,6 @@ nsGenericHTMLFrameElement::GetReallyIsApp(bool *aOut)
|
||||
|
||||
namespace {
|
||||
|
||||
bool WidgetsEnabled()
|
||||
{
|
||||
static bool sMozWidgetsEnabled = false;
|
||||
static bool sBoolVarCacheInitialized = false;
|
||||
|
||||
if (!sBoolVarCacheInitialized) {
|
||||
sBoolVarCacheInitialized = true;
|
||||
Preferences::AddBoolVarCache(&sMozWidgetsEnabled,
|
||||
"dom.enable_widgets");
|
||||
}
|
||||
|
||||
return sMozWidgetsEnabled;
|
||||
}
|
||||
|
||||
bool NestedEnabled()
|
||||
{
|
||||
static bool sMozNestedEnabled = false;
|
||||
@ -557,26 +539,6 @@ bool NestedEnabled()
|
||||
|
||||
} // namespace
|
||||
|
||||
/* [infallible] */ NS_IMETHODIMP
|
||||
nsGenericHTMLFrameElement::GetReallyIsWidget(bool *aOut)
|
||||
{
|
||||
*aOut = false;
|
||||
if (!WidgetsEnabled()) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsAutoString appManifestURL;
|
||||
GetManifestURLByType(nsGkAtoms::mozapp, appManifestURL);
|
||||
bool isApp = !appManifestURL.IsEmpty();
|
||||
|
||||
nsAutoString widgetManifestURL;
|
||||
GetManifestURLByType(nsGkAtoms::mozwidget, widgetManifestURL);
|
||||
bool isWidget = !widgetManifestURL.IsEmpty();
|
||||
|
||||
*aOut = isWidget && !isApp;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* [infallible] */ NS_IMETHODIMP
|
||||
nsGenericHTMLFrameElement::GetIsolated(bool *aOut)
|
||||
{
|
||||
@ -591,20 +553,15 @@ nsGenericHTMLFrameElement::GetIsolated(bool *aOut)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/** Get manifest url of app or widget
|
||||
* @param AppType: nsGkAtoms::mozapp or nsGkAtoms::mozwidget
|
||||
/*
|
||||
* Get manifest url of app.
|
||||
*/
|
||||
void nsGenericHTMLFrameElement::GetManifestURLByType(nsIAtom *aAppType,
|
||||
nsAString& aManifestURL)
|
||||
void nsGenericHTMLFrameElement::GetManifestURL(nsAString& aManifestURL)
|
||||
{
|
||||
aManifestURL.Truncate();
|
||||
|
||||
if (aAppType != nsGkAtoms::mozapp && aAppType != nsGkAtoms::mozwidget) {
|
||||
return;
|
||||
}
|
||||
|
||||
nsAutoString manifestURL;
|
||||
GetAttr(kNameSpaceID_None, aAppType, manifestURL);
|
||||
GetAttr(kNameSpaceID_None, nsGkAtoms::mozapp, manifestURL);
|
||||
if (manifestURL.IsEmpty()) {
|
||||
return;
|
||||
}
|
||||
@ -613,8 +570,7 @@ void nsGenericHTMLFrameElement::GetManifestURLByType(nsIAtom *aAppType,
|
||||
nsCOMPtr<nsIPermissionManager> permMgr = services::GetPermissionManager();
|
||||
NS_ENSURE_TRUE_VOID(permMgr);
|
||||
nsIPrincipal *principal = NodePrincipal();
|
||||
const char* aPermissionType = (aAppType == nsGkAtoms::mozapp) ? "embed-apps"
|
||||
: "embed-widgets";
|
||||
const char* aPermissionType = "embed-apps";
|
||||
uint32_t permission = nsIPermissionManager::DENY_ACTION;
|
||||
nsresult rv = permMgr->TestPermissionFromPrincipal(principal,
|
||||
aPermissionType,
|
||||
@ -634,17 +590,6 @@ void nsGenericHTMLFrameElement::GetManifestURLByType(nsIAtom *aAppType,
|
||||
return;
|
||||
}
|
||||
|
||||
bool hasWidgetPage = false;
|
||||
nsAutoString src;
|
||||
if (aAppType == nsGkAtoms::mozwidget) {
|
||||
GetAttr(kNameSpaceID_None, nsGkAtoms::src, src);
|
||||
nsresult rv = app->HasWidgetPage(src, &hasWidgetPage);
|
||||
|
||||
if (!NS_SUCCEEDED(rv) || !hasWidgetPage) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
aManifestURL.Assign(manifestURL);
|
||||
}
|
||||
|
||||
@ -668,32 +613,24 @@ nsGenericHTMLFrameElement::GetAppManifestURL(nsAString& aOut)
|
||||
}
|
||||
|
||||
nsAutoString appManifestURL;
|
||||
nsAutoString widgetManifestURL;
|
||||
|
||||
GetManifestURLByType(nsGkAtoms::mozapp, appManifestURL);
|
||||
|
||||
if (WidgetsEnabled()) {
|
||||
GetManifestURLByType(nsGkAtoms::mozwidget, widgetManifestURL);
|
||||
}
|
||||
GetManifestURL(appManifestURL);
|
||||
|
||||
bool isApp = !appManifestURL.IsEmpty();
|
||||
bool isWidget = !widgetManifestURL.IsEmpty();
|
||||
|
||||
if (!isApp && !isWidget) {
|
||||
if (!isApp) {
|
||||
// No valid case to get manifest
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
if (isApp && isWidget) {
|
||||
NS_WARNING("Can not simultaneously be mozapp and mozwidget");
|
||||
if (isApp) {
|
||||
NS_WARNING("Can not simultaneously be mozapp");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsAutoString manifestURL;
|
||||
if (isApp) {
|
||||
manifestURL.Assign(appManifestURL);
|
||||
} else if (isWidget) {
|
||||
manifestURL.Assign(widgetManifestURL);
|
||||
}
|
||||
|
||||
aOut.Assign(manifestURL);
|
||||
|
@ -125,7 +125,7 @@ protected:
|
||||
bool mFullscreenFlag = false;
|
||||
|
||||
private:
|
||||
void GetManifestURLByType(nsIAtom *aAppType, nsAString& aOut);
|
||||
void GetManifestURL(nsAString& aOut);
|
||||
};
|
||||
|
||||
#endif // nsGenericHTMLFrameElement_h
|
||||
|
@ -19,12 +19,6 @@ interface mozIApplication: nsISupports
|
||||
/* Return true if this app has |permission|. */
|
||||
boolean hasPermission(in string permission);
|
||||
|
||||
/**
|
||||
* Return true if this app can be a widget and
|
||||
* its |widgetPages| contains |page|
|
||||
*/
|
||||
boolean hasWidgetPage(in DOMString pageURL);
|
||||
|
||||
/* Application status as defined in nsIPrincipal. */
|
||||
readonly attribute unsigned short appStatus;
|
||||
|
||||
|
@ -73,12 +73,6 @@ interface nsIAppsService : nsISupports
|
||||
|
||||
jsval getAppInfo(in DOMString appId);
|
||||
|
||||
/**
|
||||
* Returns a URI to redirect to when we get a redirection to 'uri'.
|
||||
* Returns null if no redirection is declared for this uri.
|
||||
*/
|
||||
nsIURI getRedirect(in unsigned long localId, in nsIURI uri);
|
||||
|
||||
/**
|
||||
* Returns the localId if the app was installed from a store
|
||||
*/
|
||||
@ -88,11 +82,4 @@ interface nsIAppsService : nsISupports
|
||||
* Returns the scope for app to use with service workers.
|
||||
*/
|
||||
DOMString getScopeByLocalId(in unsigned long localId);
|
||||
|
||||
/**
|
||||
* Returns true if this uri is a script or css resource loaded
|
||||
* from an extension.
|
||||
* Available only in the parent process.
|
||||
*/
|
||||
bool isExtensionResource(in nsIURI uri);
|
||||
};
|
||||
|
@ -25,24 +25,11 @@ interface nsIMozBrowserFrame : nsIDOMMozBrowserFrame
|
||||
* Gets whether this frame really is an app frame.
|
||||
*
|
||||
* In order to really be an app frame, this frame must really be a browser
|
||||
* frame (this requirement will go away eventually), and must satisfy one
|
||||
* and only one of the following conditions:
|
||||
* 1. the frame's mozapp attribute must point to the manifest of a valid app
|
||||
* 2. the frame's mozwidget attribute must point to the manifest of a valid
|
||||
* app, and the src should be in the |widgetPages| specified by the manifest.
|
||||
* frame (this requirement will go away eventually), and the frame's mozapp
|
||||
* attribute must point to the manifest of a valid app.
|
||||
*/
|
||||
[infallible] readonly attribute boolean reallyIsApp;
|
||||
|
||||
/**
|
||||
* Gets whether this frame really is a widget frame.
|
||||
*
|
||||
* In order to really be a frame, this frame must really be a browser
|
||||
* frame (this requirement will go away eventually), the frame's mozwidget
|
||||
* attribute must point to the manifest of a valid app, and the src should
|
||||
* be in the |widgetPages| specified by the manifest.
|
||||
*/
|
||||
[infallible] readonly attribute boolean reallyIsWidget;
|
||||
|
||||
/**
|
||||
* Gets whether this frame is an isolated frame.
|
||||
*
|
||||
@ -58,8 +45,7 @@ interface nsIMozBrowserFrame : nsIDOMMozBrowserFrame
|
||||
[infallible] readonly attribute boolean isolated;
|
||||
|
||||
/**
|
||||
* Gets this frame's app manifest URL or widget manifest URL, if the frame
|
||||
* really is an app frame.
|
||||
* Gets this frame's app manifest URL, if the frame really is an app frame.
|
||||
* Otherwise, returns the empty string.
|
||||
*
|
||||
* This method is guaranteed not to fail.
|
||||
|
@ -105,14 +105,6 @@ var DoPreloadPostfork = function(aCallback) {
|
||||
// the chrome process in its init() function.
|
||||
Cu.import("resource://gre/modules/AppsServiceChild.jsm");
|
||||
|
||||
// Load UserCustomizations.jsm after fork since it sends an async message to
|
||||
// the chrome process in its init() function.
|
||||
try {
|
||||
if (Services.prefs.getBoolPref("dom.apps.customization.enabled")) {
|
||||
Cu.import("resource://gre/modules/UserCustomizations.jsm");
|
||||
}
|
||||
} catch(e) {}
|
||||
|
||||
// Load nsIAppsService after fork since its implementation loads
|
||||
// AppsServiceChild.jsm
|
||||
Cc["@mozilla.org/AppsService;1"].getService(Ci["nsIAppsService"]);
|
||||
|
@ -31,10 +31,6 @@ XPCOMUtils.defineLazyServiceGetter(this, "gNetworkService",
|
||||
"@mozilla.org/network/service;1",
|
||||
"nsINetworkService");
|
||||
|
||||
XPCOMUtils.defineLazyServiceGetter(this, "gPACGenerator",
|
||||
"@mozilla.org/pac-generator;1",
|
||||
"nsIPACGenerator");
|
||||
|
||||
XPCOMUtils.defineLazyServiceGetter(this, "gTetheringService",
|
||||
"@mozilla.org/tethering/service;1",
|
||||
"nsITetheringService");
|
||||
@ -62,8 +58,7 @@ const CONNECTION_TYPE_WIFI = 3;
|
||||
const CONNECTION_TYPE_OTHER = 4;
|
||||
const CONNECTION_TYPE_NONE = 5;
|
||||
|
||||
const PROXY_TYPE_MANUAL = Ci.nsIProtocolProxyService.PROXYCONFIG_MANUAL;
|
||||
const PROXY_TYPE_PAC = Ci.nsIProtocolProxyService.PROXYCONFIG_PAC;
|
||||
const MANUAL_PROXY_CONFIGURATION = 1;
|
||||
|
||||
var debug;
|
||||
function updateDebug() {
|
||||
@ -1111,6 +1106,8 @@ NetworkManager.prototype = {
|
||||
}
|
||||
|
||||
debug("Going to set proxy settings for " + aNetwork.info.name + " network interface.");
|
||||
// Sets manual proxy configuration.
|
||||
Services.prefs.setIntPref("network.proxy.type", MANUAL_PROXY_CONFIGURATION);
|
||||
|
||||
// Do not use this proxy server for all protocols.
|
||||
Services.prefs.setBoolPref("network.proxy.share_proxy_settings", false);
|
||||
@ -1119,19 +1116,6 @@ NetworkManager.prototype = {
|
||||
let port = aNetwork.httpProxyPort === 0 ? 8080 : aNetwork.httpProxyPort;
|
||||
Services.prefs.setIntPref("network.proxy.http_port", port);
|
||||
Services.prefs.setIntPref("network.proxy.ssl_port", port);
|
||||
|
||||
let usePAC;
|
||||
try {
|
||||
usePAC = Services.prefs.getBoolPref("network.proxy.pac_generator");
|
||||
} catch (ex) {}
|
||||
|
||||
if (usePAC) {
|
||||
Services.prefs.setCharPref("network.proxy.autoconfig_url",
|
||||
gPACGenerator.generate());
|
||||
Services.prefs.setIntPref("network.proxy.type", PROXY_TYPE_PAC);
|
||||
} else {
|
||||
Services.prefs.setIntPref("network.proxy.type", PROXY_TYPE_MANUAL);
|
||||
}
|
||||
} catch(ex) {
|
||||
debug("Exception " + ex + ". Unable to set proxy setting for " +
|
||||
aNetwork.info.name + " network interface.");
|
||||
@ -1141,24 +1125,12 @@ NetworkManager.prototype = {
|
||||
clearNetworkProxy: function() {
|
||||
debug("Going to clear all network proxy.");
|
||||
|
||||
Services.prefs.clearUserPref("network.proxy.type");
|
||||
Services.prefs.clearUserPref("network.proxy.share_proxy_settings");
|
||||
Services.prefs.clearUserPref("network.proxy.http");
|
||||
Services.prefs.clearUserPref("network.proxy.http_port");
|
||||
Services.prefs.clearUserPref("network.proxy.ssl");
|
||||
Services.prefs.clearUserPref("network.proxy.ssl_port");
|
||||
|
||||
let usePAC;
|
||||
try {
|
||||
usePAC = Services.prefs.getBoolPref("network.proxy.pac_generator");
|
||||
} catch (ex) {}
|
||||
|
||||
if (usePAC) {
|
||||
Services.prefs.setCharPref("network.proxy.autoconfig_url",
|
||||
gPACGenerator.generate());
|
||||
Services.prefs.setIntPref("network.proxy.type", PROXY_TYPE_PAC);
|
||||
} else {
|
||||
Services.prefs.clearUserPref("network.proxy.type");
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
|
@ -6,8 +6,7 @@ MARIONETTE_HEAD_JS = "head.js";
|
||||
|
||||
const HTTP_PROXY = "10.0.2.200";
|
||||
const HTTP_PROXY_PORT = "8080";
|
||||
const PROXY_TYPE_MANUAL = Ci.nsIProtocolProxyService.PROXYCONFIG_MANUAL;
|
||||
const PROXY_TYPE_PAC = Ci.nsIProtocolProxyService.PROXYCONFIG_PAC;
|
||||
const MANUAL_PROXY_CONFIGURATION = 1;
|
||||
|
||||
// Test initial State
|
||||
function verifyInitialState() {
|
||||
@ -39,7 +38,6 @@ function waitForHttpProxyVerified(aShouldBeSet) {
|
||||
return new Promise(function(aResolve, aReject) {
|
||||
try {
|
||||
waitFor(aResolve, () => {
|
||||
let usePAC = SpecialPowers.getBoolPref("network.proxy.pac_generator");
|
||||
let proxyType = SpecialPowers.getIntPref("network.proxy.type");
|
||||
let httpProxy = SpecialPowers.getCharPref("network.proxy.http");
|
||||
let sslProxy = SpecialPowers.getCharPref("network.proxy.ssl");
|
||||
@ -47,15 +45,12 @@ function waitForHttpProxyVerified(aShouldBeSet) {
|
||||
let sslProxyPort = SpecialPowers.getIntPref("network.proxy.ssl_port");
|
||||
|
||||
if ((aShouldBeSet &&
|
||||
(usePAC ? proxyType == PROXY_TYPE_PAC :
|
||||
proxyType == PROXY_TYPE_MANUAL) &&
|
||||
proxyType == MANUAL_PROXY_CONFIGURATION &&
|
||||
httpProxy == HTTP_PROXY &&
|
||||
sslProxy == HTTP_PROXY &&
|
||||
httpProxyPort == HTTP_PROXY_PORT &&
|
||||
sslProxyPort == HTTP_PROXY_PORT) ||
|
||||
(!aShouldBeSet &&
|
||||
(usePAC ? proxyType == PROXY_TYPE_PAC :
|
||||
proxyType != PROXY_TYPE_MANUAL) &&
|
||||
(!aShouldBeSet && proxyType != MANUAL_PROXY_CONFIGURATION &&
|
||||
!httpProxy && !sslProxy && !httpProxyPort && !sslProxyPort)) {
|
||||
return true;
|
||||
}
|
||||
|
@ -2875,6 +2875,7 @@ GetDebugEnvironmentForMissing(JSContext* cx, const EnvironmentIter& ei)
|
||||
// Generators should always reify their scopes.
|
||||
MOZ_ASSERT(!callee->isGenerator());
|
||||
|
||||
JS::ExposeObjectToActiveJS(callee);
|
||||
Rooted<CallObject*> callobj(cx, CallObject::createHollowForDebug(cx, callee));
|
||||
if (!callobj)
|
||||
return nullptr;
|
||||
|
@ -3,12 +3,14 @@
|
||||
- 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/. -->
|
||||
|
||||
<?xml-stylesheet href="chrome://browser/content/browser.css" type="text/css"?>
|
||||
|
||||
<window id="main-window"
|
||||
onload="startup();"
|
||||
windowtype="navigator:browser"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
|
||||
<browser id="content" type="content-targetable" src="https://mozilla.com" flex="1"/>
|
||||
<browser id="content" type="content-primary" src="https://mozilla.com" flex="1" remote="true"/>
|
||||
|
||||
<script type="application/javascript" src="chrome://browser/content/geckoview.js"/>
|
||||
</window>
|
||||
|
@ -414,9 +414,6 @@
|
||||
@BINPATH@/components/LegacyProviders.manifest
|
||||
@BINPATH@/components/LegacyPresentationControlService.js
|
||||
|
||||
@BINPATH@/components/PACGenerator.js
|
||||
@BINPATH@/components/PACGenerator.manifest
|
||||
|
||||
@BINPATH@/components/TVSimulatorService.js
|
||||
@BINPATH@/components/TVSimulatorService.manifest
|
||||
|
||||
|
@ -965,7 +965,7 @@ pref("devtools.debugger.prompt-connection", true);
|
||||
// Block tools from seeing / interacting with certified apps
|
||||
pref("devtools.debugger.forbid-certified-apps", true);
|
||||
// List of permissions that a sideloaded app can't ask for
|
||||
pref("devtools.apps.forbidden-permissions", "embed-apps,embed-widgets");
|
||||
pref("devtools.apps.forbidden-permissions", "embed-apps");
|
||||
|
||||
// DevTools default color unit
|
||||
pref("devtools.defaultColorUnit", "authored");
|
||||
|
@ -1,165 +0,0 @@
|
||||
/* 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/. */
|
||||
|
||||
"use strict";
|
||||
|
||||
const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
|
||||
|
||||
Cu.import('resource://gre/modules/XPCOMUtils.jsm');
|
||||
Cu.import('resource://gre/modules/Services.jsm');
|
||||
|
||||
var DEBUG = false;
|
||||
|
||||
if (DEBUG) {
|
||||
debug = function (s) { dump("-*- PACGenerator: " + s + "\n"); };
|
||||
}
|
||||
else {
|
||||
debug = function (s) {};
|
||||
}
|
||||
|
||||
const PACGENERATOR_CONTRACTID = "@mozilla.org/pac-generator;1";
|
||||
const PACGENERATOR_CID = Components.ID("{788507c4-eb5f-4de8-b19b-e0d531974e8a}");
|
||||
|
||||
//
|
||||
// RFC 2396 section 3.2.2:
|
||||
//
|
||||
// host = hostname | IPv4address
|
||||
// hostname = *( domainlabel "." ) toplabel [ "." ]
|
||||
// domainlabel = alphanum | alphanum *( alphanum | "-" ) alphanum
|
||||
// toplabel = alpha | alpha *( alphanum | "-" ) alphanum
|
||||
// IPv4address = 1*digit "." 1*digit "." 1*digit "." 1*digit
|
||||
//
|
||||
const HOST_REGEX =
|
||||
new RegExp("^(?:" +
|
||||
// *( domainlabel "." )
|
||||
"(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)*" +
|
||||
// toplabel
|
||||
"[a-z](?:[a-z0-9-]*[a-z0-9])?" +
|
||||
"|" +
|
||||
// IPv4 address
|
||||
"\\d+\\.\\d+\\.\\d+\\.\\d+" +
|
||||
")$",
|
||||
"i");
|
||||
|
||||
function PACGenerator() {
|
||||
debug("Starting PAC Generator service.");
|
||||
}
|
||||
|
||||
PACGenerator.prototype = {
|
||||
|
||||
classID : PACGENERATOR_CID,
|
||||
|
||||
QueryInterface : XPCOMUtils.generateQI([Ci.nsIPACGenerator]),
|
||||
|
||||
classInfo : XPCOMUtils.generateCI({classID: PACGENERATOR_CID,
|
||||
contractID: PACGENERATOR_CONTRACTID,
|
||||
classDescription: "PACGenerator",
|
||||
interfaces: [Ci.nsIPACGenerator]}),
|
||||
|
||||
/**
|
||||
* Validate the the host.
|
||||
*/
|
||||
isValidHost: function isValidHost(host) {
|
||||
if (!HOST_REGEX.test(host)) {
|
||||
debug("Unexpected host: '" + host + "'");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns a PAC string based on proxy settings in the preference.
|
||||
* Only effective when the network.proxy.pac_generator preference is true.
|
||||
*/
|
||||
generate: function generate() {
|
||||
let enabled, host, port, proxy;
|
||||
|
||||
try {
|
||||
enabled = Services.prefs.getBoolPref("network.proxy.pac_generator");
|
||||
} catch (ex) {}
|
||||
if (!enabled) {
|
||||
debug("PAC Generator disabled.");
|
||||
return "";
|
||||
}
|
||||
|
||||
let pac = "data:text/plain,function FindProxyForURL(url, host) { ";
|
||||
|
||||
// Direct connection for localhost.
|
||||
pac += "if (shExpMatch(host, 'localhost') || " +
|
||||
"shExpMatch(host, '127.0.0.1')) {" +
|
||||
" return 'DIRECT'; } ";
|
||||
|
||||
// Rules for browsing proxy.
|
||||
try {
|
||||
enabled = Services.prefs.getBoolPref("network.proxy.browsing.enabled");
|
||||
host = Services.prefs.getCharPref("network.proxy.browsing.host");
|
||||
port = Services.prefs.getIntPref("network.proxy.browsing.port");
|
||||
} catch (ex) {}
|
||||
|
||||
if (enabled && host && this.isValidHost(host)) {
|
||||
proxy = host + ":" + ((port && port !== 0) ? port : 8080);
|
||||
let appOrigins;
|
||||
try {
|
||||
appOrigins = Services.prefs.getCharPref("network.proxy.browsing.app_origins");
|
||||
} catch (ex) {}
|
||||
|
||||
pac += "var origins ='" + appOrigins +
|
||||
"'.split(/[ ,]+/).filter(Boolean); " +
|
||||
"if ((origins.indexOf('*') > -1 || origins.indexOf(myAppOrigin()) > -1)" +
|
||||
" && isInIsolatedMozBrowser()) { return 'PROXY " + proxy + "'; } ";
|
||||
}
|
||||
|
||||
// Rules for system proxy.
|
||||
let share;
|
||||
try {
|
||||
share = Services.prefs.getBoolPref("network.proxy.share_proxy_settings");
|
||||
} catch (ex) {}
|
||||
|
||||
if (share) {
|
||||
// Add rules for all protocols.
|
||||
try {
|
||||
host = Services.prefs.getCharPref("network.proxy.http");
|
||||
port = Services.prefs.getIntPref("network.proxy.http_port");
|
||||
} catch (ex) {}
|
||||
|
||||
if (host && this.isValidHost(host)) {
|
||||
proxy = host + ":" + ((port && port !== 0) ? port : 8080);
|
||||
pac += "return 'PROXY " + proxy + "'; "
|
||||
} else {
|
||||
pac += "return 'DIRECT'; ";
|
||||
}
|
||||
} else {
|
||||
// Add rules for specific protocols.
|
||||
const proxyTypes = [
|
||||
{"scheme": "http:", "pref": "http"},
|
||||
{"scheme": "https:", "pref": "ssl"},
|
||||
{"scheme": "ftp:", "pref": "ftp"}
|
||||
];
|
||||
for (let i = 0; i < proxyTypes.length; i++) {
|
||||
try {
|
||||
host = Services.prefs.getCharPref("network.proxy." +
|
||||
proxyTypes[i]["pref"]);
|
||||
port = Services.prefs.getIntPref("network.proxy." +
|
||||
proxyTypes[i]["pref"] + "_port");
|
||||
} catch (ex) {}
|
||||
|
||||
if (host && this.isValidHost(host)) {
|
||||
proxy = host + ":" + (port === 0 ? 8080 : port);
|
||||
pac += "if (url.substring(0, " + (proxyTypes[i]["scheme"]).length +
|
||||
") == '" + proxyTypes[i]["scheme"] + "') { return 'PROXY " +
|
||||
proxy + "'; } ";
|
||||
}
|
||||
}
|
||||
pac += "return 'DIRECT'; ";
|
||||
}
|
||||
|
||||
pac += "}";
|
||||
|
||||
debug("PAC: " + pac);
|
||||
|
||||
return pac;
|
||||
}
|
||||
};
|
||||
|
||||
this.NSGetFactory = XPCOMUtils.generateNSGetFactory([PACGenerator]);
|
@ -1,2 +0,0 @@
|
||||
component {788507c4-eb5f-4de8-b19b-e0d531974e8a} PACGenerator.js
|
||||
contract @mozilla.org/pac-generator;1 {788507c4-eb5f-4de8-b19b-e0d531974e8a}
|
@ -507,64 +507,6 @@ bool PACMyIpAddress(JSContext *cx, unsigned int argc, JS::Value *vp)
|
||||
return GetRunning()->MyIPAddress(args);
|
||||
}
|
||||
|
||||
// myAppId() javascript implementation
|
||||
static
|
||||
bool PACMyAppId(JSContext *cx, unsigned int argc, JS::Value *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
|
||||
if (NS_IsMainThread()) {
|
||||
NS_WARNING("PACMyAppId on Main Thread. How did that happen?");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!GetRunning()) {
|
||||
NS_WARNING("PACMyAppId without a running ProxyAutoConfig object");
|
||||
return false;
|
||||
}
|
||||
|
||||
return GetRunning()->MyAppId(args);
|
||||
}
|
||||
|
||||
// myAppOrigin() javascript implementation
|
||||
static
|
||||
bool PACMyAppOrigin(JSContext *cx, unsigned int argc, JS::Value *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
|
||||
if (NS_IsMainThread()) {
|
||||
NS_WARNING("PACMyAppOrigin on Main Thread. How did that happen?");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!GetRunning()) {
|
||||
NS_WARNING("PACMyAppOrigin without a running ProxyAutoConfig object");
|
||||
return false;
|
||||
}
|
||||
|
||||
return GetRunning()->MyAppOrigin(args);
|
||||
}
|
||||
|
||||
// IsInIsolatedMozBrowser() javascript implementation
|
||||
static
|
||||
bool PACIsInIsolatedMozBrowser(JSContext *cx, unsigned int argc, JS::Value *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
|
||||
if (NS_IsMainThread()) {
|
||||
NS_WARNING("PACIsInIsolatedMozBrowser on Main Thread. How did that happen?");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!GetRunning()) {
|
||||
NS_WARNING("PACIsInIsolatedMozBrowser without a running ProxyAutoConfig"
|
||||
"object");
|
||||
return false;
|
||||
}
|
||||
|
||||
return GetRunning()->IsInIsolatedMozBrowser(args);
|
||||
}
|
||||
|
||||
// proxyAlert(msg) javascript implementation
|
||||
static
|
||||
bool PACProxyAlert(JSContext *cx, unsigned int argc, JS::Value *vp)
|
||||
@ -598,9 +540,6 @@ static const JSFunctionSpec PACGlobalFunctions[] = {
|
||||
// a global "var pacUseMultihomedDNS = true;" will change behavior
|
||||
// of myIpAddress to actively use DNS
|
||||
JS_FS("myIpAddress", PACMyIpAddress, 0, 0),
|
||||
JS_FS("myAppId", PACMyAppId, 0, 0),
|
||||
JS_FS("myAppOrigin", PACMyAppOrigin, 0, 0),
|
||||
JS_FS("isInIsolatedMozBrowser", PACIsInIsolatedMozBrowser, 0, 0),
|
||||
JS_FS("alert", PACProxyAlert, 1, 0),
|
||||
JS_FS_END
|
||||
};
|
||||
@ -819,9 +758,6 @@ ProxyAutoConfig::SetupJS()
|
||||
nsresult
|
||||
ProxyAutoConfig::GetProxyForURI(const nsCString &aTestURI,
|
||||
const nsCString &aTestHost,
|
||||
uint32_t aAppId,
|
||||
const nsString &aAppOrigin,
|
||||
bool aIsInIsolatedMozBrowser,
|
||||
nsACString &result)
|
||||
{
|
||||
if (mJSNeedsSetup)
|
||||
@ -839,9 +775,6 @@ ProxyAutoConfig::GetProxyForURI(const nsCString &aTestURI,
|
||||
// while the event loop is spinning on a DNS function. Don't early return.
|
||||
SetRunning(this);
|
||||
mRunningHost = aTestHost;
|
||||
mRunningAppId = aAppId;
|
||||
mRunningAppOrigin = aAppOrigin;
|
||||
mRunningIsInIsolatedMozBrowser = aIsInIsolatedMozBrowser;
|
||||
|
||||
nsresult rv = NS_ERROR_FAILURE;
|
||||
nsCString clensedURI = aTestURI;
|
||||
@ -1077,33 +1010,5 @@ ProxyAutoConfig::MyIPAddress(const JS::CallArgs &aArgs)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
ProxyAutoConfig::MyAppId(const JS::CallArgs &aArgs)
|
||||
{
|
||||
aArgs.rval().setNumber(mRunningAppId);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
ProxyAutoConfig::MyAppOrigin(const JS::CallArgs &aArgs)
|
||||
{
|
||||
JSContext *cx = mJSContext->Context();
|
||||
JSString *origin =
|
||||
JS_NewStringCopyZ(cx, NS_ConvertUTF16toUTF8(mRunningAppOrigin).get());
|
||||
if (!origin) {
|
||||
return false;
|
||||
}
|
||||
|
||||
aArgs.rval().setString(origin);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
ProxyAutoConfig::IsInIsolatedMozBrowser(const JS::CallArgs &aArgs)
|
||||
{
|
||||
aArgs.rval().setBoolean(mRunningIsInIsolatedMozBrowser);
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace net
|
||||
} // namespace mozilla
|
||||
|
@ -36,9 +36,6 @@ public:
|
||||
void Shutdown();
|
||||
void GC();
|
||||
bool MyIPAddress(const JS::CallArgs &aArgs);
|
||||
bool MyAppId(const JS::CallArgs &aArgs);
|
||||
bool MyAppOrigin(const JS::CallArgs &aArgs);
|
||||
bool IsInIsolatedMozBrowser(const JS::CallArgs &aArgs);
|
||||
bool ResolveAddress(const nsCString &aHostName,
|
||||
NetAddr *aNetAddr, unsigned int aTimeout);
|
||||
|
||||
@ -72,25 +69,12 @@ public:
|
||||
* The URI as an ASCII string to test.
|
||||
* @param aTestHost
|
||||
* The ASCII hostname to test.
|
||||
* @param aAppId
|
||||
* The id of the app requesting connection.
|
||||
* @param aAppOrigin
|
||||
* The origin of the app requesting connection.
|
||||
* @param aIsInIsolatedMozBrowser
|
||||
* True if the frame is an isolated mozbrowser element. <iframe
|
||||
* mozbrowser mozapp> and <xul:browser> are not considered to be
|
||||
* mozbrowser elements. <iframe mozbrowser noisolation> does not count
|
||||
* as isolated since isolation is disabled. Isolation can only be
|
||||
* disabled if the containing document is chrome.
|
||||
*
|
||||
* @param result
|
||||
* result string as defined above.
|
||||
*/
|
||||
nsresult GetProxyForURI(const nsCString &aTestURI,
|
||||
const nsCString &aTestHost,
|
||||
uint32_t aAppId,
|
||||
const nsString &aAppOrigin,
|
||||
bool aIsInIsolatedMozBrowser,
|
||||
nsACString &result);
|
||||
|
||||
private:
|
||||
@ -111,9 +95,6 @@ private:
|
||||
nsCString mPACURI;
|
||||
bool mIncludePath;
|
||||
nsCString mRunningHost;
|
||||
uint32_t mRunningAppId;
|
||||
nsString mRunningAppOrigin;
|
||||
bool mRunningIsInIsolatedMozBrowser;
|
||||
nsCOMPtr<nsITimer> mTimer;
|
||||
};
|
||||
|
||||
|
@ -73,7 +73,6 @@ XPIDL_SOURCES += [
|
||||
'nsINetworkProperties.idl',
|
||||
'nsINSSErrorsService.idl',
|
||||
'nsINullChannel.idl',
|
||||
'nsIPACGenerator.idl',
|
||||
'nsIPackagedAppService.idl',
|
||||
'nsIPackagedAppUtils.idl',
|
||||
'nsIPackagedAppVerifier.idl',
|
||||
@ -294,11 +293,6 @@ elif CONFIG['OS_ARCH'] == 'Linux':
|
||||
'nsNetworkInfoService.cpp',
|
||||
]
|
||||
|
||||
EXTRA_COMPONENTS += [
|
||||
'PACGenerator.js',
|
||||
'PACGenerator.manifest'
|
||||
]
|
||||
|
||||
EXTRA_JS_MODULES += [
|
||||
'NetUtil.jsm',
|
||||
]
|
||||
|
@ -1,15 +0,0 @@
|
||||
/* 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(4b3eeeea-1108-4aa0-8f26-e3ebdeb0454c)]
|
||||
interface nsIPACGenerator : nsISupports
|
||||
{
|
||||
/**
|
||||
* Returns a PAC string based on proxy settings in the preference.
|
||||
* Only effective when the network.proxy.pac_generator preference is true.
|
||||
*/
|
||||
DOMString generate();
|
||||
};
|
@ -5,8 +5,6 @@
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "nsPACMan.h"
|
||||
#include "mozIApplication.h"
|
||||
#include "nsIAppsService.h"
|
||||
#include "nsThreadUtils.h"
|
||||
#include "nsIAuthPrompt.h"
|
||||
#include "nsIPromptFactory.h"
|
||||
@ -234,12 +232,9 @@ private:
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
PendingPACQuery::PendingPACQuery(nsPACMan *pacMan, nsIURI *uri,
|
||||
uint32_t appId, bool isInIsolatedMozBrowser,
|
||||
nsPACManCallback *callback,
|
||||
bool mainThreadResponse)
|
||||
: mPACMan(pacMan)
|
||||
, mAppId(appId)
|
||||
, mIsInIsolatedMozBrowser(isInIsolatedMozBrowser)
|
||||
, mCallback(callback)
|
||||
, mOnMainThreadOnly(mainThreadResponse)
|
||||
{
|
||||
@ -247,18 +242,6 @@ PendingPACQuery::PendingPACQuery(nsPACMan *pacMan, nsIURI *uri,
|
||||
uri->GetAsciiHost(mHost);
|
||||
uri->GetScheme(mScheme);
|
||||
uri->GetPort(&mPort);
|
||||
|
||||
nsCOMPtr<nsIAppsService> appsService =
|
||||
do_GetService(APPS_SERVICE_CONTRACTID);
|
||||
if (!appsService) {
|
||||
return;
|
||||
}
|
||||
nsCOMPtr<mozIApplication> mozApp;
|
||||
nsresult rv = appsService->GetAppByLocalId(appId, getter_AddRefs(mozApp));
|
||||
if (NS_FAILED(rv) || !mozApp) {
|
||||
return;
|
||||
}
|
||||
mozApp->GetOrigin(mAppOrigin);
|
||||
}
|
||||
|
||||
void
|
||||
@ -351,8 +334,7 @@ nsPACMan::Shutdown()
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsPACMan::AsyncGetProxyForURI(nsIURI *uri, uint32_t appId,
|
||||
bool isInIsolatedMozBrowser,
|
||||
nsPACMan::AsyncGetProxyForURI(nsIURI *uri,
|
||||
nsPACManCallback *callback,
|
||||
bool mainThreadResponse)
|
||||
{
|
||||
@ -369,8 +351,7 @@ nsPACMan::AsyncGetProxyForURI(nsIURI *uri, uint32_t appId,
|
||||
}
|
||||
|
||||
RefPtr<PendingPACQuery> query =
|
||||
new PendingPACQuery(this, uri, appId, isInIsolatedMozBrowser, callback,
|
||||
mainThreadResponse);
|
||||
new PendingPACQuery(this, uri, callback, mainThreadResponse);
|
||||
|
||||
if (IsPACURI(uri)) {
|
||||
// deal with this directly instead of queueing it
|
||||
@ -629,8 +610,6 @@ nsPACMan::ProcessPending()
|
||||
// the systemproxysettings didn't complete the resolution. try via PAC
|
||||
if (!completed) {
|
||||
nsresult status = mPAC.GetProxyForURI(query->mSpec, query->mHost,
|
||||
query->mAppId, query->mAppOrigin,
|
||||
query->mIsInIsolatedMozBrowser,
|
||||
pacString);
|
||||
LOG(("Use proxy from PAC: %s\n", pacString.get()));
|
||||
query->Complete(status, pacString);
|
||||
|
@ -59,8 +59,8 @@ class PendingPACQuery final : public Runnable,
|
||||
public LinkedListElement<PendingPACQuery>
|
||||
{
|
||||
public:
|
||||
PendingPACQuery(nsPACMan *pacMan, nsIURI *uri, uint32_t appId,
|
||||
bool isInIsolatedMozBrowser, nsPACManCallback *callback,
|
||||
PendingPACQuery(nsPACMan *pacMan, nsIURI *uri,
|
||||
nsPACManCallback *callback,
|
||||
bool mainThreadResponse);
|
||||
|
||||
// can be called from either thread
|
||||
@ -77,11 +77,6 @@ public:
|
||||
private:
|
||||
nsPACMan *mPACMan; // weak reference
|
||||
|
||||
public:
|
||||
uint32_t mAppId;
|
||||
bool mIsInIsolatedMozBrowser;
|
||||
nsString mAppOrigin;
|
||||
|
||||
private:
|
||||
RefPtr<nsPACManCallback> mCallback;
|
||||
bool mOnMainThreadOnly;
|
||||
@ -116,17 +111,12 @@ public:
|
||||
*
|
||||
* @param uri
|
||||
* The URI to query.
|
||||
* @param appId
|
||||
* The appId of the app making the connection.
|
||||
* @param isInBrowser
|
||||
* True if the iframe has mozbrowser but has no mozapp attribute.
|
||||
* @param callback
|
||||
* The callback to run once the PAC result is available.
|
||||
* @param mustCallbackOnMainThread
|
||||
* If set to false the callback can be made from the PAC thread
|
||||
*/
|
||||
nsresult AsyncGetProxyForURI(nsIURI *uri, uint32_t appId,
|
||||
bool isInBrowser,
|
||||
nsresult AsyncGetProxyForURI(nsIURI *uri,
|
||||
nsPACManCallback *callback,
|
||||
bool mustCallbackOnMainThread);
|
||||
|
||||
|
@ -103,7 +103,6 @@ public:
|
||||
NS_DECL_THREADSAFE_ISUPPORTS
|
||||
|
||||
nsAsyncResolveRequest(nsProtocolProxyService *pps, nsIChannel *channel,
|
||||
uint32_t aAppId, bool aIsInIsolatedMozBrowser,
|
||||
uint32_t aResolveFlags,
|
||||
nsIProtocolProxyCallback *callback)
|
||||
: mStatus(NS_OK)
|
||||
@ -112,8 +111,6 @@ public:
|
||||
, mPPS(pps)
|
||||
, mXPComPPS(pps)
|
||||
, mChannel(channel)
|
||||
, mAppId(aAppId)
|
||||
, mIsInIsolatedMozBrowser(aIsInIsolatedMozBrowser)
|
||||
, mCallback(callback)
|
||||
{
|
||||
NS_ASSERTION(mCallback, "null callback");
|
||||
@ -261,11 +258,9 @@ private:
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
// now that the load is triggered, we can resubmit the query
|
||||
RefPtr<nsAsyncResolveRequest> newRequest =
|
||||
new nsAsyncResolveRequest(mPPS, mChannel, mAppId,
|
||||
mIsInIsolatedMozBrowser, mResolveFlags,
|
||||
new nsAsyncResolveRequest(mPPS, mChannel, mResolveFlags,
|
||||
mCallback);
|
||||
rv = mPPS->mPACMan->AsyncGetProxyForURI(proxyURI, mAppId,
|
||||
mIsInIsolatedMozBrowser,
|
||||
rv = mPPS->mPACMan->AsyncGetProxyForURI(proxyURI,
|
||||
newRequest,
|
||||
true);
|
||||
}
|
||||
@ -304,8 +299,6 @@ private:
|
||||
nsProtocolProxyService *mPPS;
|
||||
nsCOMPtr<nsIProtocolProxyService> mXPComPPS;
|
||||
nsCOMPtr<nsIChannel> mChannel;
|
||||
uint32_t mAppId;
|
||||
bool mIsInIsolatedMozBrowser;
|
||||
nsCOMPtr<nsIProtocolProxyCallback> mCallback;
|
||||
nsCOMPtr<nsIProxyInfo> mProxyInfo;
|
||||
};
|
||||
@ -1207,7 +1200,7 @@ nsProtocolProxyService::DeprecatedBlockingResolve(nsIChannel *aChannel,
|
||||
// but if neither of them are in use, we can just do the work
|
||||
// right here and directly invoke the callback
|
||||
|
||||
rv = Resolve_Internal(aChannel, NECKO_NO_APP_ID, false, info, aFlags,
|
||||
rv = Resolve_Internal(aChannel, info, aFlags,
|
||||
&usePACThread, getter_AddRefs(pi));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
@ -1222,8 +1215,7 @@ nsProtocolProxyService::DeprecatedBlockingResolve(nsIChannel *aChannel,
|
||||
// code, but block this thread on that completion.
|
||||
RefPtr<nsAsyncBridgeRequest> ctx = new nsAsyncBridgeRequest();
|
||||
ctx->Lock();
|
||||
if (NS_SUCCEEDED(mPACMan->AsyncGetProxyForURI(uri, NECKO_NO_APP_ID, false,
|
||||
ctx, false))) {
|
||||
if (NS_SUCCEEDED(mPACMan->AsyncGetProxyForURI(uri, ctx, false))) {
|
||||
// this can really block the main thread, so cap it at 3 seconds
|
||||
ctx->Wait();
|
||||
}
|
||||
@ -1275,14 +1267,9 @@ nsProtocolProxyService::AsyncResolveInternal(nsIChannel *channel, uint32_t flags
|
||||
nsresult rv = GetProxyURI(channel, getter_AddRefs(uri));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
uint32_t appId = NECKO_NO_APP_ID;
|
||||
bool isInIsolatedMozBrowser = false;
|
||||
NS_GetAppInfo(channel, &appId, &isInIsolatedMozBrowser);
|
||||
|
||||
*result = nullptr;
|
||||
RefPtr<nsAsyncResolveRequest> ctx =
|
||||
new nsAsyncResolveRequest(this, channel, appId, isInIsolatedMozBrowser,
|
||||
flags, callback);
|
||||
new nsAsyncResolveRequest(this, channel, flags, callback);
|
||||
|
||||
nsProtocolInfo info;
|
||||
rv = GetProtocolInfo(uri, &info);
|
||||
@ -1296,7 +1283,7 @@ nsProtocolProxyService::AsyncResolveInternal(nsIChannel *channel, uint32_t flags
|
||||
// but if neither of them are in use, we can just do the work
|
||||
// right here and directly invoke the callback
|
||||
|
||||
rv = Resolve_Internal(channel, appId, isInIsolatedMozBrowser, info, flags,
|
||||
rv = Resolve_Internal(channel, info, flags,
|
||||
&usePACThread, getter_AddRefs(pi));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
@ -1318,8 +1305,7 @@ nsProtocolProxyService::AsyncResolveInternal(nsIChannel *channel, uint32_t flags
|
||||
|
||||
// else kick off a PAC thread query
|
||||
|
||||
rv = mPACMan->AsyncGetProxyForURI(uri, appId, isInIsolatedMozBrowser, ctx,
|
||||
true);
|
||||
rv = mPACMan->AsyncGetProxyForURI(uri, ctx, true);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
ctx.forget(result);
|
||||
return rv;
|
||||
@ -1770,8 +1756,6 @@ nsProtocolProxyService::NewProxyInfo_Internal(const char *aType,
|
||||
|
||||
nsresult
|
||||
nsProtocolProxyService::Resolve_Internal(nsIChannel *channel,
|
||||
uint32_t appId,
|
||||
bool isInBrowser,
|
||||
const nsProtocolInfo &info,
|
||||
uint32_t flags,
|
||||
bool *usePACThread,
|
||||
|
@ -215,10 +215,6 @@ protected:
|
||||
*
|
||||
* @param channel
|
||||
* The channel to test.
|
||||
* @param appId
|
||||
* The id of the app making the query.
|
||||
* @param isInBrowser
|
||||
* True if the iframe has mozbrowser but has no mozapp attribute.
|
||||
* @param info
|
||||
* Information about the URI's protocol.
|
||||
* @param flags
|
||||
@ -230,8 +226,6 @@ protected:
|
||||
* The resulting proxy info or null.
|
||||
*/
|
||||
nsresult Resolve_Internal(nsIChannel *channel,
|
||||
uint32_t appId,
|
||||
bool isInBrowser,
|
||||
const nsProtocolInfo &info,
|
||||
uint32_t flags,
|
||||
bool *usePAC,
|
||||
|
@ -647,17 +647,7 @@ NeckoParent::AllocPRemoteOpenFileParent(const SerializedLoadContext& aSerialized
|
||||
}
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIURI> appUri = DeserializeURI(aAppURI);
|
||||
|
||||
if (!haveValidBrowser) {
|
||||
// Extension loads come from chrome and have no valid browser, so we check
|
||||
// for these early on.
|
||||
bool fromExtension = false;
|
||||
if (NS_SUCCEEDED(appsService->IsExtensionResource(appUri, &fromExtension)) &&
|
||||
fromExtension) {
|
||||
RemoteOpenFileParent* parent = new RemoteOpenFileParent(fileURL);
|
||||
return parent;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
@ -11,7 +11,6 @@ MOCHITEST_MANIFESTS += ['mochitests/mochitest.ini']
|
||||
|
||||
XPCSHELL_TESTS_MANIFESTS += [
|
||||
'unit/xpcshell.ini',
|
||||
'unit/xpcshell_b2g.ini',
|
||||
'unit_ipc/xpcshell.ini',
|
||||
]
|
||||
|
||||
|
@ -1,236 +0,0 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
"use strict";
|
||||
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
Cu.import("resource://gre/modules/NetUtil.jsm");
|
||||
|
||||
var ios = Cc["@mozilla.org/network/io-service;1"]
|
||||
.getService(Components.interfaces.nsIIOService);
|
||||
|
||||
var pps = Cc["@mozilla.org/network/protocol-proxy-service;1"].getService();
|
||||
|
||||
var prefs = Cc["@mozilla.org/preferences-service;1"]
|
||||
.getService(Components.interfaces.nsIPrefBranch);
|
||||
|
||||
var pgen = Cc["@mozilla.org/pac-generator;1"]
|
||||
.getService(Components.interfaces.nsIPACGenerator);
|
||||
|
||||
const TARGET_HOST ="www.mozilla.org";
|
||||
const HTTP_HOST = "httpHost";
|
||||
const HTTP_PORT = 1111;
|
||||
const HTTPS_HOST = "httpsHost";
|
||||
const HTTPS_PORT = 2222;
|
||||
const FTP_HOST= "ftpHost";
|
||||
const FTP_PORT = 3333;
|
||||
const MY_APP_ID = 10;
|
||||
const MY_APP_ORIGIN = "apps://browser.gaiamobile.com";
|
||||
const APP_ORIGINS_LIST = "apps://test1.com, apps://browser.gaiamobile.com";
|
||||
const BROWSING_HOST = "browsingHost";
|
||||
const BROWSING_PORT = 4444;
|
||||
const PROXY_TYPE_PAC = Ci.nsIProtocolProxyService.PROXYCONFIG_PAC;
|
||||
|
||||
const proxyTypes = {
|
||||
"http": {"pref": "http", "host": HTTP_HOST, "port": HTTP_PORT},
|
||||
"https": {"pref": "ssl", "host": HTTPS_HOST, "port": HTTPS_PORT},
|
||||
"ftp": {"pref": "ftp", "host": FTP_HOST, "port": FTP_PORT}
|
||||
};
|
||||
|
||||
function default_proxy_settings() {
|
||||
prefs.setBoolPref("network.proxy.pac_generator", true);
|
||||
prefs.setIntPref("network.proxy.type", 0);
|
||||
prefs.setCharPref("network.proxy.autoconfig_url", "");
|
||||
for (let i in proxyTypes) {
|
||||
let p = proxyTypes[i];
|
||||
prefs.setCharPref("network.proxy." + p["pref"], p["host"]);
|
||||
prefs.setIntPref("network.proxy." + p["pref"] + "_port", p["port"]);
|
||||
}
|
||||
}
|
||||
|
||||
function TestResolveCallback(type, host, callback) {
|
||||
this.type = type;
|
||||
this.host = host;
|
||||
this.callback = callback;
|
||||
}
|
||||
TestResolveCallback.prototype = {
|
||||
QueryInterface:
|
||||
function TestResolveCallback_QueryInterface(iid) {
|
||||
if (iid.equals(Components.interfaces.nsIProtocolProxyCallback) ||
|
||||
iid.equals(Components.interfaces.nsISupports))
|
||||
return this;
|
||||
throw Components.results.NS_ERROR_NO_INTERFACE;
|
||||
},
|
||||
|
||||
onProxyAvailable:
|
||||
function TestResolveCallback_onProxyAvailable(req, channel, pi, status) {
|
||||
if (this.type) {
|
||||
// Check for localhost.
|
||||
if (this.host == "localhost" || this.host == "127.0.0.1") {
|
||||
do_check_eq(pi, null);
|
||||
this.callback();
|
||||
return;
|
||||
}
|
||||
|
||||
// Check for browsing proxy.
|
||||
let browsingEnabled;
|
||||
try {
|
||||
browsingEnabled = prefs.getBoolPref("network.proxy.browsing.enabled");
|
||||
} catch (ex) {}
|
||||
|
||||
if (browsingEnabled) {
|
||||
let proxyHost, proxyPort;
|
||||
try {
|
||||
proxyHost = prefs.getCharPref("network.proxy.browsing.host");
|
||||
proxyPort = prefs.getIntPref("network.proxy.browsing.port");
|
||||
} catch (ex) {}
|
||||
|
||||
if (proxyHost) {
|
||||
do_check_eq(pi.host, proxyHost);
|
||||
do_check_eq(pi.port, proxyPort);
|
||||
this.callback();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Check for system proxy.
|
||||
let share;
|
||||
try {
|
||||
share = prefs.getBoolPref("network.proxy.share_proxy_settings");
|
||||
} catch (ex) {}
|
||||
|
||||
let p = share ? proxyTypes["http"] : proxyTypes[this.type];
|
||||
if (p) {
|
||||
let proxyHost, proxyPort;
|
||||
try {
|
||||
proxyHost = prefs.getCharPref("network.proxy." + p["pref"]);
|
||||
proxyPort = prefs.getIntPref("network.proxy." + p["pref"] + "_port");
|
||||
} catch (ex) {}
|
||||
|
||||
if (proxyHost) {
|
||||
// Connection through proxy.
|
||||
do_check_neq(pi, null);
|
||||
do_check_eq(pi.host, proxyHost);
|
||||
do_check_eq(pi.port, proxyPort);
|
||||
} else {
|
||||
// Direct connection.
|
||||
do_check_eq(pi, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.callback();
|
||||
}
|
||||
};
|
||||
|
||||
function test_resolve_type(type, host, callback) {
|
||||
// We have to setup a profile, otherwise indexed db used by webapps
|
||||
// will throw random exception when trying to get profile folder.
|
||||
do_get_profile();
|
||||
|
||||
// We also need a valid nsIXulAppInfo service as Webapps.jsm is querying it.
|
||||
Cu.import("resource://testing-common/AppInfo.jsm");
|
||||
updateAppInfo();
|
||||
|
||||
// Mock getAppByLocalId() to return testing app origin.
|
||||
Cu.import("resource://gre/modules/AppsUtils.jsm");
|
||||
AppsUtils.getAppByLocalId = function(aAppId) {
|
||||
let app = { origin: MY_APP_ORIGIN};
|
||||
return app;
|
||||
};
|
||||
|
||||
let channel = NetUtil.newChannel({
|
||||
uri: type + "://" + host + "/",
|
||||
loadUsingSystemPrincipal: true
|
||||
});
|
||||
channel.loadInfo.originAttributes = { appId: MY_APP_ID,
|
||||
inIsolatedMozBrowser: true
|
||||
};
|
||||
|
||||
let req = pps.asyncResolve(channel, 0, new TestResolveCallback(type, host, callback));
|
||||
}
|
||||
|
||||
function test_resolve(host, callback) {
|
||||
test_resolve_type("http", host, function() {
|
||||
test_resolve_type("https", host, function() {
|
||||
test_resolve_type("ftp", host, run_next_test);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
add_test(function test_localhost() {
|
||||
default_proxy_settings();
|
||||
prefs.setBoolPref("network.proxy.share_proxy_settings", true);
|
||||
Services.prefs.setCharPref("network.proxy.autoconfig_url", pgen.generate());
|
||||
Services.prefs.setIntPref("network.proxy.type", PROXY_TYPE_PAC);
|
||||
test_resolve("localhost", run_next_test);
|
||||
});
|
||||
|
||||
add_test(function test_share_on_proxy() {
|
||||
default_proxy_settings();
|
||||
prefs.setBoolPref("network.proxy.share_proxy_settings", true);
|
||||
Services.prefs.setCharPref("network.proxy.autoconfig_url", pgen.generate());
|
||||
Services.prefs.setIntPref("network.proxy.type", PROXY_TYPE_PAC);
|
||||
test_resolve(TARGET_HOST, run_next_test);
|
||||
});
|
||||
|
||||
add_test(function test_share_on_direct() {
|
||||
default_proxy_settings();
|
||||
prefs.setBoolPref("network.proxy.share_proxy_settings", true);
|
||||
prefs.setCharPref("network.proxy.http", "");
|
||||
prefs.setCharPref("network.proxy.ssl", "");
|
||||
prefs.setCharPref("network.proxy.ftp", "");
|
||||
Services.prefs.setCharPref("network.proxy.autoconfig_url", pgen.generate());
|
||||
Services.prefs.setIntPref("network.proxy.type", PROXY_TYPE_PAC);
|
||||
test_resolve(TARGET_HOST, run_next_test);
|
||||
});
|
||||
|
||||
add_test(function test_share_off_proxy() {
|
||||
default_proxy_settings();
|
||||
prefs.setBoolPref("network.proxy.share_proxy_settings", false);
|
||||
Services.prefs.setCharPref("network.proxy.autoconfig_url", pgen.generate());
|
||||
Services.prefs.setIntPref("network.proxy.type", PROXY_TYPE_PAC);
|
||||
test_resolve(TARGET_HOST, run_next_test);
|
||||
});
|
||||
|
||||
add_test(function test_share_off_direct() {
|
||||
default_proxy_settings();
|
||||
prefs.setBoolPref("network.proxy.share_proxy_settings", false);
|
||||
prefs.setCharPref("network.proxy.http", "");
|
||||
prefs.setCharPref("network.proxy.ssl", "");
|
||||
prefs.setCharPref("network.proxy.ftp", "");
|
||||
Services.prefs.setCharPref("network.proxy.autoconfig_url", pgen.generate());
|
||||
Services.prefs.setIntPref("network.proxy.type", PROXY_TYPE_PAC);
|
||||
test_resolve(TARGET_HOST, run_next_test);
|
||||
});
|
||||
|
||||
add_test(function test_browsing_proxy() {
|
||||
default_proxy_settings();
|
||||
prefs.setBoolPref("network.proxy.browsing.enabled", true);
|
||||
prefs.setCharPref("network.proxy.browsing.host", BROWSING_HOST);
|
||||
prefs.setIntPref("network.proxy.browsing.port", BROWSING_PORT);
|
||||
prefs.setCharPref("network.proxy.browsing.app_origins", APP_ORIGINS_LIST);
|
||||
Services.prefs.setCharPref("network.proxy.autoconfig_url", pgen.generate());
|
||||
Services.prefs.setIntPref("network.proxy.type", PROXY_TYPE_PAC);
|
||||
test_resolve(TARGET_HOST, run_next_test);
|
||||
});
|
||||
|
||||
function run_test(){
|
||||
do_register_cleanup(() => {
|
||||
prefs.clearUserPref("network.proxy.pac_generator");
|
||||
prefs.clearUserPref("network.proxy.type");
|
||||
prefs.clearUserPref("network.proxy.autoconfig_url");
|
||||
prefs.clearUserPref("network.proxy.share_proxy_settings");
|
||||
prefs.clearUserPref("network.proxy.http");
|
||||
prefs.clearUserPref("network.proxy.http_port");
|
||||
prefs.clearUserPref("network.proxy.ssl");
|
||||
prefs.clearUserPref("network.proxy.ssl_port");
|
||||
prefs.clearUserPref("network.proxy.ftp");
|
||||
prefs.clearUserPref("network.proxy.ftp_port");
|
||||
prefs.clearUserPref("network.proxy.browsing.enabled");
|
||||
prefs.clearUserPref("network.proxy.browsing.host");
|
||||
prefs.clearUserPref("network.proxy.browsing.port");
|
||||
prefs.clearUserPref("network.proxy.browsing.app_origins");
|
||||
});
|
||||
run_next_test();
|
||||
}
|
@ -1,9 +0,0 @@
|
||||
[DEFAULT]
|
||||
head = head_channels.js head_cache.js head_cache2.js
|
||||
tail =
|
||||
skip-if = buildapp != 'b2g'
|
||||
|
||||
# For bug 1148503. This is to accommodate non-mozilla-central that didn't
|
||||
# include required files for this test.
|
||||
[test_pac_generator.js]
|
||||
requesttimeoutfactor = 4
|
@ -289,9 +289,6 @@ user_pref("browser.translation.engine", "bing");
|
||||
// Make sure we don't try to load snippets from the network.
|
||||
user_pref("browser.aboutHomeSnippets.updateUrl", "nonexistent://test");
|
||||
|
||||
// Enable apps customizations
|
||||
user_pref("dom.apps.customization.enabled", true);
|
||||
|
||||
// Don't fetch or send directory tiles data from real servers
|
||||
user_pref("browser.newtabpage.directory.source", 'data:application/json,{"testing":1}');
|
||||
user_pref("browser.newtabpage.directory.ping", "");
|
||||
@ -330,10 +327,6 @@ user_pref("extensions.e10sBlocksEnabling", false);
|
||||
// Avoid performing Reader Mode intros during tests.
|
||||
user_pref("browser.reader.detectedFirstArticle", true);
|
||||
|
||||
// Don't let PAC generator to set PAC, as mochitest framework has its own PAC
|
||||
// rules during testing.
|
||||
user_pref("network.proxy.pac_generator", false);
|
||||
|
||||
// Make tests run consistently on DevEdition (which has a lightweight theme
|
||||
// selected by default).
|
||||
user_pref("lightweightThemes.selectedThemeID", "");
|
||||
|
@ -23,11 +23,7 @@ harness = false
|
||||
# Explicitly specify what our profiles use.
|
||||
[profile.dev]
|
||||
opt-level = 1
|
||||
# XXX: We're passing `-C debuginfo=1` to rustc to work around an llvm-dsymutil
|
||||
# crash (bug 1301751), but rustc can't handle -g with that option, so
|
||||
# turn off debug for now.
|
||||
# This should be temporary until we upgrade to Rust 1.12.
|
||||
debug = false
|
||||
debug = true
|
||||
rpath = false
|
||||
lto = false
|
||||
debug-assertions = true
|
||||
@ -36,7 +32,7 @@ panic = "abort"
|
||||
|
||||
[profile.release]
|
||||
opt-level = 2
|
||||
debug = false
|
||||
debug = true
|
||||
rpath = false
|
||||
# This would normally be 'true' for release configurations, but using LTO on
|
||||
# rul-gtest causes link failures due to symbols also being found in libxul's
|
||||
|
@ -21,11 +21,7 @@ harness = false
|
||||
# Explicitly specify what our profiles use.
|
||||
[profile.dev]
|
||||
opt-level = 1
|
||||
# XXX: We're passing `-C debuginfo=1` to rustc to work around an llvm-dsymutil
|
||||
# crash (bug 1301751), but rustc can't handle -g with that option, so
|
||||
# turn off debug for now.
|
||||
# This should be temporary until we upgrade to Rust 1.12.
|
||||
debug = false
|
||||
debug = true
|
||||
rpath = false
|
||||
lto = false
|
||||
debug-assertions = true
|
||||
@ -34,7 +30,7 @@ panic = "abort"
|
||||
|
||||
[profile.release]
|
||||
opt-level = 2
|
||||
debug = false
|
||||
debug = true
|
||||
rpath = false
|
||||
lto = true
|
||||
debug-assertions = false
|
||||
|
@ -1339,7 +1339,7 @@ nsWindow::GeckoViewSupport::Open(const jni::Class::LocalRef& aCls,
|
||||
}
|
||||
|
||||
nsCOMPtr<mozIDOMWindowProxy> domWindow;
|
||||
ww->OpenWindow(nullptr, url, nullptr, "chrome,dialog=0,resizable",
|
||||
ww->OpenWindow(nullptr, url, nullptr, "chrome,dialog=0,resizable,scrollbars=yes",
|
||||
nullptr, getter_AddRefs(domWindow));
|
||||
MOZ_RELEASE_ASSERT(domWindow);
|
||||
|
||||
|
@ -204,9 +204,11 @@ HasVibrantForeground(VibrancyType aType)
|
||||
}
|
||||
}
|
||||
|
||||
#if !defined(MAC_OS_X_VERSION_10_12) || MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_12
|
||||
enum {
|
||||
NSVisualEffectMaterialMenuItem = 4
|
||||
NSVisualEffectMaterialSelection = 4
|
||||
};
|
||||
#endif
|
||||
|
||||
@interface NSView(NSVisualEffectViewMethods)
|
||||
- (void)setState:(NSUInteger)state;
|
||||
@ -239,7 +241,7 @@ VibrancyManager::CreateEffectView(VibrancyType aType)
|
||||
} else if (aType == VibrancyType::HIGHLIGHTED_MENUITEM ||
|
||||
aType == VibrancyType::SOURCE_LIST_SELECTION ||
|
||||
aType == VibrancyType::ACTIVE_SOURCE_LIST_SELECTION) {
|
||||
[effectView setMaterial:NSVisualEffectMaterialMenuItem];
|
||||
[effectView setMaterial:NSVisualEffectMaterialSelection];
|
||||
if ([effectView respondsToSelector:@selector(setEmphasized:)] &&
|
||||
aType != VibrancyType::SOURCE_LIST_SELECTION) {
|
||||
[effectView setEmphasized:YES];
|
||||
|
Loading…
Reference in New Issue
Block a user