merge mozilla-inbound to mozilla-central a=merge

This commit is contained in:
Carsten "Tomcat" Book 2016-03-03 11:54:40 +01:00
commit 33f738a63e
418 changed files with 6307 additions and 3835 deletions

View File

@ -14,9 +14,8 @@ using namespace mozilla::a11y;
////////////////////////////////////////////////////////////////////////////////
DocAccessibleWrap::
DocAccessibleWrap(nsIDocument* aDocument, nsIContent* aRootContent,
nsIPresShell* aPresShell) :
DocAccessible(aDocument, aRootContent, aPresShell), mActivated(false)
DocAccessibleWrap(nsIDocument* aDocument, nsIPresShell* aPresShell) :
DocAccessible(aDocument, aPresShell), mActivated(false)
{
}

View File

@ -19,8 +19,7 @@ namespace a11y {
class DocAccessibleWrap : public DocAccessible
{
public:
DocAccessibleWrap(nsIDocument* aDocument, nsIContent* aRootContent,
nsIPresShell* aPresShell);
DocAccessibleWrap(nsIDocument* aDocument, nsIPresShell* aPresShell);
virtual ~DocAccessibleWrap();
bool mActivated;

View File

@ -470,17 +470,15 @@ DocManager::CreateDocOrRootAccessible(nsIDocument* aDocument)
// We only create root accessibles for the true root, otherwise create a
// doc accessible.
nsIContent *rootElm = nsCoreUtils::GetRoleContent(aDocument);
RefPtr<DocAccessible> docAcc = isRootDoc ?
new RootAccessibleWrap(aDocument, rootElm, presShell) :
new DocAccessibleWrap(aDocument, rootElm, presShell);
new RootAccessibleWrap(aDocument, presShell) :
new DocAccessibleWrap(aDocument, presShell);
// Cache the document accessible into document cache.
mDocAccessibleCache.Put(aDocument, docAcc);
// Initialize the document accessible.
docAcc->Init();
docAcc->SetRoleMapEntry(aria::GetRoleMap(aDocument));
// Bind the document to the tree.
if (isRootDoc) {

View File

@ -76,9 +76,8 @@ static const uint32_t kRelationAttrsLen = ArrayLength(kRelationAttrs);
// Constructor/desctructor
DocAccessible::
DocAccessible(nsIDocument* aDocument, nsIContent* aRootContent,
nsIPresShell* aPresShell) :
HyperTextAccessibleWrap(aRootContent, this),
DocAccessible(nsIDocument* aDocument, nsIPresShell* aPresShell) :
HyperTextAccessibleWrap(nullptr, this),
// XXX aaronl should we use an algorithm for the initial cache size?
mAccessibleCache(kDefaultCacheLength),
mNodeToAccessibleMap(kDefaultCacheLength),
@ -1465,7 +1464,7 @@ DocAccessible::DoInitialUpdate()
// miss the notification (since content tree change notifications are ignored
// prior to initial update). Make sure the content element is valid.
nsIContent* contentElm = nsCoreUtils::GetRoleContent(mDocumentNode);
if (mContent != contentElm) {
if (contentElm) {
mContent = contentElm;
SetRoleMapEntry(aria::GetRoleMap(mContent));
}

View File

@ -50,8 +50,7 @@ class DocAccessible : public HyperTextAccessibleWrap,
public:
DocAccessible(nsIDocument* aDocument, nsIContent* aRootContent,
nsIPresShell* aPresShell);
DocAccessible(nsIDocument* aDocument, nsIPresShell* aPresShell);
// nsIScrollPositionListener
virtual void ScrollPositionWillChange(nscoord aX, nscoord aY) override {}

View File

@ -59,9 +59,8 @@ NS_IMPL_ISUPPORTS_INHERITED0(RootAccessible, DocAccessible)
// Constructor/destructor
RootAccessible::
RootAccessible(nsIDocument* aDocument, nsIContent* aRootContent,
nsIPresShell* aPresShell) :
DocAccessibleWrap(aDocument, aRootContent, aPresShell)
RootAccessible(nsIDocument* aDocument, nsIPresShell* aPresShell) :
DocAccessibleWrap(aDocument, aPresShell)
{
mType = eRootType;
}

View File

@ -22,8 +22,7 @@ class RootAccessible : public DocAccessibleWrap,
NS_DECL_ISUPPORTS_INHERITED
public:
RootAccessible(nsIDocument* aDocument, nsIContent* aRootContent,
nsIPresShell* aPresShell);
RootAccessible(nsIDocument* aDocument, nsIPresShell* aPresShell);
// nsIDOMEventListener
NS_IMETHOD HandleEvent(nsIDOMEvent* aEvent) override;

View File

@ -344,7 +344,7 @@ this.AccessFu = { // jshint ignore:line
{
// Ignore notifications that aren't from a BrowserOrApp
let frameLoader = aSubject.QueryInterface(Ci.nsIFrameLoader);
if (!frameLoader.ownerIsBrowserOrAppFrame) {
if (!frameLoader.ownerIsMozBrowserOrAppFrame) {
return;
}
this._handleMessageManager(frameLoader.messageManager);

View File

@ -14,8 +14,7 @@ namespace a11y {
class DocAccessibleWrap : public DocAccessible
{
public:
DocAccessibleWrap(nsIDocument* aDocument, nsIContent* aRootContent,
nsIPresShell* aPresShell);
DocAccessibleWrap(nsIDocument* aDocument, nsIPresShell* aPresShell);
virtual ~DocAccessibleWrap();
};

View File

@ -10,9 +10,8 @@
using namespace mozilla::a11y;
DocAccessibleWrap::
DocAccessibleWrap(nsIDocument* aDocument, nsIContent* aRootContent,
nsIPresShell* aPresShell) :
DocAccessible(aDocument, aRootContent, aPresShell)
DocAccessibleWrap(nsIDocument* aDocument, nsIPresShell* aPresShell) :
DocAccessible(aDocument, aPresShell)
{
}

View File

@ -18,8 +18,7 @@ namespace a11y {
class RootAccessibleWrap : public RootAccessible
{
public:
RootAccessibleWrap(nsIDocument* aDocument, nsIContent* aRootContent,
nsIPresShell* aPresShell);
RootAccessibleWrap(nsIDocument* aDocument, nsIPresShell* aPresShell);
virtual ~RootAccessibleWrap();
Class GetNativeType ();

View File

@ -16,9 +16,8 @@
using namespace mozilla::a11y;
RootAccessibleWrap::
RootAccessibleWrap(nsIDocument* aDocument, nsIContent* aRootContent,
nsIPresShell* aPresShell) :
RootAccessible(aDocument, aRootContent, aPresShell)
RootAccessibleWrap(nsIDocument* aDocument, nsIPresShell* aPresShell) :
RootAccessible(aDocument, aPresShell)
{
}

View File

@ -20,8 +20,6 @@
src="../value.js"></script>
<script type="application/javascript">
/**
* Do tests.
*/
@ -132,6 +130,29 @@
}
}
function changeSelectValue(aID, aKey, aValue)
{
this.eventSeq = [new invokerChecker(EVENT_TEXT_VALUE_CHANGE, aID)];
this.invoke = function changeSelectValue_invoke()
{
getNode(aID).focus();
synthesizeKey(aKey, {}, window);
}
this.finalCheck = function changeSelectValue_finalCheck()
{
is(getAccessible(aID).value, aValue, "Wrong value for " + prettyName(aID));
}
this.getID = function changeSelectValue_getID()
{
return `${prettyName(aID)} closed select value change on '${aKey}'' key press`;
}
}
//enableLogging("DOMEvents");
//gA11yEventDumpToConsole = true;
function doTests()
{
// Test initial values
@ -155,6 +176,9 @@
gQueue.push(new changeProgressValue("progress", "50"));
gQueue.push(new changeRangeValue("range"));
gQueue.push(new changeSelectValue("select", "VK_DOWN", "2nd"));
gQueue.push(new changeSelectValue("select", "3", "3rd"));
gQueue.invoke(); // Will call SimpleTest.finish();
}
@ -221,5 +245,10 @@
<!-- input@type="range" -->
<input type="range" id="range" min="0" max="10" value="6">
<select id="select">
<option>1st</option>
<option>2nd</option>
<option>3rd</option>
</select>
</body>
</html>

View File

@ -25,9 +25,8 @@ using namespace mozilla::a11y;
////////////////////////////////////////////////////////////////////////////////
DocAccessibleWrap::
DocAccessibleWrap(nsIDocument* aDocument, nsIContent* aRootContent,
nsIPresShell* aPresShell) :
DocAccessible(aDocument, aRootContent, aPresShell), mHWND(nullptr)
DocAccessibleWrap(nsIDocument* aDocument, nsIPresShell* aPresShell) :
DocAccessible(aDocument, aPresShell), mHWND(nullptr)
{
}

View File

@ -15,8 +15,7 @@ namespace a11y {
class DocAccessibleWrap : public DocAccessible
{
public:
DocAccessibleWrap(nsIDocument* aDocument, nsIContent* aRootContent,
nsIPresShell* aPresShell);
DocAccessibleWrap(nsIDocument* aDocument, nsIPresShell* aPresShell);
virtual ~DocAccessibleWrap();
DECL_IUNKNOWN_INHERITED

View File

@ -15,9 +15,8 @@ using namespace mozilla::a11y;
// Constructor/desctructor
RootAccessibleWrap::
RootAccessibleWrap(nsIDocument* aDocument, nsIContent* aRootContent,
nsIPresShell* aPresShell) :
RootAccessible(aDocument, aRootContent, aPresShell)
RootAccessibleWrap(nsIDocument* aDocument, nsIPresShell* aPresShell) :
RootAccessible(aDocument, aPresShell)
{
}

View File

@ -14,8 +14,7 @@ namespace a11y {
class RootAccessibleWrap : public RootAccessible
{
public:
RootAccessibleWrap(nsIDocument* aDocument, nsIContent* aRootContent,
nsIPresShell* aPresShell);
RootAccessibleWrap(nsIDocument* aDocument, nsIPresShell* aPresShell);
virtual ~RootAccessibleWrap();
// RootAccessible

View File

@ -67,8 +67,9 @@ var internal = ns();
// menu
var lastContextProcessId = null;
var uuidModule = require('./util/uuid');
function uuid() {
return require('./util/uuid').uuid().toString();
return uuidModule.uuid().toString();
}
function getScheme(spec) {

View File

@ -57,7 +57,7 @@ AppRunner.prototype = {
// get a ref to the app <iframe>
frameLoader.QueryInterface(Ci.nsIFrameLoader);
// Ignore notifications that aren't from a BrowserOrApp
if (!frameLoader.ownerIsBrowserOrAppFrame) {
if (!frameLoader.ownerIsMozBrowserOrAppFrame) {
return;
}

View File

@ -144,7 +144,7 @@ this.AboutServiceWorkers = {
!message.principal.origin ||
!message.principal.originAttributes ||
!message.principal.originAttributes.appId ||
(message.principal.originAttributes.inBrowser == null)) {
(message.principal.originAttributes.inIsolatedMozBrowser == null)) {
self.sendError(message.id, "MissingPrincipal");
return;
}

View File

@ -177,7 +177,7 @@ var ErrorPage = {
observe: function errorPageObserve(aSubject, aTopic, aData) {
let frameLoader = aSubject.QueryInterface(Ci.nsIFrameLoader);
// Ignore notifications that aren't from a BrowserOrApp
if (!frameLoader.ownerIsBrowserOrAppFrame) {
if (!frameLoader.ownerIsMozBrowserOrAppFrame) {
return;
}
this._listenError(frameLoader);

View File

@ -1377,6 +1377,9 @@ pref("browser.newtabpage.directory.ping", "https://tiles.services.mozilla.com/v3
// activates the remote-hosted newtab page
pref("browser.newtabpage.remote", false);
// Toggles endpoints allowed for remote newtab communications
pref("browser.newtabpage.remote.mode", "production");
// Enable the DOM fullscreen API.
pref("full-screen-api.enabled", true);
@ -1655,3 +1658,6 @@ pref("media.webspeech.synth.enabled", true);
pref("browser.esedbreader.loglevel", "Error");
pref("browser.laterrun.enabled", false);
// Enable browser frames for use on desktop. Only exposed to chrome callers.
pref("dom.mozBrowserFramesEnabled", true);

View File

@ -18,6 +18,7 @@ XPCOMUtils.defineLazyGetter(this, "EventEmitter", function() {
// Supported prefs and data type
const gPrefsMap = new Map([
["browser.newtabpage.remote", "bool"],
["browser.newtabpage.remote.mode", "str"],
["browser.newtabpage.enabled", "bool"],
["browser.newtabpage.enhanced", "bool"],
["browser.newtabpage.pinned", "str"],

View File

@ -0,0 +1,13 @@
/* exported MODE_CHANNEL_MAP */
"use strict";
this.EXPORTED_SYMBOLS = ["MODE_CHANNEL_MAP"];
const MODE_CHANNEL_MAP = {
"production": {origin: "https://content.cdn.mozilla.net"},
"staging": {origin: "https://content-cdn.stage.mozaws.net"},
"test": {origin: "https://example.com"},
"test2": {origin: "http://mochi.test:8888"},
"dev": {origin: "http://localhost:8888"}
};

View File

@ -5,7 +5,7 @@
*/
/* globals XPCOMUtils, NewTabPrefsProvider, Services,
Locale, UpdateUtils
Locale, UpdateUtils, MODE_CHANNEL_MAP
*/
"use strict";
@ -20,11 +20,12 @@ XPCOMUtils.defineLazyModuleGetter(this, "NewTabPrefsProvider",
"resource:///modules/NewTabPrefsProvider.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Locale",
"resource://gre/modules/Locale.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "MODE_CHANNEL_MAP",
"resource:///modules/NewTabRemoteResources.jsm");
const LOCAL_NEWTAB_URL = "chrome://browser/content/newtab/newTab.xhtml";
const REMOTE_NEWTAB_URL = "https://newtab.cdn.mozilla.net/" +
"v%VERSION%/%CHANNEL%/%LOCALE%/index.html";
const REMOTE_NEWTAB_PATH = "/v%VERSION%/%CHANNEL%/%LOCALE%/index.html";
const ABOUT_URL = "about:newtab";
@ -37,6 +38,9 @@ const PREF_MATCH_OS_LOCALE = "intl.locale.matchOS";
// The preference that tells what locale the user selected
const PREF_SELECTED_LOCALE = "general.useragent.locale";
// The preference that tells what remote mode is enabled.
const PREF_REMOTE_MODE = "browser.newtabpage.remote.mode";
const VALID_CHANNELS = new Set(["esr", "release", "beta", "aurora", "nightly"]);
const REMOTE_NEWTAB_VERSION = "0";
@ -44,6 +48,8 @@ const REMOTE_NEWTAB_VERSION = "0";
function AboutNewTabService() {
NewTabPrefsProvider.prefs.on(PREF_REMOTE_ENABLED, this._handleToggleEvent.bind(this));
this._updateRemoteMaybe = this._updateRemoteMaybe.bind(this);
// trigger remote change if needed, according to pref
this.toggleRemote(Services.prefs.getBoolPref(PREF_REMOTE_ENABLED));
}
@ -124,14 +130,18 @@ AboutNewTabService.prototype = {
this._remoteURL = this.generateRemoteURL();
NewTabPrefsProvider.prefs.on(
PREF_SELECTED_LOCALE,
this._updateRemoteMaybe.bind(this));
this._updateRemoteMaybe);
NewTabPrefsProvider.prefs.on(
PREF_MATCH_OS_LOCALE,
this._updateRemoteMaybe.bind(this));
this._updateRemoteMaybe);
NewTabPrefsProvider.prefs.on(
PREF_REMOTE_MODE,
this._updateRemoteMaybe);
this._remoteEnabled = true;
} else {
NewTabPrefsProvider.prefs.off(PREF_SELECTED_LOCALE, this._updateRemoteMaybe);
NewTabPrefsProvider.prefs.off(PREF_MATCH_OS_LOCALE, this._updateRemoteMaybe);
NewTabPrefsProvider.prefs.off(PREF_REMOTE_MODE, this._updateRemoteMaybe);
this._remoteEnabled = false;
}
this._newTabURL = ABOUT_URL;
@ -139,15 +149,19 @@ AboutNewTabService.prototype = {
},
/*
* Generate a default url based on locale and update channel
* Generate a default url based on remote mode, version, locale and update channel
*/
generateRemoteURL() {
let releaseName = this.releaseFromUpdateChannel(UpdateUtils.UpdateChannel);
let url = REMOTE_NEWTAB_URL
let path = REMOTE_NEWTAB_PATH
.replace("%VERSION%", REMOTE_NEWTAB_VERSION)
.replace("%LOCALE%", Locale.getLocale())
.replace("%CHANNEL%", releaseName);
return url;
let mode = Services.prefs.getCharPref(PREF_REMOTE_MODE, "production");
if (!(mode in MODE_CHANNEL_MAP)) {
mode = "production";
}
return MODE_CHANNEL_MAP[mode].origin + path;
},
/*

View File

@ -12,6 +12,7 @@ XPCSHELL_TESTS_MANIFESTS += [
EXTRA_JS_MODULES += [
'NewTabPrefsProvider.jsm',
'NewTabRemoteResources.jsm',
'NewTabURL.jsm',
'PlacesProvider.jsm'
]

View File

@ -105,13 +105,16 @@ add_task(function* test_updates() {
Preferences.set("browser.newtabpage.remote", true);
aboutNewTabService.resetNewTabURL(); // need to set manually because pref notifs are off
let notificationPromise;
let expectedHref = "https://newtab.cdn.mozilla.net" +
`/v${aboutNewTabService.remoteVersion}` +
let productionModeBaseUrl = "https://content.cdn.mozilla.net";
let testModeBaseUrl = "https://example.com";
let expectedPath = `/v${aboutNewTabService.remoteVersion}` +
`/${aboutNewTabService.remoteReleaseName}` +
"/en-GB" +
"/index.html";
let expectedHref = productionModeBaseUrl + expectedPath;
Preferences.set("intl.locale.matchOS", true);
Preferences.set("general.useragent.locale", "en-GB");
Preferences.set("browser.newtabpage.remote.mode", "production");
NewTabPrefsProvider.prefs.init();
// test update checks for prefs
@ -123,7 +126,19 @@ add_task(function* test_updates() {
notificationPromise = nextChangeNotificationPromise(
DEFAULT_HREF, "Remote href changes back to default");
Preferences.set("general.useragent.locale", "en-US");
yield notificationPromise;
// test update fires when mode is changed
expectedPath = expectedPath.replace("/en-GB/", "/en-US/");
notificationPromise = nextChangeNotificationPromise(
testModeBaseUrl + expectedPath, "Remote href changes back to origin of test mode");
Preferences.set("browser.newtabpage.remote.mode", "test");
yield notificationPromise;
// test invalid mode ends up pointing to production url
notificationPromise = nextChangeNotificationPromise(
DEFAULT_HREF, "Remote href changes back to production default");
Preferences.set("browser.newtabpage.remote.mode", "invalid");
yield notificationPromise;
// test update fires on override and reset

View File

@ -145,6 +145,10 @@ var SessionHistoryInternal = {
entry.originalURI = shEntry.originalURI.spec;
}
if (shEntry.loadReplace) {
entry.loadReplace = shEntry.loadReplace;
}
if (shEntry.srcdocData)
entry.srcdocData = shEntry.srcdocData;
@ -316,6 +320,9 @@ var SessionHistoryInternal = {
if (entry.originalURI) {
shEntry.originalURI = Utils.makeURI(entry.originalURI);
}
if (entry.loadReplace) {
shEntry.loadReplace = entry.loadReplace;
}
if (entry.isSrcdocEntry)
shEntry.srcdocData = entry.srcdocData;
if (entry.baseURI)

View File

@ -36,7 +36,7 @@ PrincipalOriginAttributes::InheritFromDocShellToDoc(const DocShellOriginAttribut
const nsIURI* aURI)
{
mAppId = aAttrs.mAppId;
mInBrowser = aAttrs.mInBrowser;
mInIsolatedMozBrowser = aAttrs.mInIsolatedMozBrowser;
// addonId is computed from the principal URI and never propagated
mUserContextId = aAttrs.mUserContextId;
@ -51,7 +51,7 @@ void
PrincipalOriginAttributes::InheritFromNecko(const NeckoOriginAttributes& aAttrs)
{
mAppId = aAttrs.mAppId;
mInBrowser = aAttrs.mInBrowser;
mInIsolatedMozBrowser = aAttrs.mInIsolatedMozBrowser;
// addonId is computed from the principal URI and never propagated
mUserContextId = aAttrs.mUserContextId;
@ -62,7 +62,7 @@ void
DocShellOriginAttributes::InheritFromDocToChildDocShell(const PrincipalOriginAttributes& aAttrs)
{
mAppId = aAttrs.mAppId;
mInBrowser = aAttrs.mInBrowser;
mInIsolatedMozBrowser = aAttrs.mInIsolatedMozBrowser;
// addonId is computed from the principal URI and never propagated
mUserContextId = aAttrs.mUserContextId;
@ -77,7 +77,7 @@ void
NeckoOriginAttributes::InheritFromDocToNecko(const PrincipalOriginAttributes& aAttrs)
{
mAppId = aAttrs.mAppId;
mInBrowser = aAttrs.mInBrowser;
mInIsolatedMozBrowser = aAttrs.mInIsolatedMozBrowser;
// addonId is computed from the principal URI and never propagated
mUserContextId = aAttrs.mUserContextId;
@ -91,7 +91,7 @@ void
NeckoOriginAttributes::InheritFromDocShellToNecko(const DocShellOriginAttributes& aAttrs)
{
mAppId = aAttrs.mAppId;
mInBrowser = aAttrs.mInBrowser;
mInIsolatedMozBrowser = aAttrs.mInIsolatedMozBrowser;
// addonId is computed from the principal URI and never propagated
mUserContextId = aAttrs.mUserContextId;
@ -119,7 +119,7 @@ OriginAttributes::CreateSuffix(nsACString& aStr) const
params->Set(NS_LITERAL_STRING("appId"), value);
}
if (mInBrowser) {
if (mInIsolatedMozBrowser) {
params->Set(NS_LITERAL_STRING("inBrowser"), NS_LITERAL_STRING("1"));
}
@ -191,7 +191,7 @@ public:
return false;
}
mOriginAttributes->mInBrowser = true;
mOriginAttributes->mInIsolatedMozBrowser = true;
return true;
}
@ -469,7 +469,7 @@ BasePrincipal::GetIsSystemPrincipal(bool* aResult)
NS_IMETHODIMP
BasePrincipal::GetJarPrefix(nsACString& aJarPrefix)
{
mozilla::GetJarPrefix(mOriginAttributes.mAppId, mOriginAttributes.mInBrowser, aJarPrefix);
mozilla::GetJarPrefix(mOriginAttributes.mAppId, mOriginAttributes.mInIsolatedMozBrowser, aJarPrefix);
return NS_OK;
}
@ -523,9 +523,9 @@ BasePrincipal::GetUserContextId(uint32_t* aUserContextId)
}
NS_IMETHODIMP
BasePrincipal::GetIsInBrowserElement(bool* aIsInBrowserElement)
BasePrincipal::GetIsInIsolatedMozBrowserElement(bool* aIsInIsolatedMozBrowserElement)
{
*aIsInBrowserElement = IsInBrowserElement();
*aIsInIsolatedMozBrowserElement = IsInIsolatedMozBrowserElement();
return NS_OK;
}

View File

@ -30,7 +30,7 @@ public:
bool operator==(const OriginAttributes& aOther) const
{
return mAppId == aOther.mAppId &&
mInBrowser == aOther.mInBrowser &&
mInIsolatedMozBrowser == aOther.mInIsolatedMozBrowser &&
mAddonId == aOther.mAddonId &&
mUserContextId == aOther.mUserContextId &&
mSignedPkg == aOther.mSignedPkg;
@ -75,10 +75,10 @@ class PrincipalOriginAttributes : public OriginAttributes
{
public:
PrincipalOriginAttributes() {}
PrincipalOriginAttributes(uint32_t aAppId, bool aInBrowser)
PrincipalOriginAttributes(uint32_t aAppId, bool aInIsolatedMozBrowser)
{
mAppId = aAppId;
mInBrowser = aInBrowser;
mInIsolatedMozBrowser = aInIsolatedMozBrowser;
}
// Inheriting OriginAttributes from docshell to document when user navigates.
@ -97,10 +97,10 @@ class DocShellOriginAttributes : public OriginAttributes
{
public:
DocShellOriginAttributes() {}
DocShellOriginAttributes(uint32_t aAppId, bool aInBrowser)
DocShellOriginAttributes(uint32_t aAppId, bool aInIsolatedMozBrowser)
{
mAppId = aAppId;
mInBrowser = aInBrowser;
mInIsolatedMozBrowser = aInIsolatedMozBrowser;
}
// Inheriting OriginAttributes from document to child docshell when an
@ -116,10 +116,10 @@ class NeckoOriginAttributes : public OriginAttributes
{
public:
NeckoOriginAttributes() {}
NeckoOriginAttributes(uint32_t aAppId, bool aInBrowser)
NeckoOriginAttributes(uint32_t aAppId, bool aInIsolatedMozBrowser)
{
mAppId = aAppId;
mInBrowser = aInBrowser;
mInIsolatedMozBrowser = aInIsolatedMozBrowser;
}
// Inheriting OriginAttributes from document to necko when a network request
@ -159,7 +159,7 @@ public:
return false;
}
if (mInBrowser.WasPassed() && mInBrowser.Value() != aAttrs.mInBrowser) {
if (mInIsolatedMozBrowser.WasPassed() && mInIsolatedMozBrowser.Value() != aAttrs.mInIsolatedMozBrowser) {
return false;
}
@ -215,7 +215,7 @@ public:
NS_IMETHOD GetOriginSuffix(nsACString& aOriginSuffix) final;
NS_IMETHOD GetAppStatus(uint16_t* aAppStatus) final;
NS_IMETHOD GetAppId(uint32_t* aAppStatus) final;
NS_IMETHOD GetIsInBrowserElement(bool* aIsInBrowserElement) final;
NS_IMETHOD GetIsInIsolatedMozBrowserElement(bool* aIsInIsolatedMozBrowserElement) final;
NS_IMETHOD GetUnknownAppId(bool* aUnknownAppId) final;
NS_IMETHOD GetUserContextId(uint32_t* aUserContextId) final;
@ -231,7 +231,7 @@ public:
const PrincipalOriginAttributes& OriginAttributesRef() { return mOriginAttributes; }
uint32_t AppId() const { return mOriginAttributes.mAppId; }
uint32_t UserContextId() const { return mOriginAttributes.mUserContextId; }
bool IsInBrowserElement() const { return mOriginAttributes.mInBrowser; }
bool IsInIsolatedMozBrowserElement() const { return mOriginAttributes.mInIsolatedMozBrowser; }
enum PrincipalKind {
eNullPrincipal,

View File

@ -303,10 +303,13 @@ interface nsIPrincipal : nsISerializable
[infallible] readonly attribute unsigned long userContextId;
/**
* Returns true iff the principal is inside a browser element. (<iframe
* mozbrowser mozapp> does not count as a browser element.)
* Returns true iff the principal is inside 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.
*/
[infallible] readonly attribute boolean isInBrowserElement;
[infallible] readonly attribute boolean isInIsolatedMozBrowserElement;
/**
* Returns true if this principal has an unknown appId. This shouldn't

View File

@ -260,13 +260,25 @@ uint16_t
nsScriptSecurityManager::AppStatusForPrincipal(nsIPrincipal *aPrin)
{
uint32_t appId = aPrin->GetAppId();
bool inMozBrowser = aPrin->GetIsInBrowserElement();
// After bug 1238160, the principal no longer knows how to answer "is this a
// browser element", which is really what this code path wants. Currently,
// desktop is the only platform where we intend to disable isolation on a
// browser frame, so non-desktop should be able to assume that
// inIsolatedMozBrowser is true for all mozbrowser frames. Additionally,
// apps are no longer used on desktop, so appId is always NO_APP_ID. We use
// a release assertion in nsFrameLoader::OwnerIsIsolatedMozBrowserFrame so
// that platforms with apps can assume inIsolatedMozBrowser is true for all
// mozbrowser frames.
bool inIsolatedMozBrowser = aPrin->GetIsInIsolatedMozBrowserElement();
NS_WARN_IF_FALSE(appId != nsIScriptSecurityManager::UNKNOWN_APP_ID,
"Asking for app status on a principal with an unknown app id");
// Installed apps have a valid app id (not NO_APP_ID or UNKNOWN_APP_ID)
// and they are not inside a mozbrowser.
if (appId == nsIScriptSecurityManager::NO_APP_ID ||
appId == nsIScriptSecurityManager::UNKNOWN_APP_ID || inMozBrowser)
appId == nsIScriptSecurityManager::UNKNOWN_APP_ID ||
inIsolatedMozBrowser)
{
return nsIPrincipal::APP_STATUS_NOT_INSTALLED;
}
@ -291,7 +303,7 @@ nsScriptSecurityManager::AppStatusForPrincipal(nsIPrincipal *aPrin)
// The app could contain a cross-origin iframe - make sure that the content
// is actually same-origin with the app.
MOZ_ASSERT(inMozBrowser == false, "Checked this above");
MOZ_ASSERT(inIsolatedMozBrowser == false, "Checked this above");
PrincipalOriginAttributes attrs(appId, false);
nsCOMPtr<nsIPrincipal> appPrin = BasePrincipal::CreateCodebasePrincipal(appURI, attrs);
NS_ENSURE_TRUE(appPrin, nsIPrincipal::APP_STATUS_NOT_INSTALLED);
@ -590,7 +602,7 @@ static nsresult
DenyAccessIfURIHasFlags(nsIURI* aURI, uint32_t aURIFlags)
{
NS_PRECONDITION(aURI, "Must have URI!");
bool uriHasFlags;
nsresult rv =
NS_URIChainHasFlags(aURI, aURIFlags, &uriHasFlags);
@ -724,7 +736,7 @@ nsScriptSecurityManager::CheckLoadURIWithPrincipal(nsIPrincipal* aPrincipal,
"must have a URI!");
return NS_ERROR_UNEXPECTED;
}
// Automatic loads are not allowed from certain protocols.
if (aFlags & nsIScriptSecurityManager::LOAD_IS_AUTOMATIC_DOCUMENT_REPLACEMENT) {
nsresult rv =
@ -958,7 +970,7 @@ nsScriptSecurityManager::CheckLoadURIWithPrincipal(nsIPrincipal* aPrincipal,
console->LogStringMessage(message.get());
}
}
return NS_OK;
}
@ -1170,13 +1182,13 @@ nsScriptSecurityManager::CreateExpandedPrincipal(nsIPrincipal** aPrincipalArray,
NS_IMETHODIMP
nsScriptSecurityManager::GetAppCodebasePrincipal(nsIURI* aURI,
uint32_t aAppId,
bool aInMozBrowser,
bool aInIsolatedMozBrowser,
nsIPrincipal** aPrincipal)
{
NS_ENSURE_TRUE(aAppId != nsIScriptSecurityManager::UNKNOWN_APP_ID,
NS_ERROR_INVALID_ARG);
PrincipalOriginAttributes attrs(aAppId, aInMozBrowser);
PrincipalOriginAttributes attrs(aAppId, aInIsolatedMozBrowser);
nsCOMPtr<nsIPrincipal> prin = BasePrincipal::CreateCodebasePrincipal(aURI, attrs);
prin.forget(aPrincipal);
return *aPrincipal ? NS_OK : NS_ERROR_FAILURE;
@ -1566,7 +1578,7 @@ nsScriptSecurityManager::InitPrefs()
namespace mozilla {
void
GetJarPrefix(uint32_t aAppId, bool aInMozBrowser, nsACString& aJarPrefix)
GetJarPrefix(uint32_t aAppId, bool aInIsolatedMozBrowser, nsACString& aJarPrefix)
{
MOZ_ASSERT(aAppId != nsIScriptSecurityManager::UNKNOWN_APP_ID);
@ -1577,14 +1589,14 @@ GetJarPrefix(uint32_t aAppId, bool aInMozBrowser, nsACString& aJarPrefix)
aJarPrefix.Truncate();
// Fallback.
if (aAppId == nsIScriptSecurityManager::NO_APP_ID && !aInMozBrowser) {
if (aAppId == nsIScriptSecurityManager::NO_APP_ID && !aInIsolatedMozBrowser) {
return;
}
// aJarPrefix = appId + "+" + { 't', 'f' } + "+";
aJarPrefix.AppendInt(aAppId);
aJarPrefix.Append('+');
aJarPrefix.Append(aInMozBrowser ? 't' : 'f');
aJarPrefix.Append(aInIsolatedMozBrowser ? 't' : 'f');
aJarPrefix.Append('+');
return;
@ -1594,12 +1606,12 @@ GetJarPrefix(uint32_t aAppId, bool aInMozBrowser, nsACString& aJarPrefix)
NS_IMETHODIMP
nsScriptSecurityManager::GetJarPrefix(uint32_t aAppId,
bool aInMozBrowser,
bool aInIsolatedMozBrowser,
nsACString& aJarPrefix)
{
MOZ_ASSERT(aAppId != nsIScriptSecurityManager::UNKNOWN_APP_ID);
mozilla::GetJarPrefix(aAppId, aInMozBrowser, aJarPrefix);
mozilla::GetJarPrefix(aAppId, aInIsolatedMozBrowser, aJarPrefix);
return NS_OK;
}
@ -1694,4 +1706,3 @@ nsScriptSecurityManager::PolicyAllowsScript(nsIURI* aURI, bool *aRv)
return NS_OK;
}

View File

@ -151,7 +151,7 @@ namespace mozilla {
void
GetJarPrefix(uint32_t aAppid,
bool aInMozBrowser,
bool aInIsolatedMozBrowser,
nsACString& aJarPrefix);
} // namespace mozilla

View File

@ -24,13 +24,13 @@ TEST(PrincipalOriginAttributes, Suffix_default)
TestSuffix(attrs);
}
TEST(PrincipalOriginAttributes, Suffix_appId_inBrowser)
TEST(PrincipalOriginAttributes, Suffix_appId_inIsolatedMozBrowser)
{
PrincipalOriginAttributes attrs(1, true);
TestSuffix(attrs);
}
TEST(PrincipalOriginAttributes, Suffix_maxAppId_inBrowser)
TEST(PrincipalOriginAttributes, Suffix_maxAppId_inIsolatedMozBrowser)
{
PrincipalOriginAttributes attrs(4294967295, true);
TestSuffix(attrs);

View File

@ -33,6 +33,8 @@ SimpleTest.waitForExplicitFinish();
* valid, the iframe will not be considered as a mozapp.
* - browser: say if the iframe should be a mozbrowser. This is implicit when
* app is set.
* - isolated: if origin isolation is enabled with browser frames. Defaults to
* true if unset.
* - test: an array of tests to run for this test case:
* - eo-unique: the extendedOrigin of the prinicpal must be unique in the
* current list.
@ -230,7 +232,7 @@ var gData = [
},
test: [ "child-has-different-eo", "child-has-same-appstatus", "child-has-same-appid" ],
},
// browser containing an iframe is part of the browser
// browser containing an iframe that is part of the browser
{
src: "http://example.org/",
isapp: false,
@ -238,7 +240,50 @@ var gData = [
child: {
src: "http://example.org/chrome/",
isapp: false,
inBrowser: true,
inIsolatedMozBrowser: true,
},
test: [ "child-has-same-eo" ],
},
// iframe containing a browser with isolation disabled
// (only chrome documents can disable isolation)
{
src: "http://example.org/",
isapp: false,
browser: false,
child: {
src: "http://example.org/chrome/",
isapp: false,
browser: true,
isolated: false,
inIsolatedMozBrowser: true,
},
test: [ "child-has-different-eo" ],
},
// browser with isolation disabled containing an iframe that is part of the browser
{
src: "http://example.org/",
isapp: false,
browser: true,
isolated: false,
child: {
src: "http://example.org/chrome/",
isapp: false,
inIsolatedMozBrowser: false,
},
test: [ "child-has-same-eo" ],
},
// iframe with isolation enabled containing an iframe with isolation disabled
// (isolated only has an effect on browsers)
{
src: "http://example.org/",
isapp: false,
browser: false,
isolated: true,
child: {
src: "http://example.org/chrome/",
isapp: false,
browser: false,
isolated: false,
},
test: [ "child-has-same-eo" ],
},
@ -280,12 +325,15 @@ function checkIFrame(aFrame, data) {
"principals from non-installed app should have NO_APP_ID");
}
if (!data.isapp && !data.browser) {
if (!data.isapp && !data.browser ||
(data.browser && data.isolated === false)) {
is(principal.jarPrefix, "",
'jarPrefix should return an empty string for non-app and non-browsers principals');
"jarPrefix should return an empty string for non-app, non-browsers, " +
"and browsers with isolation disabled");
} else {
isnot(principal.jarPrefix, "",
'jarPrefix should not return an empty string for apps or mozbrowsers');
"jarPrefix should not return an empty string for apps or browsers " +
"with isolation enabled");
}
if (data.test.indexOf("eo-unique") != -1) {
@ -297,8 +345,12 @@ function checkIFrame(aFrame, data) {
"extended origin should be the same as the last inserted one");
}
is(principal.isInBrowserElement, !!data.browser,
"check principal.isInBrowserElement");
let isolationExpected = false;
if (data.isolated !== false) {
isolationExpected = !!data.browser;
}
is(principal.isInIsolatedMozBrowserElement, isolationExpected,
"check principal.isInIsolatedMozBrowserElement");
if (data.child) {
let childPrincipal = aFrame.contentWindow.frames[0].document.nodePrincipal;
@ -308,8 +360,15 @@ function checkIFrame(aFrame, data) {
"child should be an installed app");
}
is(childPrincipal.isInBrowserElement, !!data.child.browser || !!data.child.inBrowser,
"check childPrincipal.isInBrowserElement");
let childIsolationExpected = false;
if (data.child.isolated !== false) {
childIsolationExpected = !!data.child.browser;
}
if (data.child.inIsolatedMozBrowser !== undefined) {
childIsolationExpected = data.child.inIsolatedMozBrowser;
}
is(childPrincipal.isInIsolatedMozBrowserElement, childIsolationExpected,
"check childPrincipal.isInIsolatedMozBrowserElement");
if (data.test.indexOf("child-has-same-eo") != -1) {
is(childPrincipal.jarPrefix + childPrincipal.origin,
@ -392,6 +451,10 @@ function runTest() {
childFrame.setAttribute('mozbrowser', '');
}
if (data.child.isolated === false) {
childFrame.setAttribute("noisolation", "");
}
childFrame.src = data.child.src;
this.removeEventListener('load', this.addChild.bind(this));
@ -407,6 +470,10 @@ function runTest() {
iframe.setAttribute('mozbrowser', '');
}
if (data.isolated === false) {
iframe.setAttribute("noisolation", "");
}
iframe.src = data.src;
if (data.child) {
@ -423,8 +490,9 @@ function runTest() {
var gTestRunner = runTest();
SpecialPowers.pushPrefEnv({'set':[["dom.mozBrowserFramesEnabled", true]]},
function() { gTestRunner.next(); });
SpecialPowers.pushPrefEnv({"set": [
["dom.mozBrowserFramesEnabled", true],
]}, function() { gTestRunner.next(); });
</script>
</pre>

View File

@ -24,7 +24,7 @@ function checkCrossOrigin(a, b) {
function checkOriginAttributes(prin, attrs, suffix) {
attrs = attrs || {};
do_check_eq(prin.originAttributes.appId, attrs.appId || 0);
do_check_eq(prin.originAttributes.inBrowser, attrs.inBrowser || false);
do_check_eq(prin.originAttributes.inIsolatedMozBrowser, attrs.inIsolatedMozBrowser || false);
do_check_eq(prin.originSuffix, suffix || '');
do_check_eq(ChromeUtils.originAttributesToSuffix(attrs), suffix || '');
do_check_true(ChromeUtils.originAttributesMatchPattern(prin.originAttributes, attrs));
@ -40,7 +40,7 @@ function printAttrs(name, attrs) {
do_print(name + " {\n" +
"\tappId: " + attrs.appId + ",\n" +
"\tuserContextId: " + attrs.userContextId + ",\n" +
"\tinBrowser: " + attrs.inBrowser + ",\n" +
"\tinIsolatedMozBrowser: " + attrs.inIsolatedMozBrowser + ",\n" +
"\taddonId: '" + attrs.addonId + "',\n" +
"\tsignedPkg: '" + attrs.signedPkg + "'\n}");
}
@ -52,7 +52,7 @@ function checkValues(attrs, values) {
//printAttrs("values", values);
do_check_eq(attrs.appId, values.appId || 0);
do_check_eq(attrs.userContextId, values.userContextId || 0);
do_check_eq(attrs.inBrowser, values.inBrowser || false);
do_check_eq(attrs.inIsolatedMozBrowser, values.inIsolatedMozBrowser || false);
do_check_eq(attrs.addonId, values.addonId || '');
do_check_eq(attrs.signedPkg, values.signedPkg || '');
}
@ -99,22 +99,22 @@ function run_test() {
do_check_eq(exampleOrg_app.origin, 'http://example.org^appId=42');
// Just browser.
var exampleOrg_browser = ssm.createCodebasePrincipal(makeURI('http://example.org'), {inBrowser: true});
var nullPrin_browser = ssm.createNullPrincipal({inBrowser: true});
checkOriginAttributes(exampleOrg_browser, {inBrowser: true}, '^inBrowser=1');
checkOriginAttributes(nullPrin_browser, {inBrowser: true}, '^inBrowser=1');
var exampleOrg_browser = ssm.createCodebasePrincipal(makeURI('http://example.org'), {inIsolatedMozBrowser: true});
var nullPrin_browser = ssm.createNullPrincipal({inIsolatedMozBrowser: true});
checkOriginAttributes(exampleOrg_browser, {inIsolatedMozBrowser: true}, '^inBrowser=1');
checkOriginAttributes(nullPrin_browser, {inIsolatedMozBrowser: true}, '^inBrowser=1');
do_check_eq(exampleOrg_browser.origin, 'http://example.org^inBrowser=1');
// App and browser.
var exampleOrg_appBrowser = ssm.createCodebasePrincipal(makeURI('http://example.org'), {inBrowser: true, appId: 42});
var nullPrin_appBrowser = ssm.createNullPrincipal({inBrowser: true, appId: 42});
checkOriginAttributes(exampleOrg_appBrowser, {appId: 42, inBrowser: true}, '^appId=42&inBrowser=1');
checkOriginAttributes(nullPrin_appBrowser, {appId: 42, inBrowser: true}, '^appId=42&inBrowser=1');
var exampleOrg_appBrowser = ssm.createCodebasePrincipal(makeURI('http://example.org'), {inIsolatedMozBrowser: true, appId: 42});
var nullPrin_appBrowser = ssm.createNullPrincipal({inIsolatedMozBrowser: true, appId: 42});
checkOriginAttributes(exampleOrg_appBrowser, {appId: 42, inIsolatedMozBrowser: true}, '^appId=42&inBrowser=1');
checkOriginAttributes(nullPrin_appBrowser, {appId: 42, inIsolatedMozBrowser: true}, '^appId=42&inBrowser=1');
do_check_eq(exampleOrg_appBrowser.origin, 'http://example.org^appId=42&inBrowser=1');
// App and browser, different domain.
var exampleCom_appBrowser = ssm.createCodebasePrincipal(makeURI('https://www.example.com:123'), {appId: 42, inBrowser: true});
checkOriginAttributes(exampleCom_appBrowser, {appId: 42, inBrowser: true}, '^appId=42&inBrowser=1');
var exampleCom_appBrowser = ssm.createCodebasePrincipal(makeURI('https://www.example.com:123'), {appId: 42, inIsolatedMozBrowser: true});
checkOriginAttributes(exampleCom_appBrowser, {appId: 42, inIsolatedMozBrowser: true}, '^appId=42&inBrowser=1');
do_check_eq(exampleCom_appBrowser.origin, 'https://www.example.com:123^appId=42&inBrowser=1');
// Addon.
@ -161,8 +161,8 @@ function run_test() {
do_check_eq(exampleOrg_signedPkg.origin, 'http://example.org^signedPkg=whatever');
// signedPkg and browser
var exampleOrg_signedPkg_browser = ssm.createCodebasePrincipal(makeURI('http://example.org'), {signedPkg: 'whatever', inBrowser: true});
checkOriginAttributes(exampleOrg_signedPkg_browser, { signedPkg: 'whatever', inBrowser: true }, '^inBrowser=1&signedPkg=whatever');
var exampleOrg_signedPkg_browser = ssm.createCodebasePrincipal(makeURI('http://example.org'), {signedPkg: 'whatever', inIsolatedMozBrowser: true});
checkOriginAttributes(exampleOrg_signedPkg_browser, { signedPkg: 'whatever', inIsolatedMozBrowser: true }, '^inBrowser=1&signedPkg=whatever');
do_check_eq(exampleOrg_signedPkg_browser.origin, 'http://example.org^inBrowser=1&signedPkg=whatever');
// Just signedPkg (but different value from 'exampleOrg_signedPkg_app')
@ -212,10 +212,10 @@ function run_test() {
[ "^appId=5", {appId: 5} ],
[ "^userContextId=3", {userContextId: 3} ],
[ "^addonId=fooBar", {addonId: "fooBar"} ],
[ "^inBrowser=1", {inBrowser: true} ],
[ "^inBrowser=1", {inIsolatedMozBrowser: true} ],
[ "^signedPkg=bazQux", {signedPkg: "bazQux"} ],
[ "^appId=3&inBrowser=1&userContextId=6",
{appId: 3, userContextId: 6, inBrowser: true} ] ];
{appId: 3, userContextId: 6, inIsolatedMozBrowser: true} ] ];
// check that we can create an origin attributes from an origin properly
tests.forEach(function(t) {

View File

@ -114,6 +114,7 @@ skip-if = e10s # Bug 1091612
[browser_net_simple-request-details.js]
[browser_net_simple-request.js]
[browser_net_sort-01.js]
skip-if = (e10s && debug && os == 'mac') # Bug 1253037
[browser_net_sort-02.js]
[browser_net_sort-03.js]
[browser_net_statistics-01.js]

View File

@ -34,7 +34,7 @@ function getTopWindow(win) {
.getInterface(Ci.nsIWebNavigation)
.QueryInterface(Ci.nsIDocShell);
if (!docShell.isBrowserOrApp) {
if (!docShell.isMozBrowserOrApp) {
return win.top;
}
@ -94,7 +94,7 @@ function getParentWindow(win) {
.getInterface(Ci.nsIWebNavigation)
.QueryInterface(Ci.nsIDocShell);
if (!docShell.isBrowserOrApp) {
if (!docShell.isMozBrowserOrApp) {
return win.parent;
}

View File

@ -34,7 +34,7 @@ nsILoadContext::GetOriginAttributes(mozilla::DocShellOriginAttributes& aAttrs)
aAttrs = attrs;
return true;
}
namespace mozilla {
NS_IMPL_ISUPPORTS(LoadContext, nsILoadContext, nsIInterfaceRequestor)
@ -172,13 +172,13 @@ LoadContext::SetRemoteTabs(bool aUseRemoteTabs)
}
NS_IMETHODIMP
LoadContext::GetIsInBrowserElement(bool* aIsInBrowserElement)
LoadContext::GetIsInIsolatedMozBrowserElement(bool* aIsInIsolatedMozBrowserElement)
{
MOZ_ASSERT(mIsNotNull);
NS_ENSURE_ARG_POINTER(aIsInBrowserElement);
NS_ENSURE_ARG_POINTER(aIsInIsolatedMozBrowserElement);
*aIsInBrowserElement = mOriginAttributes.mInBrowser;
*aIsInIsolatedMozBrowserElement = mOriginAttributes.mInIsolatedMozBrowser;
return NS_OK;
}

View File

@ -39,8 +39,8 @@ public:
NS_DECL_NSILOADCONTEXT
NS_DECL_NSIINTERFACEREQUESTOR
// AppId/inBrowser arguments override those in SerializedLoadContext provided
// by child process.
// appId/inIsolatedMozBrowser arguments override those in SerializedLoadContext
// provided by child process.
LoadContext(const IPC::SerializedLoadContext& aToCopy,
dom::Element* aTopFrameElement,
DocShellOriginAttributes& aAttrs)
@ -56,8 +56,8 @@ public:
{
}
// AppId/inBrowser arguments override those in SerializedLoadContext provided
// by child process.
// appId/inIsolatedMozBrowser arguments override those in SerializedLoadContext
// provided by child process.
LoadContext(const IPC::SerializedLoadContext& aToCopy,
uint64_t aNestedFrameId,
DocShellOriginAttributes& aAttrs)

View File

@ -332,7 +332,7 @@ nsDSURIContentListener::CheckOneFrameOptionsPolicy(nsIHttpChannel* aHttpChannel,
curDocShellItem->GetParent(getter_AddRefs(parentDocShellItem))) &&
parentDocShellItem) {
nsCOMPtr<nsIDocShell> curDocShell = do_QueryInterface(curDocShellItem);
if (curDocShell && curDocShell->GetIsBrowserOrApp()) {
if (curDocShell && curDocShell->GetIsMozBrowserOrApp()) {
break;
}

View File

@ -780,6 +780,7 @@ nsDocShell::nsDocShell()
, mAllowKeywordFixup(false)
, mIsOffScreenBrowser(false)
, mIsActive(true)
, mDisableMetaRefreshWhenInactive(false)
, mIsPrerendered(false)
, mIsAppTab(false)
, mUseGlobalHistory(false)
@ -805,6 +806,7 @@ nsDocShell::nsDocShell()
, mDefaultLoadFlags(nsIRequest::LOAD_NORMAL)
, mBlankTiming(false)
, mFrameType(eFrameTypeRegular)
, mIsInIsolatedMozBrowser(false)
, mOwnOrContainingAppId(nsIScriptSecurityManager::UNKNOWN_APP_ID)
, mUserContextId(nsIScriptSecurityManager::DEFAULT_USER_CONTEXT_ID)
, mParentCharsetSource(0)
@ -884,8 +886,6 @@ nsDocShell::Init()
NS_ASSERTION(mLoadGroup, "Something went wrong!");
mContentListener = new nsDSURIContentListener(this);
NS_ENSURE_TRUE(mContentListener, NS_ERROR_OUT_OF_MEMORY);
rv = mContentListener->Init();
NS_ENSURE_SUCCESS(rv, rv);
@ -893,7 +893,6 @@ nsDocShell::Init()
// ref to us... use an InterfaceRequestorProxy to do this.
nsCOMPtr<nsIInterfaceRequestor> proxy =
new InterfaceRequestorProxy(static_cast<nsIInterfaceRequestor*>(this));
NS_ENSURE_TRUE(proxy, NS_ERROR_OUT_OF_MEMORY);
mLoadGroup->SetNotificationCallbacks(proxy);
rv = nsDocLoader::AddDocLoaderAsChildOfRoot(this);
@ -1650,7 +1649,6 @@ NS_IMETHODIMP
nsDocShell::CreateLoadInfo(nsIDocShellLoadInfo** aLoadInfo)
{
nsDocShellLoadInfo* loadInfo = new nsDocShellLoadInfo();
NS_ENSURE_TRUE(loadInfo, NS_ERROR_OUT_OF_MEMORY);
nsCOMPtr<nsIDocShellLoadInfo> localRef(loadInfo);
localRef.forget(aLoadInfo);
@ -2556,7 +2554,7 @@ nsDocShell::GetFullscreenAllowed(bool* aFullscreenAllowed)
NS_IMETHODIMP
nsDocShell::SetFullscreenAllowed(bool aFullscreenAllowed)
{
if (!nsIDocShell::GetIsBrowserOrApp()) {
if (!nsIDocShell::GetIsMozBrowserOrApp()) {
// Only allow setting of fullscreenAllowed on content/process boundaries.
// At non-boundaries the fullscreenAllowed attribute is calculated based on
// whether all enclosing frames have the "mozFullscreenAllowed" attribute
@ -2615,10 +2613,6 @@ nsDocShell::GetDocShellEnumerator(int32_t aItemType, int32_t aDirection,
docShellEnum = new nsDocShellBackwardsEnumerator;
}
if (!docShellEnum) {
return NS_ERROR_OUT_OF_MEMORY;
}
nsresult rv = docShellEnum->SetEnumDocShellType(aItemType);
if (NS_FAILED(rv)) {
return rv;
@ -3364,7 +3358,7 @@ nsDocShell::GetSameTypeParent(nsIDocShellTreeItem** aParent)
NS_ENSURE_ARG_POINTER(aParent);
*aParent = nullptr;
if (nsIDocShell::GetIsBrowserOrApp()) {
if (nsIDocShell::GetIsMozBrowserOrApp()) {
return NS_OK;
}
@ -3500,7 +3494,8 @@ nsDocShell::CanAccessItem(nsIDocShellTreeItem* aTargetItem,
return false;
}
if (targetDS->GetIsInBrowserElement() != accessingDS->GetIsInBrowserElement() ||
if (targetDS->GetIsInIsolatedMozBrowserElement() !=
accessingDS->GetIsInIsolatedMozBrowserElement() ||
targetDS->GetAppId() != accessingDS->GetAppId()) {
return false;
}
@ -4015,6 +4010,7 @@ nsDocShell::AddChild(nsIDocShellTreeItem* aChild)
aChild->SetTreeOwner(mTreeOwner);
childDocShell->SetUserContextId(mUserContextId);
childDocShell->SetIsInIsolatedMozBrowserElement(mIsInIsolatedMozBrowser);
nsCOMPtr<nsIDocShell> childAsDocShell(do_QueryInterface(aChild));
if (!childAsDocShell) {
@ -5635,6 +5631,10 @@ nsDocShell::Create()
gAddedPreferencesVarCache = true;
}
mDisableMetaRefreshWhenInactive =
Preferences::GetBool("browser.meta_refresh_when_inactive.disabled",
mDisableMetaRefreshWhenInactive);
mDeviceSizeIsPageSize =
Preferences::GetBool("docshell.device_size_is_page_size",
mDeviceSizeIsPageSize);
@ -5820,10 +5820,14 @@ nsDocShell::SetPosition(int32_t aX, int32_t aY)
NS_IMETHODIMP
nsDocShell::SetPositionDesktopPix(int32_t aX, int32_t aY)
{
// Added to nsIBaseWindow in bug 1247335;
// implement if a use-case is found.
NS_ASSERTION(false, "implement me!");
return NS_ERROR_NOT_IMPLEMENTED;
nsCOMPtr<nsIBaseWindow> ownerWindow(do_QueryInterface(mTreeOwner));
if (ownerWindow) {
return ownerWindow->SetPositionDesktopPix(aX, aY);
}
double scale = 1.0;
GetDevicePixelsPerDesktopPixel(&scale);
return SetPosition(NSToIntRound(aX * scale), NSToIntRound(aY * scale));
}
NS_IMETHODIMP
@ -6124,7 +6128,7 @@ nsDocShell::SetIsActiveInternal(bool aIsActive, bool aIsHidden)
continue;
}
if (!docshell->GetIsBrowserOrApp()) {
if (!docshell->GetIsMozBrowserOrApp()) {
if (aIsHidden) {
docshell->SetIsActive(aIsActive);
} else {
@ -6133,6 +6137,15 @@ nsDocShell::SetIsActiveInternal(bool aIsActive, bool aIsHidden)
}
}
// Restart or stop meta refresh timers if necessary
if (mDisableMetaRefreshWhenInactive) {
if (mIsActive) {
ResumeRefreshURIs();
} else {
SuspendRefreshURIs();
}
}
return NS_OK;
}
@ -6578,7 +6591,6 @@ nsDocShell::RefreshURI(nsIURI* aURI, int32_t aDelay, bool aRepeat,
}
nsRefreshTimer* refreshTimer = new nsRefreshTimer();
NS_ENSURE_TRUE(refreshTimer, NS_ERROR_OUT_OF_MEMORY);
uint32_t busyFlags = 0;
GetBusyFlags(&busyFlags);
@ -6595,10 +6607,9 @@ nsDocShell::RefreshURI(nsIURI* aURI, int32_t aDelay, bool aRepeat,
NS_ERROR_FAILURE);
}
if (busyFlags & BUSY_FLAGS_BUSY) {
// We are busy loading another page. Don't create the
// timer right now. Instead queue up the request and trigger the
// timer in EndPageLoad().
if (busyFlags & BUSY_FLAGS_BUSY || (!mIsActive && mDisableMetaRefreshWhenInactive)) {
// We don't want to create the timer right now. Instead queue up the request
// and trigger the timer in EndPageLoad() or whenever we become active.
mRefreshURIList->AppendElement(refreshTimer);
} else {
// There is no page loading going on right now. Create the
@ -7551,7 +7562,8 @@ nsDocShell::EndPageLoad(nsIWebProgress* aProgress,
}
// if there's a refresh header in the channel, this method
// will set it up for us.
RefreshURIFromQueue();
if (mIsActive || !mDisableMetaRefreshWhenInactive)
RefreshURIFromQueue();
// Test whether this is the top frame or a subframe
bool isTopFrame = true;
@ -13885,13 +13897,6 @@ nsDocShell::SetUserContextId(uint32_t aUserContextId)
return NS_OK;
}
/* [infallible] */ NS_IMETHODIMP
nsDocShell::GetIsBrowserElement(bool* aIsBrowser)
{
*aIsBrowser = (mFrameType == eFrameTypeBrowser);
return NS_OK;
}
/* [infallible] */ NS_IMETHODIMP
nsDocShell::GetIsApp(bool* aIsApp)
{
@ -13900,15 +13905,15 @@ nsDocShell::GetIsApp(bool* aIsApp)
}
/* [infallible] */ NS_IMETHODIMP
nsDocShell::GetIsBrowserOrApp(bool* aIsBrowserOrApp)
nsDocShell::GetIsMozBrowserOrApp(bool* aIsMozBrowserOrApp)
{
switch (mFrameType) {
case eFrameTypeRegular:
*aIsBrowserOrApp = false;
*aIsMozBrowserOrApp = false;
break;
case eFrameTypeBrowser:
case eFrameTypeApp:
*aIsBrowserOrApp = true;
*aIsMozBrowserOrApp = true;
break;
}
@ -13934,22 +13939,42 @@ nsDocShell::GetInheritedFrameType()
}
/* [infallible] */ NS_IMETHODIMP
nsDocShell::GetIsInBrowserElement(bool* aIsInBrowserElement)
nsDocShell::GetIsIsolatedMozBrowserElement(bool* aIsIsolatedMozBrowserElement)
{
*aIsInBrowserElement = (GetInheritedFrameType() == eFrameTypeBrowser);
bool result = mFrameType == eFrameTypeBrowser && mIsInIsolatedMozBrowser;
*aIsIsolatedMozBrowserElement = result;
return NS_OK;
}
/* [infallible] */ NS_IMETHODIMP
nsDocShell::GetIsInBrowserOrApp(bool* aIsInBrowserOrApp)
nsDocShell::GetIsInIsolatedMozBrowserElement(bool* aIsInIsolatedMozBrowserElement)
{
MOZ_ASSERT(!mIsInIsolatedMozBrowser ||
(GetInheritedFrameType() == eFrameTypeBrowser),
"Isolated mozbrowser should only be true inside browser frames");
bool result = (GetInheritedFrameType() == eFrameTypeBrowser) &&
mIsInIsolatedMozBrowser;
*aIsInIsolatedMozBrowserElement = result;
return NS_OK;
}
/* [infallible] */ NS_IMETHODIMP
nsDocShell::SetIsInIsolatedMozBrowserElement(bool aIsInIsolatedMozBrowserElement)
{
mIsInIsolatedMozBrowser = aIsInIsolatedMozBrowserElement;
return NS_OK;
}
/* [infallible] */ NS_IMETHODIMP
nsDocShell::GetIsInMozBrowserOrApp(bool* aIsInMozBrowserOrApp)
{
switch (GetInheritedFrameType()) {
case eFrameTypeRegular:
*aIsInBrowserOrApp = false;
*aIsInMozBrowserOrApp = false;
break;
case eFrameTypeBrowser:
case eFrameTypeApp:
*aIsInBrowserOrApp = true;
*aIsInMozBrowserOrApp = true;
break;
}
@ -13995,10 +14020,7 @@ nsDocShell::GetOriginAttributes()
}
attrs.mUserContextId = mUserContextId;
if (mFrameType == eFrameTypeBrowser) {
attrs.mInBrowser = true;
}
attrs.mInIsolatedMozBrowser = mIsInIsolatedMozBrowser;
return attrs;
}

View File

@ -938,6 +938,7 @@ protected:
bool mAllowKeywordFixup;
bool mIsOffScreenBrowser;
bool mIsActive;
bool mDisableMetaRefreshWhenInactive;
bool mIsPrerendered;
bool mIsAppTab;
bool mUseGlobalHistory;
@ -1000,6 +1001,9 @@ protected:
// Are we a regular frame, a browser frame, or an app frame?
FrameType mFrameType;
// Whether we are in an isolated mozbrowser frame.
bool mIsInIsolatedMozBrowser;
// We only expect mOwnOrContainingAppId to be something other than
// UNKNOWN_APP_ID if mFrameType != eFrameTypeRegular. For vanilla iframes
// inside an app, we'll retrieve the containing app-id by walking up the

View File

@ -763,44 +763,55 @@ interface nsIDocShell : nsIDocShellTreeItem
*/
[noscript] void notifyScrollObservers();
/**
* Returns true if this docshell corresponds to an <iframe mozbrowser>.
* (<iframe mozapp mozbrowser> is not considered a browser.)
*/
[infallible] readonly attribute boolean isBrowserElement;
/**
* Returns true iff the docshell corresponds to an <iframe mozapp>.
*/
[infallible] readonly attribute boolean isApp;
/**
* Returns isBrowserElement || isApp.
* Returns true if this docshell corresponds to an <iframe mozbrowser> or
* <iframe mozapp>. <xul:browser> returns false here.
*/
[infallible] readonly attribute boolean isBrowserOrApp;
[infallible] readonly attribute boolean isMozBrowserOrApp;
/**
* Returns true if this docshell corresponds to an <iframe mozbrowser> or if
* the docshell is contained in an <iframe mozbrowser>. (<iframe mozapp
* mozbrowser> does not count as a browser.)
* Returns true if this docshell corresponds to an isolated <iframe
* mozbrowser>.
*
* <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.
*/
[infallible] readonly attribute boolean isIsolatedMozBrowserElement;
/**
* Returns true if this docshell corresponds to an isolated <iframe
* mozbrowser> or if the docshell is contained in an isolated <iframe
* mozbrowser>.
*
* <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.
*
* Our notion here of "contained in" means: Walk up the docshell hierarchy in
* this process until we hit an <iframe mozapp> or <iframe mozbrowser> (or
* until the hierarchy ends). Return true iff the docshell we stopped on has
* isBrowserElement == true.
* isIsolatedMozBrowserElement == true.
*/
[infallible] readonly attribute boolean isInBrowserElement;
[infallible] attribute boolean isInIsolatedMozBrowserElement;
/**
* Returns true if this docshell corresponds to an <iframe mozbrowser> or
* <iframe mozapp>, or if this docshell is contained in an <iframe mozbrowser>
* or <iframe mozapp>.
* or <iframe mozapp>. <xul:browser> returns false here.
*
* To compute this value, we walk up the docshell hierarchy. If we encounter
* a docshell with isBrowserElement or isApp before we hit the end of the
* hierarchy, we return true. Otherwise, we return false.
* a docshell with isMozBrowserOrApp before we hit the end of the hierarchy,
* we return true. Otherwise, we return false.
*/
[infallible] readonly attribute boolean isInBrowserOrApp;
[infallible] readonly attribute boolean isInMozBrowserOrApp;
/**
* Indicate that this docshell corresponds to an app with the given app id.

View File

@ -116,9 +116,13 @@ interface nsILoadContext : nsISupports
[noscript] void SetRemoteTabs(in boolean aUseRemoteTabs);
/**
* Returns true iff the load is occurring inside a browser element.
* Returns true iff the load is occurring inside 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.
*/
readonly attribute boolean isInBrowserElement;
readonly attribute boolean isInIsolatedMozBrowserElement;
/**
* Returns the app id of the app the load is occurring is in. Returns

View File

@ -91,6 +91,17 @@ public:
*/
virtual void NotifyAnimationUpdated(Animation& aAnimation);
/**
* Returns true if any CSS animations, CSS transitions or Web animations are
* currently associated with this timeline. As soon as an animation is
* applied to an element it is associated with the timeline even if it has a
* delayed start, so this includes animations that may not be active for some
* time.
*/
bool HasAnimations() const {
return !mAnimations.IsEmpty();
}
void RemoveAnimation(Animation* aAnimation);
protected:

View File

@ -106,6 +106,10 @@ AppsService.prototype = {
return DOMApplicationRegistry.getWebAppsBasePath();
},
areAnyAppsInstalled: function() {
return DOMApplicationRegistry.areAnyAppsInstalled();
},
getAppInfo: function getAppInfo(aAppId) {
debug("getAppInfo()");
return DOMApplicationRegistry.getAppInfo(aAppId);

View File

@ -412,6 +412,10 @@ this.DOMApplicationRegistry = {
return null;
},
areAnyAppsInstalled: function() {
return AppsUtils.areAnyAppsInstalled(this.webapps);
},
getAppInfo: function getAppInfo(aAppId) {
return AppsUtils.getAppInfo(this.webapps, aAppId);
},

View File

@ -149,16 +149,17 @@ this.AppsUtils = {
return obj;
},
// Creates a nsILoadContext object with a given appId and isBrowser flag.
createLoadContext: function createLoadContext(aAppId, aIsBrowser) {
// Creates a nsILoadContext object with a given appId and inIsolatedMozBrowser
// flag.
createLoadContext: function createLoadContext(aAppId, aInIsolatedMozBrowser) {
return {
associatedWindow: null,
topWindow : null,
appId: aAppId,
isInBrowserElement: aIsBrowser,
isInIsolatedMozBrowserElement: aInIsolatedMozBrowser,
originAttributes: {
appId: aAppId,
inBrowser: aIsBrowser
inIsolatedMozBrowser: aInIsolatedMozBrowser
},
usePrivateBrowsing: false,
isContent: false,
@ -344,6 +345,10 @@ this.AppsUtils = {
return "";
},
areAnyAppsInstalled: function(aApps) {
return Object.getOwnPropertyNames(aApps).length > 0;
},
getCoreAppsBasePath: function getCoreAppsBasePath() {
debug("getCoreAppsBasePath()");
try {

View File

@ -183,7 +183,7 @@ WebappsRegistry.prototype = {
topId: this._topId,
requestID: requestID,
appId: principal.appId,
isBrowser: principal.isInBrowserElement,
isBrowser: principal.isInIsolatedMozBrowserElement,
isPackage: isPackage
};
},

View File

@ -3536,10 +3536,10 @@ this.DOMApplicationRegistry = {
// nsILoadContext
appId: aOldApp.installerAppId,
isInBrowserElement: aOldApp.installerIsBrowser,
isInIsolatedMozBrowserElement: aOldApp.installerIsBrowser,
originAttributes: {
appId: aOldApp.installerAppId,
inBrowser: aOldApp.installerIsBrowser
inIsolatedMozBrowser: aOldApp.installerIsBrowser
},
usePrivateBrowsing: false,
isContent: false,
@ -4799,6 +4799,10 @@ this.DOMApplicationRegistry = {
return OS.Path.dirname(this.appsFile);
},
areAnyAppsInstalled: function() {
return AppsUtils.areAnyAppsInstalled(this.webapps);
},
updateDataStoreEntriesFromLocalId: function(aLocalId) {
let app = appsService.getAppByLocalId(aLocalId);
if (app) {
@ -4902,7 +4906,7 @@ this.DOMApplicationRegistry = {
_clearOriginData: function(appId, browserOnly) {
let attributes = {appId: appId};
if (browserOnly) {
attributes.inBrowser = true;
attributes.inIsolatedMozBrowser = true;
}
this._notifyCategoryAndObservers(null, "clear-origin-data", JSON.stringify(attributes));
}

View File

@ -53,8 +53,8 @@ add_test(() => {
Assert.equal(mozapp.principal.origin, expectedPrincipalOrigin,
"app principal origin ok");
Assert.equal(mozapp.principal.appId, app.localId, "app principal appId ok");
Assert.equal(mozapp.principal.isInBrowserElement, false,
"app principal isInBrowserElement ok");
Assert.equal(mozapp.principal.isInIsolatedMozBrowserElement, false,
"app principal isInIsolatedMozBrowserElement ok");
run_next_test();
});

View File

@ -108,7 +108,7 @@ ChromeUtils::IsOriginAttributesEqual(dom::GlobalObject& aGlobal,
{
return aA.mAddonId == aB.mAddonId &&
aA.mAppId == aB.mAppId &&
aA.mInBrowser == aB.mInBrowser &&
aA.mInIsolatedMozBrowser == aB.mInIsolatedMozBrowser &&
aA.mSignedPkg == aB.mSignedPkg &&
aA.mUserContextId == aB.mUserContextId;
}

View File

@ -135,14 +135,14 @@ PerformanceObserver::QueueEntry(PerformanceEntry* aEntry)
mQueuedEntries.AppendElement(aEntry);
}
static nsString sValidTypeNames[7] = {
NS_LITERAL_STRING("composite"),
NS_LITERAL_STRING("mark"),
NS_LITERAL_STRING("measure"),
NS_LITERAL_STRING("navigation"),
NS_LITERAL_STRING("render"),
NS_LITERAL_STRING("resource"),
NS_LITERAL_STRING("server")
static const char16_t* sValidTypeNames[7] = {
MOZ_UTF16("composite"),
MOZ_UTF16("mark"),
MOZ_UTF16("measure"),
MOZ_UTF16("navigation"),
MOZ_UTF16("render"),
MOZ_UTF16("resource"),
MOZ_UTF16("server")
};
void
@ -156,7 +156,8 @@ PerformanceObserver::Observe(const PerformanceObserverInit& aOptions,
nsTArray<nsString> validEntryTypes;
for (const nsString& validTypeName : sValidTypeNames) {
for (const char16_t* name : sValidTypeNames) {
nsDependentString validTypeName(name);
if (aOptions.mEntryTypes.Contains<nsString>(validTypeName) &&
!validEntryTypes.Contains<nsString>(validTypeName)) {
validEntryTypes.AppendElement(validTypeName);

View File

@ -349,9 +349,10 @@ AutoJSAPI::InitInternal(JSObject* aGlobal, JSContext* aCx, bool aIsMainThread)
mAutoNullableCompartment.emplace(mCx, aGlobal);
}
JSRuntime* rt = JS_GetRuntime(aCx);
mOldErrorReporter.emplace(JS_GetErrorReporter(rt));
if (aIsMainThread) {
JSRuntime* rt = JS_GetRuntime(aCx);
mOldErrorReporter.emplace(JS_GetErrorReporter(rt));
JS_SetErrorReporter(rt, xpc::SystemErrorReporter);
}
}
@ -465,8 +466,21 @@ AutoJSAPI::InitWithLegacyErrorReporting(nsGlobalWindow* aWindow)
void
WarningOnlyErrorReporter(JSContext* aCx, const char* aMessage, JSErrorReport* aRep)
{
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(JSREPORT_IS_WARNING(aRep->flags));
if (!NS_IsMainThread()) {
// Reporting a warning on workers is a bit complicated because we have to
// climb our parent chain until we get to the main thread. So go ahead and
// just go through the worker ReportError codepath here.
//
// That said, it feels like we should be able to short-circuit things a bit
// here by posting an appropriate runnable to the main thread directly...
// Worth looking into sometime.
workers::WorkerPrivate* worker = workers::GetWorkerPrivateFromContext(aCx);
MOZ_ASSERT(worker);
worker->ReportError(aCx, aMessage, aRep);
return;
}
RefPtr<xpc::ErrorReport> xpcReport = new xpc::ErrorReport();
nsGlobalWindow* win = xpc::CurrentWindowOrNull(aCx);
@ -484,13 +498,7 @@ AutoJSAPI::TakeOwnershipOfErrorReporting()
JSRuntime *rt = JS_GetRuntime(cx());
mOldAutoJSAPIOwnsErrorReporting = JS::ContextOptionsRef(cx()).autoJSAPIOwnsErrorReporting();
JS::ContextOptionsRef(cx()).setAutoJSAPIOwnsErrorReporting(true);
// Workers have their own error reporting mechanism which deals with warnings
// as well, so don't change the worker error reporter for now. Once we switch
// all of workers to TakeOwnershipOfErrorReporting(), we will just make the
// default worker error reporter assert that it only sees warnings.
if (mIsMainThread) {
JS_SetErrorReporter(rt, WarningOnlyErrorReporter);
}
JS_SetErrorReporter(rt, WarningOnlyErrorReporter);
}
void
@ -548,6 +556,7 @@ AutoJSAPI::ReportException()
}
} else {
NS_WARNING("OOMed while acquiring uncaught exception from JSAPI");
ClearException();
}
}

View File

@ -422,7 +422,7 @@ nsFrameLoader::ReallyStartLoadingInternal()
int32_t flags = nsIWebNavigation::LOAD_FLAGS_NONE;
// Flags for browser frame:
if (OwnerIsBrowserFrame()) {
if (OwnerIsMozBrowserFrame()) {
flags = nsIWebNavigation::LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP |
nsIWebNavigation::LOAD_FLAGS_DISALLOW_INHERIT_OWNER;
}
@ -1200,8 +1200,8 @@ nsFrameLoader::SwapWithOtherLoader(nsFrameLoader* aOther,
return NS_ERROR_NOT_IMPLEMENTED;
}
if (ourDocshell->GetIsBrowserElement() !=
otherDocshell->GetIsBrowserElement() ||
if (ourDocshell->GetIsIsolatedMozBrowserElement() !=
otherDocshell->GetIsIsolatedMozBrowserElement() ||
ourDocshell->GetIsApp() != otherDocshell->GetIsApp()) {
return NS_ERROR_NOT_IMPLEMENTED;
}
@ -1577,7 +1577,7 @@ nsFrameLoader::SetOwnerContent(Element* aContent)
}
bool
nsFrameLoader::OwnerIsBrowserOrAppFrame()
nsFrameLoader::OwnerIsMozBrowserOrAppFrame()
{
nsCOMPtr<nsIMozBrowserFrame> browserFrame = do_QueryInterface(mOwnerContent);
return browserFrame ? browserFrame->GetReallyIsBrowserOrApp() : false;
@ -1585,9 +1585,9 @@ nsFrameLoader::OwnerIsBrowserOrAppFrame()
// The xpcom getter version
NS_IMETHODIMP
nsFrameLoader::GetOwnerIsBrowserOrAppFrame(bool* aResult)
nsFrameLoader::GetOwnerIsMozBrowserOrAppFrame(bool* aResult)
{
*aResult = OwnerIsBrowserOrAppFrame();
*aResult = OwnerIsMozBrowserOrAppFrame();
return NS_OK;
}
@ -1615,9 +1615,66 @@ nsFrameLoader::OwnerIsAppFrame()
}
bool
nsFrameLoader::OwnerIsBrowserFrame()
nsFrameLoader::OwnerIsMozBrowserFrame()
{
return OwnerIsBrowserOrAppFrame() && !OwnerIsAppFrame();
return OwnerIsMozBrowserOrAppFrame() && !OwnerIsAppFrame();
}
bool
nsFrameLoader::OwnerIsIsolatedMozBrowserFrame()
{
nsCOMPtr<nsIMozBrowserFrame> browserFrame = do_QueryInterface(mOwnerContent);
if (!browserFrame) {
return false;
}
if (!OwnerIsMozBrowserFrame()) {
return false;
}
bool isolated = browserFrame->GetIsolated();
if (isolated) {
return true;
}
// After bug 1238160, which allows isolation to be disabled on mozbrowser
// frames, we no longer have a way to tell from the principal alone if
// something "is a mozbrowser". Instead, we now only know "is an isolated
// mozbrowser". The following code paths would return invalid results if it
// were possible to have apps *and* isolation could be disabled:
// * CheckPermission in AppProcessChecker.cpp
// * nsScriptSecurityManager::AppStatusForPrincipal
// * init() in SystemMessageManager.js
// Currently, desktop is the only platform where we intend to disable
// isolation on a browser frame, so non-desktop should be able to assume that
// inIsolatedMozBrowser is true for all mozbrowser frames. To enforce these
// assumptions, we assert that there are no apps installed if we have tried
// to disable isolation.
nsCOMPtr<nsIAppsService> appsService = do_GetService(APPS_SERVICE_CONTRACTID);
if (!appsService) {
// If the apps service is not present, we assume this means there can't be
// any apps at all, so there is no problem.
return false;
}
bool appsInstalled;
nsresult rv = appsService->AreAnyAppsInstalled(&appsInstalled);
if (NS_WARN_IF(NS_FAILED(rv))) {
// The apps service exists, but it threw an error when checking if there are
// any apps, so we don't know if we have them or not.
return false;
}
#ifdef MOZ_B2G
MOZ_RELEASE_ASSERT(!appsInstalled,
"Disabling mozbrowser isolation is not currently "
"allowed when apps are installed.");
#else
if (appsInstalled) {
NS_WARNING("Disabling mozbrowser isolation is not currently allowed when "
"apps are installed.");
}
#endif
return false;
}
void
@ -1692,7 +1749,7 @@ nsFrameLoader::ShouldUseRemoteProcess()
// If we're an <iframe mozbrowser> and we don't have a "remote" attribute,
// fall back to the default.
if (OwnerIsBrowserOrAppFrame() &&
if (OwnerIsMozBrowserOrAppFrame() &&
!mOwnerContent->HasAttr(kNameSpaceID_None, nsGkAtoms::Remote)) {
return Preferences::GetBool("dom.ipc.browser_frames.oop_by_default", false);
@ -1700,7 +1757,7 @@ nsFrameLoader::ShouldUseRemoteProcess()
// Otherwise, we're remote if we have "remote=true" and we're either a
// browser frame or a XUL element.
return (OwnerIsBrowserOrAppFrame() ||
return (OwnerIsMozBrowserOrAppFrame() ||
mOwnerContent->GetNameSpaceID() == kNameSpaceID_XUL) &&
mOwnerContent->AttrValueIs(kNameSpaceID_None,
nsGkAtoms::Remote,
@ -1883,7 +1940,7 @@ nsFrameLoader::MaybeCreateDocShell()
if (OwnerIsAppFrame()) {
// You can't be both an app and a browser frame.
MOZ_ASSERT(!OwnerIsBrowserFrame());
MOZ_ASSERT(!OwnerIsMozBrowserFrame());
nsCOMPtr<mozIApplication> ownApp = GetOwnApp();
MOZ_ASSERT(ownApp);
@ -1895,7 +1952,7 @@ nsFrameLoader::MaybeCreateDocShell()
mDocShell->SetIsApp(ownAppId);
}
if (OwnerIsBrowserFrame()) {
if (OwnerIsMozBrowserFrame()) {
// You can't be both a browser and an app frame.
MOZ_ASSERT(!OwnerIsAppFrame());
@ -1906,9 +1963,10 @@ nsFrameLoader::MaybeCreateDocShell()
NS_ERROR_FAILURE);
}
mDocShell->SetIsBrowserInsideApp(containingAppId);
mDocShell->SetIsInIsolatedMozBrowserElement(OwnerIsIsolatedMozBrowserFrame());
}
if (OwnerIsBrowserOrAppFrame()) {
if (OwnerIsMozBrowserOrAppFrame()) {
// For inproc frames, set the docshell properties.
nsCOMPtr<nsIDocShellTreeItem> item = do_GetInterface(docShell);
nsAutoString name;
@ -2249,7 +2307,7 @@ nsFrameLoader::TryRemoteBrowser()
}
// <iframe mozbrowser> gets to skip these checks.
if (!OwnerIsBrowserOrAppFrame()) {
if (!OwnerIsMozBrowserOrAppFrame()) {
if (parentDocShell->ItemType() != nsIDocShellTreeItem::typeChrome) {
return false;
}
@ -2566,7 +2624,7 @@ nsFrameLoader::EnsureMessageManager()
}
if (!mIsTopLevelContent &&
!OwnerIsBrowserOrAppFrame() &&
!OwnerIsMozBrowserOrAppFrame() &&
!IsRemoteFrame() &&
!(mOwnerContent->IsXULElement() &&
mOwnerContent->AttrValueIs(kNameSpaceID_None,
@ -2672,7 +2730,7 @@ nsFrameLoader::SwapRemoteBrowser(nsITabParent* aTabParent)
NS_WARNING("Switching from in-process to out-of-process is not supported.");
return NS_ERROR_NOT_IMPLEMENTED;
}
if (!OwnerIsBrowserOrAppFrame()) {
if (!OwnerIsMozBrowserOrAppFrame()) {
NS_WARNING("Switching process for non-mozbrowser/app frame is not supported.");
return NS_ERROR_NOT_IMPLEMENTED;
}
@ -2823,7 +2881,7 @@ nsFrameLoader::ResetPermissionManagerStatus()
uint32_t appId = nsIScriptSecurityManager::NO_APP_ID;
if (OwnerIsAppFrame()) {
// You can't be both an app and a browser frame.
MOZ_ASSERT(!OwnerIsBrowserFrame());
MOZ_ASSERT(!OwnerIsMozBrowserFrame());
nsCOMPtr<mozIApplication> ownApp = GetOwnApp();
MOZ_ASSERT(ownApp);
@ -2833,7 +2891,7 @@ nsFrameLoader::ResetPermissionManagerStatus()
}
}
if (OwnerIsBrowserFrame()) {
if (OwnerIsMozBrowserFrame()) {
// You can't be both a browser and an app frame.
MOZ_ASSERT(!OwnerIsAppFrame());
@ -2971,7 +3029,7 @@ nsFrameLoader::GetLoadContext(nsILoadContext** aLoadContext)
void
nsFrameLoader::InitializeBrowserAPI()
{
if (OwnerIsBrowserOrAppFrame()) {
if (OwnerIsMozBrowserOrAppFrame()) {
if (!IsRemoteFrame()) {
nsresult rv = EnsureMessageManager();
if (NS_WARN_IF(NS_FAILED(rv))) {
@ -3066,7 +3124,7 @@ nsFrameLoader::GetNewTabContext(MutableTabContext* aTabContext,
nsCOMPtr<mozIApplication> ownApp = GetOwnApp();
nsCOMPtr<mozIApplication> containingApp = GetContainingApp();
DocShellOriginAttributes attrs;
attrs.mInBrowser = OwnerIsBrowserFrame();
attrs.mInIsolatedMozBrowser = OwnerIsIsolatedMozBrowserFrame();
nsCString signedPkgOrigin;
if (!aPackageId.IsEmpty()) {
@ -3107,7 +3165,11 @@ nsFrameLoader::GetNewTabContext(MutableTabContext* aTabContext,
}
bool tabContextUpdated =
aTabContext->SetTabContext(ownApp, containingApp, attrs, signedPkgOrigin);
aTabContext->SetTabContext(OwnerIsMozBrowserFrame(),
ownApp,
containingApp,
attrs,
signedPkgOrigin);
NS_ENSURE_STATE(tabContextUpdated);
return NS_OK;

View File

@ -143,7 +143,7 @@ public:
return mOwnerContent ? mOwnerContent->GetPrimaryFrame() : nullptr;
}
/**
/**
* Return the document that owns this, or null if we don't have
* an owner.
*/
@ -194,7 +194,7 @@ public:
* otherwise we'll discard the old presentation and set the detached
* subdoc view to null. aContainerDoc is the document containing the
* the subdoc frame. This enables us to detect when the containing
* document has changed during reframe, so we can discard the presentation
* document has changed during reframe, so we can discard the presentation
* in that case.
*/
void SetDetachedSubdocView(nsView* aDetachedView,
@ -242,8 +242,9 @@ private:
* Is this a frameloader for a bona fide <iframe mozbrowser> or
* <iframe mozapp>? (I.e., does the frame return true for
* nsIMozBrowserFrame::GetReallyIsBrowserOrApp()?)
* <xul:browser> is not a mozbrowser or app, so this is false for that case.
*/
bool OwnerIsBrowserOrAppFrame();
bool OwnerIsMozBrowserOrAppFrame();
/**
* Is this a frameloader for a bona fide <iframe mozwidget>? (I.e., does the
@ -259,8 +260,18 @@ private:
/**
* Is this a frame loader for a bona fide <iframe mozbrowser>?
* <xul:browser> is not a mozbrowser, so this is false for that case.
*/
bool OwnerIsBrowserFrame();
bool OwnerIsMozBrowserFrame();
/**
* Is this a frame loader for an isolated <iframe mozbrowser>?
*
* By default, mozbrowser frames are isolated. Isolation can be disabled by
* setting the frame's noisolation attribute. Disabling isolation is
* only allowed if the containing document is chrome.
*/
bool OwnerIsIsolatedMozBrowserFrame();
/**
* Get our owning element's app manifest URL, or return the empty string if

View File

@ -657,6 +657,7 @@ GK_ATOM(nodeSet, "node-set")
GK_ATOM(noembed, "noembed")
GK_ATOM(noframes, "noframes")
GK_ATOM(nohref, "nohref")
GK_ATOM(noisolation, "noisolation")
GK_ATOM(nonce, "nonce")
GK_ATOM(none, "none")
GK_ATOM(noresize, "noresize")

View File

@ -457,8 +457,6 @@ nsGlobalWindow::DOMMinTimeoutValue() const {
// CIDs
static NS_DEFINE_CID(kXULControllersCID, NS_XULCONTROLLERS_CID);
static const char sPopStatePrefStr[] = "browser.history.allowPopState";
#define NETWORK_UPLOAD_EVENT_NAME NS_LITERAL_STRING("moznetworkupload")
#define NETWORK_DOWNLOAD_EVENT_NAME NS_LITERAL_STRING("moznetworkdownload")
@ -1158,6 +1156,7 @@ nsGlobalWindow::nsGlobalWindow(nsGlobalWindow *aOuterWindow)
mIsPopupSpam(false),
mBlockScriptedClosingFlag(false),
mWasOffline(false),
mHasHadSlowScript(false),
mNotifyIdleObserversIdleOnThaw(false),
mNotifyIdleObserversActiveOnThaw(false),
mCreatingInnerWindow(false),
@ -3801,7 +3800,7 @@ nsGlobalWindow::GetParentOuter()
}
nsCOMPtr<nsPIDOMWindowOuter> parent;
if (mDocShell->GetIsBrowserOrApp()) {
if (mDocShell->GetIsMozBrowserOrApp()) {
parent = AsOuter();
} else {
parent = GetParent();
@ -3967,7 +3966,7 @@ nsGlobalWindow::GetContentInternal(ErrorResult& aError, bool aUnprivilegedCaller
// If we're contained in <iframe mozbrowser> or <iframe mozapp>, then
// GetContent is the same as window.top.
if (mDocShell && mDocShell->GetIsInBrowserOrApp()) {
if (mDocShell && mDocShell->GetIsInMozBrowserOrApp()) {
return GetTopOuter();
}
@ -7175,7 +7174,7 @@ nsGlobalWindow::ResizeToOuter(int32_t aWidth, int32_t aHeight, ErrorResult& aErr
* If caller is a browser-element then dispatch a resize event to
* the embedder.
*/
if (mDocShell && mDocShell->GetIsBrowserOrApp()) {
if (mDocShell && mDocShell->GetIsMozBrowserOrApp()) {
CSSIntSize size(aWidth, aHeight);
if (!DispatchResizeEvent(size)) {
// The embedder chose to prevent the default action for this
@ -7225,7 +7224,7 @@ nsGlobalWindow::ResizeByOuter(int32_t aWidthDif, int32_t aHeightDif,
* If caller is a browser-element then dispatch a resize event to
* parent.
*/
if (mDocShell && mDocShell->GetIsBrowserOrApp()) {
if (mDocShell && mDocShell->GetIsMozBrowserOrApp()) {
CSSIntSize size;
if (NS_FAILED(GetInnerSize(size))) {
return;
@ -8174,7 +8173,7 @@ nsGlobalWindow::CloseOuter(bool aTrustedCaller)
MOZ_RELEASE_ASSERT(IsOuterWindow());
if (!mDocShell || IsInModalState() ||
(IsFrame() && !mDocShell->GetIsBrowserOrApp())) {
(IsFrame() && !mDocShell->GetIsMozBrowserOrApp())) {
// window.close() is called on a frame in a frameset, on a window
// that's already closed, or on a window for which there's
// currently a modal dialog open. Ignore such calls.
@ -8701,7 +8700,7 @@ nsGlobalWindow::GetFrameElementOuter()
{
MOZ_RELEASE_ASSERT(IsOuterWindow());
if (!mDocShell || mDocShell->GetIsBrowserOrApp()) {
if (!mDocShell || mDocShell->GetIsMozBrowserOrApp()) {
return nullptr;
}
@ -9916,11 +9915,6 @@ nsGlobalWindow::DispatchSyncPopState()
NS_ASSERTION(nsContentUtils::IsSafeToRunScript(),
"Must be safe to run script here.");
// Check that PopState hasn't been pref'ed off.
if (!Preferences::GetBool(sPopStatePrefStr, false)) {
return NS_OK;
}
nsresult rv = NS_OK;
// Bail if the window is frozen.
@ -10662,6 +10656,13 @@ nsGlobalWindow::ShowSlowScriptDialog()
unsigned lineno;
bool hasFrame = JS::DescribeScriptedCaller(cx, &filename, &lineno);
// Record the slow script event if we haven't done so already for this inner window
// (which represents a particular page to the user).
if (!mHasHadSlowScript) {
Telemetry::Accumulate(Telemetry::SLOW_SCRIPT_PAGE_COUNT, 1);
}
mHasHadSlowScript = true;
if (XRE_IsContentProcess() &&
ProcessHangMonitor::Get()) {
ProcessHangMonitor::SlowScriptAction action;

View File

@ -1691,6 +1691,11 @@ protected:
// Window offline status. Checked to see if we need to fire offline event
bool mWasOffline : 1;
// Represents whether the inner window's page has had a slow script notice.
// Only used by inner windows; will always be false for outer windows.
// This is used to implement Telemetry measures such as SLOW_SCRIPT_PAGE_COUNT.
bool mHasHadSlowScript : 1;
// Track what sorts of events we need to fire when thawed
bool mNotifyIdleObserversIdleOnThaw : 1;
bool mNotifyIdleObserversActiveOnThaw : 1;

View File

@ -25,11 +25,6 @@
using namespace mozilla;
using namespace mozilla::dom;
static const char* sAllowPushStatePrefStr =
"browser.history.allowPushState";
static const char* sAllowReplaceStatePrefStr =
"browser.history.allowReplaceState";
//
// History class implementation
//
@ -304,12 +299,6 @@ nsHistory::PushOrReplaceState(JSContext* aCx, JS::Handle<JS::Value> aData,
return;
}
// Check that PushState hasn't been pref'ed off.
if (!Preferences::GetBool(aReplace ? sAllowReplaceStatePrefStr :
sAllowPushStatePrefStr, false)) {
return;
}
// AddState might run scripts, so we need to hold a strong reference to the
// docShell here to keep it from going away.
nsCOMPtr<nsIDocShell> docShell = win->GetDocShell();

View File

@ -150,7 +150,7 @@ interface nsIFrameLoader : nsISupports
const unsigned long EVENT_MODE_NORMAL_DISPATCH = 0x00000000;
/**
* With this event mode, it's the application's responsability to
* With this event mode, it's the application's responsability to
* convert and forward events to the content process
*/
const unsigned long EVENT_MODE_DONT_FORWARD_TO_CHILD = 0x00000001;
@ -196,14 +196,15 @@ interface nsIFrameLoader : nsISupports
[infallible] attribute boolean visible;
/**
* Find out whether the owner content really is a browser or app frame
* Especially, a widget frame is regarded as an app frame.
* Find out whether the owner content really is a mozbrowser or app frame
* Especially, a widget frame is regarded as an app frame. <xul:browser> is
* not considered to be a mozbrowser frame.
*/
readonly attribute boolean ownerIsBrowserOrAppFrame;
readonly attribute boolean ownerIsMozBrowserOrAppFrame;
/**
* Find out whether the owner content really is a widget. If this attribute
* returns true, |ownerIsBrowserOrAppFrame| must return true.
* returns true, |ownerIsMozBrowserOrAppFrame| must return true.
*/
readonly attribute boolean ownerIsWidget;

View File

@ -1437,6 +1437,11 @@ TimeUntilNow(TimeStamp start)
struct CycleCollectorStats
{
MOZ_CONSTEXPR CycleCollectorStats() :
mMaxGCDuration(0), mRanSyncForgetSkippable(false), mSuspected(0),
mMaxSkippableDuration(0), mMaxSliceTime(0), mMaxSliceTimeSinceClear(0),
mTotalSliceTime(0), mAnyLockedOut(false), mExtraForgetSkippableCalls(0) {}
void Init()
{
Clear();

View File

@ -259,6 +259,7 @@ support-files =
file_change_policy_redirect.html
file_bug1198095.js
file_bug1250148.sjs
mozbrowser_api_utils.js
[test_anonymousContent_api.html]
[test_anonymousContent_append_after_reflow.html]
@ -872,4 +873,6 @@ skip-if = buildapp == 'b2g' #no ssl support
[test_bug1187157.html]
[test_bug769117.html]
[test_bug1250148.html]
[test_bug1240471.html]
[test_bug1240471.html]
[test_mozbrowser_apis_allowed.html]
[test_mozbrowser_apis_blocked.html]

View File

@ -0,0 +1,72 @@
const FRAME_URL = "http://example.org/";
const METHODS = {
setVisible: {},
getVisible: {},
setActive: {},
getActive: {},
addNextPaintListener: {},
removeNextPaintListener: {},
sendMouseEvent: {},
sendTouchEvent: {},
goBack: {},
goForward: {},
reload: {},
stop: {},
download: {},
purgeHistory: {},
getScreenshot: {},
zoom: {},
getCanGoBack: {},
getCanGoForward: {},
getContentDimensions: {},
setInputMethodActive: { alwaysFails: true }, // needs input-manage
setNFCFocus: { alwaysFails: true }, // needs nfc-manager
findAll: {},
findNext: {},
clearMatch: {},
executeScript: { alwaysFails: true }, // needs browser:universalxss
getStructuredData: {},
getWebManifest: {},
mute: {},
unmute: {},
getMuted: {},
setVolume: {},
getVolume: {},
};
const ATTRIBUTES = [
"allowedAudioChannels",
];
function once(target, eventName, useCapture = false) {
info("Waiting for event: '" + eventName + "' on " + target + ".");
return new Promise(resolve => {
for (let [add, remove] of [
["addEventListener", "removeEventListener"],
["addMessageListener", "removeMessageListener"],
]) {
if ((add in target) && (remove in target)) {
target[add](eventName, function onEvent(...aArgs) {
info("Got event: '" + eventName + "' on " + target + ".");
target[remove](eventName, onEvent, useCapture);
resolve(aArgs);
}, useCapture);
break;
}
}
});
}
function* loadFrame(attributes = {}) {
let iframe = document.createElement("iframe");
iframe.setAttribute("src", FRAME_URL);
for (let key in attributes) {
iframe.setAttribute(key, attributes[key]);
}
let loaded = once(iframe, "load");
document.body.appendChild(iframe);
yield loaded;
return iframe;
}

View File

@ -34,8 +34,8 @@
sendAsyncMessage(message.name, "principal.origin: " +
("origin" in message.principal ? "OK" : "KO"));
sendAsyncMessage(message.name, "principal.isInBrowserElement: " +
("isInBrowserElement" in message.principal ? "OK" : "KO"));
sendAsyncMessage(message.name, "principal.isInIsolatedMozBrowserElement: " +
("isInIsolatedMozBrowserElement" in message.principal ? "OK" : "KO"));
sendAsyncMessage(message.name, "DONE");
});

View File

@ -38,8 +38,8 @@
sendAsyncMessage("test:result", "principal.origin: " +
("origin" in message.data ? "OK" : "KO"));
sendAsyncMessage("test:result", "principal.isInBrowserElement: " +
("isInBrowserElement" in message.data ? "OK" : "KO"));
sendAsyncMessage("test:result", "principal.isInIsolatedMozBrowserElement: " +
("isInIsolatedMozBrowserElement" in message.data ? "OK" : "KO"));
});
addMessageListener("test:system", function(message) {

View File

@ -110,7 +110,7 @@
{ type: "browser", allow: 1, context: { url: principal.URI.spec,
originAttributes: {
appId: principal.appId,
inBrowser: true }}}
inIsolatedMozBrowser: true }}}
], () => {
SpecialPowers.pushPrefEnv({
set: [

View File

@ -0,0 +1,51 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Verify mozbrowser APIs are allowed with browser permission</title>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SpawnTask.js"></script>
<script type="text/javascript" src="mozbrowser_api_utils.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<script type="application/javascript;version=1.8">
add_task(function*() {
yield new Promise(resolve => {
SpecialPowers.pushPrefEnv(
{ "set": [["dom.mozBrowserFramesEnabled", true]] },
resolve);
});
});
add_task(function*() {
yield new Promise(resolve => {
SpecialPowers.pushPermissions([
{ "type": "browser", "allow": 1, "context": document }
], resolve);
});
});
add_task(function*() {
// Create <iframe mozbrowser>
let frame = yield loadFrame({
mozbrowser: "true"
});
// Verify that mozbrowser APIs are accessible
for (let method in METHODS) {
let { alwaysFails } = METHODS[method];
if (alwaysFails) {
ok(!(method in frame), `frame does not have method ${method}, ` +
`needs more permissions`);
} else {
ok(method in frame, `frame has method ${method}`);
}
}
for (let attribute of ATTRIBUTES) {
ok(attribute in frame, `frame has attribute ${attribute}`);
}
});
</script>
</body>
</html>

View File

@ -0,0 +1,37 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Verify mozbrowser APIs are blocked without browser permission</title>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SpawnTask.js"></script>
<script type="text/javascript" src="mozbrowser_api_utils.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<script type="application/javascript;version=1.8">
add_task(function*() {
yield new Promise(resolve => {
SpecialPowers.pushPrefEnv(
{ "set": [["dom.mozBrowserFramesEnabled", true]] },
resolve);
});
});
add_task(function*() {
// Create <iframe mozbrowser>
let frame = yield loadFrame({
mozbrowser: "true"
});
// Verify that mozbrowser APIs are not accessible
for (let method in METHODS) {
ok(!(method in frame), `frame does not have method ${method}`);
}
for (let attribute of ATTRIBUTES) {
ok(!(attribute in frame), `frame does not have attribute ${attribute}`);
}
});
</script>
</body>
</html>

View File

@ -12187,6 +12187,15 @@ class CGDictionary(CGThing):
return "DictionaryBase"
def initMethod(self):
"""
This function outputs the body of the Init() method for the dictionary.
For the most part, this is some bookkeeping for our atoms so
we can avoid atomizing strings all the time, then we just spit
out the getMemberConversion() output for each member,
separated by newlines.
"""
body = dedent("""
// Passing a null JSContext is OK only if we're initing from null,
// Since in that case we will not have to do any property gets
@ -12504,6 +12513,25 @@ class CGDictionary(CGThing):
return declType.define()
def getMemberConversion(self, memberInfo):
"""
A function that outputs the initialization of a single dictionary
member from the given dictionary value.
We start with our conversionInfo, which tells us how to
convert a JS::Value to whatever type this member is. We
substiture the template from the conversionInfo with values
that point to our "temp" JS::Value and our member (which is
the C++ value we want to produce). The output is a string of
code to do the conversion. We store this string in
conversionReplacements["convert"].
Now we have three different ways we might use (or skip) this
string of code, depending on whether the value is required,
optional with default value, or optional without default
value. We set up a template in the 'conversion' variable for
exactly how to do this, then substitute into it from the
conversionReplacements dictionary.
"""
member, conversionInfo = memberInfo
replacements = {
"val": "temp.ref()",

View File

@ -61,6 +61,7 @@ MSG_DEF(MSG_PERMISSION_DENIED_TO_PASS_ARG, 1, JSEXN_TYPEERR, "Permission denied
MSG_DEF(MSG_MISSING_REQUIRED_DICTIONARY_MEMBER, 1, JSEXN_TYPEERR, "Missing required {0}.")
MSG_DEF(MSG_INVALID_REQUEST_METHOD, 1, JSEXN_TYPEERR, "Invalid request method {0}.")
MSG_DEF(MSG_INVALID_REQUEST_MODE, 1, JSEXN_TYPEERR, "Invalid request mode {0}.")
MSG_DEF(MSG_INVALID_REFERRER_URL, 1, JSEXN_TYPEERR, "Invalid referrer URL {0}.")
MSG_DEF(MSG_FETCH_BODY_CONSUMED_ERROR, 0, JSEXN_TYPEERR, "Body has already been consumed.")
MSG_DEF(MSG_RESPONSE_INVALID_STATUSTEXT_ERROR, 0, JSEXN_TYPEERR, "Response statusText may not contain newline or carriage return.")
MSG_DEF(MSG_FETCH_FAILED, 0, JSEXN_TYPEERR, "NetworkError when attempting to fetch resource.")

View File

@ -26,7 +26,7 @@ function parentDocShell(docshell) {
function isTopBrowserElement(docShell) {
while (docShell) {
docShell = parentDocShell(docShell);
if (docShell && docShell.isBrowserOrApp) {
if (docShell && docShell.isMozBrowserOrApp) {
return false;
}
}

View File

@ -89,7 +89,7 @@ var CopyPasteAssistent = {
let targetDocShell = currentWindow
.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIWebNavigation);
if(targetDocShell.isBrowserOrApp) {
if(targetDocShell.isMozBrowserOrApp) {
break;
}
}

View File

@ -23,7 +23,7 @@ function runTest() {
document.body.appendChild(iframe);
var context = {url: 'http://example.org',
originAttributes: {inBrowser: true}};
originAttributes: {inIsolatedMozBrowser: true}};
SpecialPowers.pushPermissions([
{type: 'browser', allow: 1, context: context},
{type: 'embed-apps', allow: 1, context: context}

View File

@ -62,7 +62,7 @@ function runTests() {
var context = { 'url': 'http://example.org',
'appId': SpecialPowers.Ci.nsIScriptSecurityManager.NO_APP_ID,
'isInBrowserElement': true };
'isInIsolatedMozBrowserElement': true };
SpecialPowers.pushPermissions([
{'type': 'browser', 'allow': 1, 'context': context},
{'type': 'embed-apps', 'allow': 1, 'context': context}

View File

@ -172,7 +172,7 @@ function testAuthJarNoInterfere(e) {
authMgr.setAuthIdentity('http', 'test', -1, 'basic', 'http_realm',
'tests/dom/browser-element/mochitest/file_http_401_response.sjs',
'', 'httpuser', 'wrongpass', false, principal);
attrs = {appId: 1, inBrowser: true};
attrs = {appId: 1, inIsolatedMozBrowser: true};
principal = secMan.createCodebasePrincipal(uri, attrs);
authMgr.setAuthIdentity('http', 'test', -1, 'basic', 'http_realm',
'tests/dom/browser-element/mochitest/file_http_401_response.sjs',
@ -207,7 +207,7 @@ function testAuthJarInterfere(e) {
var uri = ioService.newURI("http://test/tests/dom/browser-element/mochitest/file_http_401_response.sjs", null, null);
// Set some auth data that should overwrite the successful stored details.
var principal = secMan.createCodebasePrincipal(uri, {inBrowser: true});
var principal = secMan.createCodebasePrincipal(uri, {inIsolatedMozBrowser: true});
authMgr.setAuthIdentity('http', 'test', -1, 'basic', 'http_realm',
'tests/dom/browser-element/mochitest/file_http_401_response.sjs',
'', 'httpuser', 'wrongpass', false, principal);

View File

@ -329,7 +329,7 @@ var principal = SpecialPowers.wrap(document).nodePrincipal;
var context = { url: SpecialPowers.wrap(principal.URI).spec,
originAttributes: {
appId: principal.appId,
inBrowser: true }};
inIsolatedMozBrowser: true }};
addEventListener('testready', function() {
SpecialPowers.pushPermissions([

View File

@ -29,7 +29,7 @@ function runTest() {
document.body.appendChild(iframe);
var context = {url: 'http://example.org',
originAttributes: {inBrowser: true}};
originAttributes: {inIsolatedMozBrowser: true}};
SpecialPowers.pushPermissions([
{type: 'browser', allow: 1, context: context},
{type: 'embed-apps', allow: 1, context: context}

View File

@ -15,7 +15,7 @@ function runTest() {
context: {
url: frameUrl,
originAttributes: {
inBrowser: true
inIsolatedMozBrowser: true
}
}
},{
@ -24,7 +24,7 @@ function runTest() {
context: {
url: frameUrl,
originAttributes: {
inBrowser: true
inIsolatedMozBrowser: true
}
}
}], createFrame);

View File

@ -93,7 +93,7 @@ function setPermissions() {
url: SimpleTest.getTestFileURL('/file_empty.html'),
originAttributes: {
appId: currentAppId,
inBrowser: true
inIsolatedMozBrowser: true
}
}
}];

View File

@ -21,7 +21,7 @@ function runTest() {
SpecialPowers.addPermission("browser", true, {url: SpecialPowers.wrap(principal.URI).spec,
originAttributes: {
appId: principal.appId,
inBrowser: true
inIsolatedMozBrowser: true
}});
iframe = document.createElement('iframe');
@ -80,7 +80,7 @@ function finish() {
SpecialPowers.removePermission("browser", {url: SpecialPowers.wrap(principal.URI).spec,
originAttributes: {
appId: principal.appId,
inBrowser: true
inIsolatedMozBrowser: true
}});
SimpleTest.finish();
}

View File

@ -15,7 +15,7 @@ function runTest() {
SpecialPowers.addPermission("browser", true, {url: SpecialPowers.wrap(principal.URI).spec,
originAttributes: {
appId: principal.appId,
inBrowser: true
inIsolatedMozBrowser: true
}});
var iframe = document.createElement('iframe');
@ -61,7 +61,7 @@ function finish() {
SpecialPowers.removePermission("browser", {url: SpecialPowers.wrap(principal.URI).spec,
originAttributes: {
appId: principal.appId,
inBrowser: true
inIsolatedMozBrowser: true
}});
SimpleTest.finish();

View File

@ -25,7 +25,7 @@ var principal = SpecialPowers.wrap(document).nodePrincipal;
SpecialPowers.addPermission("browser", true, {url: SpecialPowers.wrap(principal.URI).spec,
originAttributes: {
appId: principal.appId,
inBrowser: true
inIsolatedMozBrowser: true
}});
addEventListener('unload', function() {
@ -33,7 +33,7 @@ addEventListener('unload', function() {
SpecialPowers.removePermission("browser", {url: SpecialPowers.wrap(principal.URI).spec,
originAttributes: {
appId: principal.appId,
inBrowser: true
inIsolatedMozBrowser: true
}});
});

View File

@ -24,7 +24,7 @@ var principal = SpecialPowers.wrap(document).nodePrincipal;
SpecialPowers.addPermission("browser", true, {url: SpecialPowers.wrap(principal.URI).spec,
originAttributes: {
appId: principal.appId,
inBrowser: true
inIsolatedMozBrowser: true
}});
addEventListener('unload', function() {
@ -32,7 +32,7 @@ addEventListener('unload', function() {
SpecialPowers.removePermission("browser", {url: SpecialPowers.wrap(principal.URI).spec,
originAttributes: {
appId: principal.appId,
inBrowser: true
inIsolatedMozBrowser: true
}});
});

View File

@ -2399,7 +2399,7 @@ Validate(mozIStorageConnection* aConn)
typedef nsresult (*MigrationFunc)(mozIStorageConnection*);
struct Migration
{
Migration(int32_t aFromVersion, MigrationFunc aFunc)
MOZ_CONSTEXPR Migration(int32_t aFromVersion, MigrationFunc aFunc)
: mFromVersion(aFromVersion)
, mFunc(aFunc)
{ }

View File

@ -1,4 +1,5 @@
[DEFAULT]
skip-if = e10s && debug && os == 'mac' # Bug 1252348
support-files =
image-allow-credentials.png
image-allow-credentials.png^headers^

View File

@ -1,5 +1,5 @@
[DEFAULT]
skip-if = e10s && debug && os == 'win' # Bug 1252677
skip-if = e10s && debug && (os == 'win' || os == 'mac') # Bug 1252677 for Windows, Bug 1252348 for Mac
support-files =
android.json
file_drawImage_document_domain.html

View File

@ -1510,7 +1510,7 @@ EventStateManager::FireContextClick()
nsCOMPtr<nsIFormControl> formCtrl(do_QueryInterface(mGestureDownContent));
if (formCtrl) {
allowedToDispatch = formCtrl->IsTextControl(false) ||
allowedToDispatch = formCtrl->IsTextOrNumberControl(/*aExcludePassword*/ false) ||
formCtrl->GetType() == NS_FORM_INPUT_FILE;
}
else if (mGestureDownContent->IsAnyOfHTMLElements(nsGkAtoms::applet,

View File

@ -91,9 +91,9 @@ Request::GetInternalRequest()
}
namespace {
void
GetRequestURLFromDocument(nsIDocument* aDocument, const nsAString& aInput,
nsAString& aRequestURL, ErrorResult& aRv)
already_AddRefed<nsIURI>
ParseURLFromDocument(nsIDocument* aDocument, const nsAString& aInput,
ErrorResult& aRv)
{
MOZ_ASSERT(aDocument);
MOZ_ASSERT(NS_IsMainThread());
@ -103,6 +103,16 @@ GetRequestURLFromDocument(nsIDocument* aDocument, const nsAString& aInput,
aRv = NS_NewURI(getter_AddRefs(resolvedURI), aInput, nullptr, baseURI);
if (NS_WARN_IF(aRv.Failed())) {
aRv.ThrowTypeError<MSG_INVALID_URL>(aInput);
}
return resolvedURI.forget();
}
void
GetRequestURLFromDocument(nsIDocument* aDocument, const nsAString& aInput,
nsAString& aRequestURL, ErrorResult& aRv)
{
nsCOMPtr<nsIURI> resolvedURI = ParseURLFromDocument(aDocument, aInput, aRv);
if (aRv.Failed()) {
return;
}
@ -132,9 +142,8 @@ GetRequestURLFromDocument(nsIDocument* aDocument, const nsAString& aInput,
CopyUTF8toUTF16(spec, aRequestURL);
}
void
GetRequestURLFromChrome(const nsAString& aInput, nsAString& aRequestURL,
ErrorResult& aRv)
already_AddRefed<nsIURI>
ParseURLFromChrome(const nsAString& aInput, ErrorResult& aRv)
{
MOZ_ASSERT(NS_IsMainThread());
@ -142,6 +151,16 @@ GetRequestURLFromChrome(const nsAString& aInput, nsAString& aRequestURL,
aRv = NS_NewURI(getter_AddRefs(uri), aInput, nullptr, nullptr);
if (NS_WARN_IF(aRv.Failed())) {
aRv.ThrowTypeError<MSG_INVALID_URL>(aInput);
}
return uri.forget();
}
void
GetRequestURLFromChrome(const nsAString& aInput, nsAString& aRequestURL,
ErrorResult& aRv)
{
nsCOMPtr<nsIURI> uri = ParseURLFromChrome(aInput, aRv);
if (aRv.Failed()) {
return;
}
@ -171,9 +190,9 @@ GetRequestURLFromChrome(const nsAString& aInput, nsAString& aRequestURL,
CopyUTF8toUTF16(spec, aRequestURL);
}
void
GetRequestURLFromWorker(const GlobalObject& aGlobal, const nsAString& aInput,
nsAString& aRequestURL, ErrorResult& aRv)
already_AddRefed<workers::URL>
ParseURLFromWorker(const GlobalObject& aGlobal, const nsAString& aInput,
ErrorResult& aRv)
{
workers::WorkerPrivate* worker = workers::GetCurrentThreadWorkerPrivate();
MOZ_ASSERT(worker);
@ -184,6 +203,16 @@ GetRequestURLFromWorker(const GlobalObject& aGlobal, const nsAString& aInput,
workers::URL::Constructor(aGlobal, aInput, baseURL, aRv);
if (NS_WARN_IF(aRv.Failed())) {
aRv.ThrowTypeError<MSG_INVALID_URL>(aInput);
}
return url.forget();
}
void
GetRequestURLFromWorker(const GlobalObject& aGlobal, const nsAString& aInput,
nsAString& aRequestURL, ErrorResult& aRv)
{
RefPtr<workers::URL> url = ParseURLFromWorker(aGlobal, aInput, aRv);
if (aRv.Failed()) {
return;
}
@ -215,6 +244,38 @@ GetRequestURLFromWorker(const GlobalObject& aGlobal, const nsAString& aInput,
}
}
class ReferrerSameOriginChecker final : public workers::WorkerMainThreadRunnable
{
public:
ReferrerSameOriginChecker(workers::WorkerPrivate* aWorkerPrivate,
const nsAString& aReferrerURL,
nsresult& aResult)
: workers::WorkerMainThreadRunnable(aWorkerPrivate),
mReferrerURL(aReferrerURL),
mResult(aResult)
{
mWorkerPrivate->AssertIsOnWorkerThread();
}
bool
MainThreadRun() override
{
nsCOMPtr<nsIURI> uri;
if (NS_SUCCEEDED(NS_NewURI(getter_AddRefs(uri), mReferrerURL))) {
nsCOMPtr<nsIPrincipal> principal = mWorkerPrivate->GetPrincipal();
if (principal) {
mResult = principal->CheckMayLoad(uri, /* report */ false,
/* allowIfInheritsPrincipal */ false);
}
}
return true;
}
private:
const nsString mReferrerURL;
nsresult& mResult;
};
} // namespace
/*static*/ already_AddRefed<Request>
@ -290,6 +351,74 @@ Request::Constructor(const GlobalObject& aGlobal,
return nullptr;
}
if (aInit.IsAnyMemberPresent()) {
request->SetReferrer(NS_LITERAL_STRING(kFETCH_CLIENT_REFERRER_STR));
}
if (aInit.mReferrer.WasPassed()) {
const nsString& referrer = aInit.mReferrer.Value();
if (referrer.IsEmpty()) {
request->SetReferrer(NS_LITERAL_STRING(""));
} else {
nsAutoString referrerURL;
if (NS_IsMainThread()) {
nsIDocument* doc = GetEntryDocument();
nsCOMPtr<nsIURI> uri;
if (doc) {
uri = ParseURLFromDocument(doc, referrer, aRv);
} else {
// If we don't have a document, we must assume that this is a full URL.
uri = ParseURLFromChrome(referrer, aRv);
}
if (NS_WARN_IF(aRv.Failed())) {
aRv.ThrowTypeError<MSG_INVALID_REFERRER_URL>(referrer);
return nullptr;
}
nsAutoCString spec;
uri->GetSpec(spec);
CopyUTF8toUTF16(spec, referrerURL);
if (!referrerURL.EqualsLiteral(kFETCH_CLIENT_REFERRER_STR)) {
nsCOMPtr<nsIPrincipal> principal = global->PrincipalOrNull();
if (principal) {
nsresult rv = principal->CheckMayLoad(uri, /* report */ false,
/* allowIfInheritsPrincipal */ false);
if (NS_FAILED(rv)) {
aRv.ThrowTypeError<MSG_INVALID_REFERRER_URL>(referrer);
return nullptr;
}
}
}
} else {
RefPtr<workers::URL> url = ParseURLFromWorker(aGlobal, referrer, aRv);
if (NS_WARN_IF(aRv.Failed())) {
aRv.ThrowTypeError<MSG_INVALID_REFERRER_URL>(referrer);
return nullptr;
}
url->Stringify(referrerURL, aRv);
if (NS_WARN_IF(aRv.Failed())) {
aRv.ThrowTypeError<MSG_INVALID_REFERRER_URL>(referrer);
return nullptr;
}
if (!referrerURL.EqualsLiteral(kFETCH_CLIENT_REFERRER_STR)) {
workers::WorkerPrivate* worker = workers::GetCurrentThreadWorkerPrivate();
nsresult rv = NS_OK;
// ReferrerSameOriginChecker uses a sync loop to get the main thread
// to perform the same-origin check. Overall, on Workers this method
// can create 3 sync loops (two for constructing URLs and one here) so
// in the future we may want to optimize it all by off-loading all of
// this work in a single sync loop.
RefPtr<ReferrerSameOriginChecker> checker =
new ReferrerSameOriginChecker(worker, referrerURL, rv);
checker->Dispatch(aRv);
if (aRv.Failed() || NS_FAILED(rv)) {
aRv.ThrowTypeError<MSG_INVALID_REFERRER_URL>(referrer);
return nullptr;
}
}
}
request->SetReferrer(referrerURL);
}
}
if (mode != RequestMode::EndGuard_) {
request->ClearCreatedByFetchEvent();
request->SetMode(mode);

View File

@ -54,15 +54,15 @@ nsBrowserElement::IsNotWidgetOrThrow(ErrorResult& aRv)
void
nsBrowserElement::InitBrowserElementAPI()
{
bool isBrowserOrApp;
bool isMozBrowserOrApp;
nsCOMPtr<nsIFrameLoader> frameLoader = GetFrameLoader();
NS_ENSURE_TRUE_VOID(frameLoader);
nsresult rv = frameLoader->GetOwnerIsBrowserOrAppFrame(&isBrowserOrApp);
nsresult rv = frameLoader->GetOwnerIsMozBrowserOrAppFrame(&isMozBrowserOrApp);
NS_ENSURE_SUCCESS_VOID(rv);
rv = frameLoader->GetOwnerIsWidget(&mOwnerIsWidget);
NS_ENSURE_SUCCESS_VOID(rv);
if (!isBrowserOrApp) {
if (!isMozBrowserOrApp) {
return;
}
@ -510,13 +510,13 @@ nsBrowserElement::GetAllowedAudioChannels(
return;
}
bool isBrowserOrApp;
aRv = frameLoader->GetOwnerIsBrowserOrAppFrame(&isBrowserOrApp);
bool isMozBrowserOrApp;
aRv = frameLoader->GetOwnerIsMozBrowserOrAppFrame(&isMozBrowserOrApp);
if (NS_WARN_IF(aRv.Failed())) {
return;
}
if (!isBrowserOrApp) {
if (!isMozBrowserOrApp) {
return;
}

View File

@ -2371,7 +2371,7 @@ nsGenericHTMLFormElement::IntrinsicState() const
// Make the text controls read-write
if (!state.HasState(NS_EVENT_STATE_MOZ_READWRITE) &&
IsTextControl(false)) {
IsTextOrNumberControl(/*aExcludePassword*/ false)) {
bool roState = GetBoolAttr(nsGkAtoms::readonly);
if (!roState) {

View File

@ -550,6 +550,20 @@ nsGenericHTMLFrameElement::GetReallyIsWidget(bool *aOut)
return NS_OK;
}
/* [infallible] */ NS_IMETHODIMP
nsGenericHTMLFrameElement::GetIsolated(bool *aOut)
{
*aOut = true;
if (!nsContentUtils::IsSystemPrincipal(NodePrincipal())) {
return NS_OK;
}
// Isolation is only disabled if the attribute is present
*aOut = !HasAttr(kNameSpaceID_None, nsGkAtoms::noisolation);
return NS_OK;
}
/* [infallible] */ NS_IMETHODIMP
nsGenericHTMLFrameElement::GetIsExpectingSystemMessage(bool *aOut)
{
@ -705,4 +719,3 @@ nsGenericHTMLFrameElement::SwapFrameLoaders(nsXULElement& aOtherOwner,
{
aError.Throw(NS_ERROR_NOT_IMPLEMENTED);
}

View File

@ -176,7 +176,14 @@ public:
* @param aExcludePassword to have NS_FORM_INPUT_PASSWORD returning false.
* @return whether this is a text control.
*/
inline bool IsTextControl(bool aExcludePassword) const ;
inline bool IsTextControl(bool aExcludePassword) const;
/**
* Returns true if this is a text control or a number control.
* @param aExcludePassword to have NS_FORM_INPUT_PASSWORD returning false.
* @return true if this is a text control or a number control.
*/
inline bool IsTextOrNumberControl(bool aExcludePassword) const;
/**
* Returns whether this is a single line text control.
@ -235,6 +242,12 @@ nsIFormControl::IsTextControl(bool aExcludePassword) const
IsSingleLineTextControl(aExcludePassword, type);
}
bool
nsIFormControl::IsTextOrNumberControl(bool aExcludePassword) const
{
return IsTextControl(aExcludePassword) || GetType() == NS_FORM_INPUT_NUMBER;
}
bool
nsIFormControl::IsSingleLineTextControl(bool aExcludePassword) const
{

View File

@ -47,11 +47,11 @@ function testSteps()
{ dbName: "dbL", dbVersion: 1 },
// This one lives in storage/default/1007+f+app+++system.gaiamobile.org
{ appId: 1007, inMozBrowser: false, url: "app://system.gaiamobile.org",
{ appId: 1007, inIsolatedMozBrowser: false, url: "app://system.gaiamobile.org",
dbName: "dbM", dbVersion: 1 },
// This one lives in storage/default/1007+t+https+++developer.cdn.mozilla.net
{ appId: 1007, inMozBrowser: true, url: "https://developer.cdn.mozilla.net",
{ appId: 1007, inIsolatedMozBrowser: true, url: "https://developer.cdn.mozilla.net",
dbName: "dbN", dbVersion: 1 },
// This one lives in storage/default/http+++127.0.0.1
@ -93,7 +93,7 @@ function testSteps()
let principal =
ssm.createCodebasePrincipal(uri,
{appId: params.appId || ssm.NO_APPID,
inBrowser: params.inMozBrowser});
inIsolatedMozBrowser: params.inIsolatedMozBrowser});
if ("dbVersion" in params) {
request = indexedDB.openForPrincipal(principal, params.dbName,
params.dbVersion);

View File

@ -151,7 +151,7 @@ this.Keyboard = {
}
} else {
// Ignore notifications that aren't from a BrowserOrApp
if (!frameLoader.ownerIsBrowserOrAppFrame) {
if (!frameLoader.ownerIsMozBrowserOrAppFrame) {
return;
}
this.initFormsFrameScript(mm);

View File

@ -92,7 +92,7 @@ function runTest() {
context: {
url: imeUrl,
originAttributes: {
inBrowser: true
inIsolatedMozBrowser: true
}
}
}], function() {

View File

@ -79,7 +79,7 @@ function runTest() {
context: {
url: imeUrl,
originAttributes: {
inBrowser: true
inIsolatedMozBrowser: true
}
}
}], function() {

View File

@ -142,7 +142,7 @@ function setupInputAppFrame() {
context: {
url: imeUrl,
originAttributes: {
inBrowser: true
inIsolatedMozBrowser: true
}
}
}], function() {

View File

@ -71,7 +71,7 @@ function setupInputAppFrame() {
context: {
url: imeUrl,
originAttributes: {
inBrowser: true
inIsolatedMozBrowser: true
}
}
}], function() {

Some files were not shown because too many files have changed in this diff Show More