Merge mozilla-central to fx-team

This commit is contained in:
Carsten "Tomcat" Book 2016-06-10 15:42:51 +02:00
Родитель cfae79fe6f 4ee1ed2b8f
Коммит 48d4127667
339 изменённых файлов: 6434 добавлений и 3563 удалений

Просмотреть файл

@ -1903,7 +1903,7 @@ HyperTextAccessible::RemoveChild(Accessible* aAccessible)
if (count > 0) if (count > 0)
mOffsets.RemoveElementsAt(childIndex, count); mOffsets.RemoveElementsAt(childIndex, count);
return Accessible::RemoveChild(aAccessible); return AccessibleWrap::RemoveChild(aAccessible);
} }
bool bool
@ -1913,7 +1913,7 @@ HyperTextAccessible::InsertChildAt(uint32_t aIndex, Accessible* aChild)
if (count > 0 ) { if (count > 0 ) {
mOffsets.RemoveElementsAt(aIndex, count); mOffsets.RemoveElementsAt(aIndex, count);
} }
return Accessible::InsertChildAt(aIndex, aChild); return AccessibleWrap::InsertChildAt(aIndex, aChild);
} }
Relation Relation

Просмотреть файл

@ -41,6 +41,8 @@ public:
void SetTopLevel() { mTopLevel = true; } void SetTopLevel() { mTopLevel = true; }
bool IsTopLevel() const { return mTopLevel; } bool IsTopLevel() const { return mTopLevel; }
bool IsShutdown() const { return mShutdown; }
/* /*
* Called when a message from a document in a child process notifies the main * Called when a message from a document in a child process notifies the main
* process it is firing an event. * process it is firing an event.

Просмотреть файл

@ -1185,7 +1185,6 @@ ProxyAccessible::OuterDocOfRemoteBrowser() const
return nullptr; return nullptr;
DocAccessible* chromeDoc = GetExistingDocAccessible(frame->OwnerDoc()); DocAccessible* chromeDoc = GetExistingDocAccessible(frame->OwnerDoc());
NS_ASSERTION(chromeDoc, "accessible tab in not accessible chromeDocument");
return chromeDoc ? chromeDoc->GetAccessible(frame) : nullptr; return chromeDoc ? chromeDoc->GetAccessible(frame) : nullptr;
} }

Просмотреть файл

@ -52,20 +52,6 @@ public: // construction, destruction
virtual nsresult HandleAccEvent(AccEvent* aEvent) override; virtual nsresult HandleAccEvent(AccEvent* aEvent) override;
/**
* Ignored means that the accessible might still have children, but is not
* displayed to the user. it also has no native accessible object represented
* for it.
*/
bool IsIgnored();
/**
* Returns this accessible's all children, adhering to "flat" accessibles by
* not returning their children.
*/
void GetUnignoredChildren(nsTArray<Accessible*>* aChildrenArray);
Accessible* GetUnignoredParent() const;
protected: protected:
/** /**

Просмотреть файл

@ -156,52 +156,6 @@ AccessibleWrap::RemoveChild(Accessible* aAccessible)
return removed; return removed;
} }
// if we for some reason have no native accessible, we should be skipped over (and traversed)
// when fetching all unignored children, etc. when counting unignored children, we will not be counted.
bool
AccessibleWrap::IsIgnored()
{
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_RETURN;
mozAccessible* nativeObject = GetNativeObject();
return (!nativeObject) || [nativeObject accessibilityIsIgnored];
NS_OBJC_END_TRY_ABORT_BLOCK_RETURN(false);
}
void
AccessibleWrap::GetUnignoredChildren(nsTArray<Accessible*>* aChildrenArray)
{
// we're flat; there are no children.
if (nsAccUtils::MustPrune(this))
return;
uint32_t childCount = ChildCount();
for (uint32_t childIdx = 0; childIdx < childCount; childIdx++) {
AccessibleWrap* childAcc =
static_cast<AccessibleWrap*>(GetChildAt(childIdx));
// If element is ignored, then add its children as substitutes.
if (childAcc->IsIgnored()) {
childAcc->GetUnignoredChildren(aChildrenArray);
continue;
}
aChildrenArray->AppendElement(childAcc);
}
}
Accessible*
AccessibleWrap::GetUnignoredParent() const
{
// Go up the chain to find a parent that is not ignored.
AccessibleWrap* parentWrap = static_cast<AccessibleWrap*>(Parent());
while (parentWrap && parentWrap->IsIgnored())
parentWrap = static_cast<AccessibleWrap*>(parentWrap->Parent());
return parentWrap;
}
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// AccessibleWrap protected // AccessibleWrap protected

Просмотреть файл

@ -8,6 +8,7 @@
#include "Platform.h" #include "Platform.h"
#include "ProxyAccessible.h" #include "ProxyAccessible.h"
#include "DocAccessibleParent.h"
#include "mozTableAccessible.h" #include "mozTableAccessible.h"
#include "nsAppShell.h" #include "nsAppShell.h"
@ -54,15 +55,57 @@ ProxyCreated(ProxyAccessible* aProxy, uint32_t)
uintptr_t accWrap = reinterpret_cast<uintptr_t>(aProxy) | IS_PROXY; uintptr_t accWrap = reinterpret_cast<uintptr_t>(aProxy) | IS_PROXY;
mozAccessible* mozWrapper = [[type alloc] initWithAccessible:accWrap]; mozAccessible* mozWrapper = [[type alloc] initWithAccessible:accWrap];
aProxy->SetWrapper(reinterpret_cast<uintptr_t>(mozWrapper)); aProxy->SetWrapper(reinterpret_cast<uintptr_t>(mozWrapper));
mozAccessible* nativeParent = nullptr;
if (aProxy->IsDoc() && aProxy->AsDoc()->IsTopLevel()) {
// If proxy is top level, the parent we need to invalidate the children of
// will be a non-remote accessible.
Accessible* outerDoc = aProxy->OuterDocOfRemoteBrowser();
if (outerDoc) {
nativeParent = GetNativeFromGeckoAccessible(outerDoc);
}
} else {
// Non-top level proxies need proxy parents' children invalidated.
ProxyAccessible* parent = aProxy->Parent();
nativeParent = GetNativeFromProxy(parent);
NS_ASSERTION(parent, "a non-top-level proxy is missing a parent?");
}
if (nativeParent) {
[nativeParent invalidateChildren];
}
} }
void void
ProxyDestroyed(ProxyAccessible* aProxy) ProxyDestroyed(ProxyAccessible* aProxy)
{ {
mozAccessible* nativeParent = nil;
if (aProxy->IsDoc() && aProxy->AsDoc()->IsTopLevel()) {
// Invalidate native parent in parent process's children on proxy destruction
Accessible* outerDoc = aProxy->OuterDocOfRemoteBrowser();
if (outerDoc) {
nativeParent = GetNativeFromGeckoAccessible(outerDoc);
}
} else {
if (!aProxy->Document()->IsShutdown()) {
// Only do if the document has not been shut down, else parent will return
// garbage since we don't shut down children from top down.
ProxyAccessible* parent = aProxy->Parent();
// Invalidate proxy parent's children.
if (parent) {
nativeParent = GetNativeFromProxy(parent);
}
}
}
mozAccessible* wrapper = GetNativeFromProxy(aProxy); mozAccessible* wrapper = GetNativeFromProxy(aProxy);
[wrapper expire]; [wrapper expire];
[wrapper release]; [wrapper release];
aProxy->SetWrapper(0); aProxy->SetWrapper(0);
if (nativeParent) {
[nativeParent invalidateChildren];
}
} }
void void

Просмотреть файл

@ -42,13 +42,6 @@ GetNativeFromProxy(const ProxyAccessible* aProxy)
return reinterpret_cast<mozAccessible*>(aProxy->GetWrapper()); return reinterpret_cast<mozAccessible*>(aProxy->GetWrapper());
} }
ProxyAccessible* GetProxyUnignoredParent(const ProxyAccessible* aProxy);
void GetProxyUnignoredChildren(const ProxyAccessible* aProxy,
nsTArray<ProxyAccessible*>* aChildrenArray);
BOOL IsProxyIgnored(const ProxyAccessible* aProxy);
} // a11y } // a11y
} // mozilla } // mozilla

Просмотреть файл

@ -19,6 +19,7 @@
#include "TableAccessible.h" #include "TableAccessible.h"
#include "TableCellAccessible.h" #include "TableCellAccessible.h"
#include "mozilla/a11y/PDocAccessible.h" #include "mozilla/a11y/PDocAccessible.h"
#include "OuterDocAccessible.h"
#include "mozilla/Services.h" #include "mozilla/Services.h"
#include "nsRect.h" #include "nsRect.h"
@ -48,76 +49,6 @@ using namespace mozilla::a11y;
// - NSAccessibilityMathPrescriptsAttribute @"AXMathPrescripts" // - NSAccessibilityMathPrescriptsAttribute @"AXMathPrescripts"
// - NSAccessibilityMathPostscriptsAttribute @"AXMathPostscripts" // - NSAccessibilityMathPostscriptsAttribute @"AXMathPostscripts"
// returns the passed in object if it is not ignored. if it's ignored, will return
// the first unignored ancestor.
static inline id
GetClosestInterestingAccessible(id anObject)
{
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
// this object is not ignored, so let's return it.
if (![anObject accessibilityIsIgnored])
return GetObjectOrRepresentedView(anObject);
// find the closest ancestor that is not ignored.
id unignoredObject = anObject;
while ((unignoredObject = [unignoredObject accessibilityAttributeValue:NSAccessibilityParentAttribute])) {
if (![unignoredObject accessibilityIsIgnored])
// object is not ignored, so let's stop the search.
break;
}
// if it's a mozAccessible, we need to take care to maybe return the view we
// represent, to the AT.
if ([unignoredObject respondsToSelector:@selector(hasRepresentedView)])
return GetObjectOrRepresentedView(unignoredObject);
return unignoredObject;
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
}
ProxyAccessible*
a11y::GetProxyUnignoredParent(const ProxyAccessible* aProxy)
{
ProxyAccessible* parent = aProxy->Parent();
while (parent && IsProxyIgnored(aProxy))
parent = parent->Parent();
return parent;
}
void
a11y::GetProxyUnignoredChildren(const ProxyAccessible* aProxy,
nsTArray<ProxyAccessible*>* aChildrenArray)
{
if (aProxy->MustPruneChildren())
return;
uint32_t childCount = aProxy->ChildrenCount();
for (size_t childIdx = 0; childIdx < childCount; childIdx++) {
ProxyAccessible* childProxy = aProxy->ChildAt(childIdx);
// If element is ignored, then add its children as substitutes.
if (IsProxyIgnored(childProxy)) {
GetProxyUnignoredChildren(childProxy, aChildrenArray);
continue;
}
aChildrenArray->AppendElement(childProxy);
}
}
BOOL
a11y::IsProxyIgnored(const ProxyAccessible* aProxy)
{
mozAccessible* nativeObject = GetNativeFromProxy(aProxy);
if (!nativeObject)
return true;
return [nativeObject accessibilityIsIgnored];
}
// convert an array of Gecko accessibles to an NSArray of native accessibles // convert an array of Gecko accessibles to an NSArray of native accessibles
static inline NSMutableArray* static inline NSMutableArray*
ConvertToNSArray(nsTArray<Accessible*>& aArray) ConvertToNSArray(nsTArray<Accessible*>& aArray)
@ -569,10 +500,10 @@ ConvertToNSArray(nsTArray<ProxyAccessible*>& aArray)
} }
if (nativeChild) if (nativeChild)
return GetClosestInterestingAccessible(nativeChild); return nativeChild;
// if we didn't find anything, return ourself (or the first unignored ancestor). // if we didn't find anything, return ourself or child view.
return GetClosestInterestingAccessible(self); return GetObjectOrRepresentedView(self);
} }
- (NSArray*)accessibilityActionNames - (NSArray*)accessibilityActionNames
@ -610,10 +541,10 @@ ConvertToNSArray(nsTArray<ProxyAccessible*>& aArray)
} }
if (focusedChild) if (focusedChild)
return GetClosestInterestingAccessible(focusedChild); return GetObjectOrRepresentedView(focusedChild);
// return ourself if we can't get a native focused child. // return ourself if we can't get a native focused child.
return GetClosestInterestingAccessible(self); return GetObjectOrRepresentedView(self);
} }
#pragma mark - #pragma mark -
@ -624,35 +555,32 @@ ConvertToNSArray(nsTArray<ProxyAccessible*>& aArray)
id nativeParent = nil; id nativeParent = nil;
if (AccessibleWrap* accWrap = [self getGeckoAccessible]) { if (AccessibleWrap* accWrap = [self getGeckoAccessible]) {
Accessible* accessibleParent = accWrap->GetUnignoredParent(); Accessible* accessibleParent = accWrap->Parent();
if (accessibleParent) if (accessibleParent)
nativeParent = GetNativeFromGeckoAccessible(accessibleParent); nativeParent = GetNativeFromGeckoAccessible(accessibleParent);
if (nativeParent) if (nativeParent)
return GetClosestInterestingAccessible(nativeParent); return GetObjectOrRepresentedView(nativeParent);
// GetUnignoredParent() returns null when there is no unignored accessible all the way up to
// the root accessible. so we'll have to return whatever native accessible is above our root accessible // Return native of root accessible if we have no direct parent
// (which might be the owning NSWindow in the application, for example).
//
// get the native root accessible, and tell it to return its first parent unignored accessible.
nativeParent = GetNativeFromGeckoAccessible(accWrap->RootAccessible()); nativeParent = GetNativeFromGeckoAccessible(accWrap->RootAccessible());
} else if (ProxyAccessible* proxy = [self getProxyAccessible]) { } else if (ProxyAccessible* proxy = [self getProxyAccessible]) {
// Go up the chain to find a parent that is not ignored. if (ProxyAccessible* proxyParent = proxy->Parent()) {
ProxyAccessible* accessibleParent = GetProxyUnignoredParent(proxy); nativeParent = GetNativeFromProxy(proxyParent);
if (accessibleParent) }
nativeParent = GetNativeFromProxy(accessibleParent);
if (nativeParent) if (nativeParent)
return GetClosestInterestingAccessible(nativeParent); return GetObjectOrRepresentedView(nativeParent);
Accessible* outerDoc = proxy->OuterDocOfRemoteBrowser(); Accessible* outerDoc = proxy->OuterDocOfRemoteBrowser();
nativeParent = outerDoc ? nativeParent = outerDoc ?
GetNativeFromGeckoAccessible(outerDoc->RootAccessible()) : nil; GetNativeFromGeckoAccessible(outerDoc) : nil;
} else { } else {
return nil; return nil;
} }
NSAssert1 (nativeParent, @"!!! we can't find a parent for %@", self); NSAssert1 (nativeParent, @"!!! we can't find a parent for %@", self);
return GetClosestInterestingAccessible(nativeParent); return GetObjectOrRepresentedView(nativeParent);
NS_OBJC_END_TRY_ABORT_BLOCK_NIL; NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
} }
@ -682,25 +610,35 @@ ConvertToNSArray(nsTArray<ProxyAccessible*>& aArray)
return mChildren; return mChildren;
// get the array of children. // get the array of children.
mChildren = [[NSMutableArray alloc] init];
AccessibleWrap* accWrap = [self getGeckoAccessible]; AccessibleWrap* accWrap = [self getGeckoAccessible];
if (accWrap) { if (accWrap) {
AutoTArray<Accessible*, 10> childrenArray; uint32_t childCount = accWrap->ChildCount();
accWrap->GetUnignoredChildren(&childrenArray); for (uint32_t childIdx = 0; childIdx < childCount; childIdx++) {
mChildren = ConvertToNSArray(childrenArray); mozAccessible* nativeChild = GetNativeFromGeckoAccessible(accWrap->GetChildAt(childIdx));
} else if (ProxyAccessible* proxy = [self getProxyAccessible]) { if (nativeChild)
AutoTArray<ProxyAccessible*, 10> childrenArray; [mChildren addObject:nativeChild];
GetProxyUnignoredChildren(proxy, &childrenArray); }
mChildren = ConvertToNSArray(childrenArray);
} // children from child if this is an outerdoc
OuterDocAccessible* docOwner = accWrap->AsOuterDoc();
if (docOwner) {
if (ProxyAccessible* proxyDoc = docOwner->RemoteChildDoc()) {
mozAccessible* nativeRemoteChild = GetNativeFromProxy(proxyDoc);
[mChildren insertObject:nativeRemoteChild atIndex:0];
NSAssert1 (nativeRemoteChild, @"%@ found a child remote doc missing a native\n", self);
}
}
} else if (ProxyAccessible* proxy = [self getProxyAccessible]) {
uint32_t childCount = proxy->ChildrenCount();
for (uint32_t childIdx = 0; childIdx < childCount; childIdx++) {
mozAccessible* nativeChild = GetNativeFromProxy(proxy->ChildAt(childIdx));
if (nativeChild)
[mChildren addObject:nativeChild];
}
#ifdef DEBUG_hakan
// make sure we're not returning any ignored accessibles.
NSEnumerator *e = [mChildren objectEnumerator];
mozAccessible *m = nil;
while ((m = [e nextObject])) {
NSAssert1(![m accessibilityIsIgnored], @"we should never return an ignored accessible! (%@)", m);
} }
#endif
return mChildren; return mChildren;
@ -1148,7 +1086,6 @@ struct RoleDescrComparator
#ifdef DEBUG_hakan #ifdef DEBUG_hakan
NSLog (@"%@ received focus!", self); NSLog (@"%@ received focus!", self);
#endif #endif
NSAssert1(![self accessibilityIsIgnored], @"trying to set focus to ignored element! (%@)", self);
NSAccessibilityPostNotification(GetObjectOrRepresentedView(self), NSAccessibilityPostNotification(GetObjectOrRepresentedView(self),
NSAccessibilityFocusedUIElementChangedNotification); NSAccessibilityFocusedUIElementChangedNotification);
@ -1198,7 +1135,7 @@ struct RoleDescrComparator
mozAccessible *curNative = GetNativeFromGeckoAccessible(aAccessible); mozAccessible *curNative = GetNativeFromGeckoAccessible(aAccessible);
if (curNative) if (curNative)
[mChildren addObject:GetObjectOrRepresentedView(curNative)]; [mChildren addObject:curNative];
} }
- (void)expire - (void)expire
@ -1229,7 +1166,6 @@ struct RoleDescrComparator
{ {
NS_OBJC_BEGIN_TRY_ABORT_BLOCK; NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
NSAssert(![self accessibilityIsIgnored], @"can't sanity check children of an ignored accessible!");
NSEnumerator *iter = [children objectEnumerator]; NSEnumerator *iter = [children objectEnumerator];
mozAccessible *curObj = nil; mozAccessible *curObj = nil;
@ -1282,8 +1218,7 @@ struct RoleDescrComparator
if (!children) if (!children)
return; return;
if (![self accessibilityIsIgnored]) [self sanityCheckChildren];
[self sanityCheckChildren];
NSEnumerator *iter = [children objectEnumerator]; NSEnumerator *iter = [children objectEnumerator];
mozAccessible *object = nil; mozAccessible *object = nil;

Просмотреть файл

@ -1290,11 +1290,21 @@ pref("media.gmp.decoder.h264", 2);
// decode H.264. // decode H.264.
pref("media.gmp.trial-create.enabled", true); pref("media.gmp.trial-create.enabled", true);
// Note: when media.gmp-*.visible is true, provided we're running on a
// supported platform/OS version, the corresponding CDM appears in the
// plugins list, Firefox will download the GMP/CDM if enabled, and our
// UI to re-enable EME prompts the user to re-enable EME if it's disabled
// and script requests EME. If *.visible is false, we won't show the UI
// to enable the CDM if its disabled; it's as if the keysystem is completely
// unsupported.
#ifdef MOZ_ADOBE_EME #ifdef MOZ_ADOBE_EME
pref("media.gmp-eme-adobe.visible", true);
pref("media.gmp-eme-adobe.enabled", true); pref("media.gmp-eme-adobe.enabled", true);
#endif #endif
#ifdef MOZ_WIDEVINE_EME #ifdef MOZ_WIDEVINE_EME
pref("media.gmp-widevinecdm.visible", true);
pref("media.gmp-widevinecdm.enabled", true); pref("media.gmp-widevinecdm.enabled", true);
#endif #endif

Просмотреть файл

@ -31,6 +31,20 @@ var gEMEHandler = {
} }
browser.reload(); browser.reload();
}, },
isKeySystemVisible: function(keySystem) {
if (!keySystem) {
return false;
}
if (keySystem.startsWith("com.adobe") &&
Services.prefs.getPrefType("media.gmp-eme-adobe.visible")) {
return Services.prefs.getBoolPref("media.gmp-eme-adobe.visible");
}
if (keySystem == "com.widevine.alpha" &&
Services.prefs.getPrefType("media.gmp-widevinecdm.visible")) {
return Services.prefs.getBoolPref("media.gmp-widevinecdm.visible");
}
return true;
},
getLearnMoreLink: function(msgId) { getLearnMoreLink: function(msgId) {
let text = gNavigatorBundle.getString("emeNotifications." + msgId + ".learnMoreLabel"); let text = gNavigatorBundle.getString("emeNotifications." + msgId + ".learnMoreLabel");
let baseURL = Services.urlFormatter.formatURLPref("app.support.baseURL"); let baseURL = Services.urlFormatter.formatURLPref("app.support.baseURL");
@ -46,8 +60,8 @@ var gEMEHandler = {
return; return;
} }
let {status: status, keySystem: keySystem} = parsedData; let {status: status, keySystem: keySystem} = parsedData;
// Don't need to show if disabled // Don't need to show if disabled or keysystem not visible.
if (!this.uiEnabled) { if (!this.uiEnabled || !this.isKeySystemVisible(keySystem)) {
return; return;
} }

Просмотреть файл

@ -4121,7 +4121,7 @@ function updateUserContextUIIndicator()
} }
let label = document.getElementById("userContext-label"); let label = document.getElementById("userContext-label");
label.value = ContextualIdentityService.getUserContextLabel(userContextId); label.setAttribute('value', ContextualIdentityService.getUserContextLabel(userContextId));
label.style.color = identity.color; label.style.color = identity.color;
let indicator = document.getElementById("userContext-indicator"); let indicator = document.getElementById("userContext-indicator");
@ -5540,6 +5540,12 @@ function handleLinkClick(event, href, linkNode) {
referrerURI: referrerURI, referrerURI: referrerURI,
referrerPolicy: referrerPolicy, referrerPolicy: referrerPolicy,
noReferrer: BrowserUtils.linkHasNoReferrer(linkNode) }; noReferrer: BrowserUtils.linkHasNoReferrer(linkNode) };
// The new tab/window must use the same userContextId
if (doc.nodePrincipal.originAttributes.userContextId) {
params.userContextId = doc.nodePrincipal.originAttributes.userContextId;
}
openLinkIn(href, where, params); openLinkIn(href, where, params);
event.preventDefault(); event.preventDefault();
return true; return true;

Просмотреть файл

@ -454,7 +454,8 @@ var ClickEventHandler = {
let json = { button: event.button, shiftKey: event.shiftKey, let json = { button: event.button, shiftKey: event.shiftKey,
ctrlKey: event.ctrlKey, metaKey: event.metaKey, ctrlKey: event.ctrlKey, metaKey: event.metaKey,
altKey: event.altKey, href: null, title: null, altKey: event.altKey, href: null, title: null,
bookmark: false, referrerPolicy: referrerPolicy }; bookmark: false, referrerPolicy: referrerPolicy,
originAttributes: principal ? principal.originAttributes : {} };
if (href) { if (href) {
try { try {

Просмотреть файл

@ -955,8 +955,17 @@ nsContextMenu.prototype = {
referrerURI: gContextMenuContentData.documentURIObject, referrerURI: gContextMenuContentData.documentURIObject,
referrerPolicy: gContextMenuContentData.referrerPolicy, referrerPolicy: gContextMenuContentData.referrerPolicy,
noReferrer: this.linkHasNoReferrer }; noReferrer: this.linkHasNoReferrer };
for (let p in extra) for (let p in extra) {
params[p] = extra[p]; params[p] = extra[p];
}
// If we want to change userContextId, we must be sure that we don't
// propagate the referrer.
if ("userContextId" in params &&
params.userContextId != this.principal.originAttributes.userContextId) {
params.noReferrer = true;
}
return params; return params;
}, },
@ -998,10 +1007,6 @@ nsContextMenu.prototype = {
userContextId: parseInt(event.target.getAttribute('usercontextid')) userContextId: parseInt(event.target.getAttribute('usercontextid'))
}; };
if (params.userContextId != this.principal.originAttributes.userContextId) {
params.noReferrer = true;
}
openLinkIn(this.linkURL, "tab", this._openLinkInParameters(params)); openLinkIn(this.linkURL, "tab", this._openLinkInParameters(params));
}, },

Просмотреть файл

@ -2617,8 +2617,7 @@
modifiedAttrs.push("soundplaying"); modifiedAttrs.push("soundplaying");
} }
if (aOtherTab.hasAttribute("usercontextid")) { if (aOtherTab.hasAttribute("usercontextid")) {
aOurTab.setAttribute("usercontextid", aOtherTab.getAttribute("usercontextid")); aOurTab.setUserContextId(aOtherTab.getAttribute("usercontextid"));
ContextualIdentityService.setTabStyle(aOurTab);
modifiedAttrs.push("usercontextid"); modifiedAttrs.push("usercontextid");
} }
@ -6425,12 +6424,18 @@
<body> <body>
<![CDATA[ <![CDATA[
if (aUserContextId) { if (aUserContextId) {
this.linkedBrowser.setAttribute("usercontextid", aUserContextId); if (this.linkedBrowser) {
this.linkedBrowser.setAttribute("usercontextid", aUserContextId);
}
this.setAttribute("usercontextid", aUserContextId); this.setAttribute("usercontextid", aUserContextId);
} else { } else {
this.linkedBrowser.removeAttribute("usercontextid"); if (this.linkedBrowser) {
this.linkedBrowser.removeAttribute("usercontextid");
}
this.removeAttribute("usercontextid"); this.removeAttribute("usercontextid");
} }
ContextualIdentityService.setTabStyle(this);
]]> ]]>
</body> </body>
</method> </method>

Просмотреть файл

@ -355,3 +355,53 @@ add_task(function* test_event_order() {
}); });
}); });
// This test checks select elements with a large number of options to ensure that
// the popup appears within the browser area.
add_task(function* test_large_popup() {
const pageUrl = "data:text/html," + escape(PAGECONTENT_SMALL);
let tab = yield BrowserTestUtils.openNewForegroundTab(gBrowser, pageUrl);
yield ContentTask.spawn(tab.linkedBrowser, null, function*() {
let doc = content.document;
let select = doc.getElementById("one");
for (var i = 0; i < 180; i++) {
select.add(new content.Option("Test" + i));
}
select.focus();
});
let selectPopup = document.getElementById("ContentSelectDropdown").menupopup;
let browserRect = tab.linkedBrowser.getBoundingClientRect();
let positions = [
"margin-top: 300px;",
"position: fixed; bottom: 100px;",
"width: 100%; height: 9999px;"
];
let position;
while (true) {
yield openSelectPopup(selectPopup, false);
let rect = selectPopup.getBoundingClientRect();
ok(rect.top >= browserRect.top, "Popup top position in within browser area");
ok(rect.bottom <= browserRect.bottom, "Popup bottom position in within browser area");
yield hideSelectPopup(selectPopup, false);
position = positions.shift();
if (!position) {
break;
}
let contentPainted = BrowserTestUtils.contentPainted(tab.linkedBrowser);
yield ContentTask.spawn(tab.linkedBrowser, position, function*(position) {
let select = content.document.getElementById("one");
select.setAttribute("style", position);
});
yield contentPainted;
}
yield BrowserTestUtils.removeTab(tab);
});

Просмотреть файл

@ -6,12 +6,21 @@ support-files =
head.js head.js
[browser_referrer_middle_click.js] [browser_referrer_middle_click.js]
[browser_referrer_middle_click_in_container.js]
[browser_referrer_open_link_in_private.js] [browser_referrer_open_link_in_private.js]
skip-if = os == 'linux' # Bug 1145199 skip-if = os == 'linux' # Bug 1145199
[browser_referrer_open_link_in_tab.js] [browser_referrer_open_link_in_tab.js]
skip-if = os == 'linux' # Bug 1144816 skip-if = os == 'linux' # Bug 1144816
[browser_referrer_open_link_in_tab_in_container.js]
skip-if = os == 'linux' # Bug 1144816
[browser_referrer_open_link_in_window.js] [browser_referrer_open_link_in_window.js]
skip-if = os == 'linux' # Bug 1145199 skip-if = os == 'linux' # Bug 1145199
[browser_referrer_open_link_in_window_in_container.js]
skip-if = os == 'linux' # Bug 1145199
[browser_referrer_simple_click.js] [browser_referrer_simple_click.js]
[browser_referrer_open_link_in_container_tab.js] [browser_referrer_open_link_in_container_tab.js]
skip-if = os == 'linux' # Bug 1144816 skip-if = os == 'linux' # Bug 1144816
[browser_referrer_open_link_in_container_tab2.js]
skip-if = os == 'linux' # Bug 1144816
[browser_referrer_open_link_in_container_tab3.js]
skip-if = os == 'linux' # Bug 1144816

Просмотреть файл

@ -0,0 +1,20 @@
// Tests referrer on middle-click navigation.
// Middle-clicks on the link, which opens it in a new tab, same container.
function startMiddleClickTestCase(aTestNumber) {
info("browser_referrer_middle_click: " +
getReferrerTestDescription(aTestNumber));
someTabLoaded(gTestWindow).then(function(aNewTab) {
gTestWindow.gBrowser.selectedTab = aNewTab;
checkReferrerAndStartNextTest(aTestNumber, null, aNewTab,
startMiddleClickTestCase,
{ userContextId: 3 });
});
clickTheLink(gTestWindow, "testlink", {button: 1});
}
function test() {
requestLongerTimeout(10); // slowwww shutdown on e10s
startReferrerTest(startMiddleClickTestCase, { userContextId: 3 });
}

Просмотреть файл

@ -23,18 +23,27 @@ function startNewTabTestCase(aTestNumber) {
}); });
let menu = gTestWindow.document.getElementById("context-openlinkinusercontext-menu"); let menu = gTestWindow.document.getElementById("context-openlinkinusercontext-menu");
let menupopup = menu.menupopup; let menupopup = menu.menupopup;
menu.addEventListener("popupshown", function onPopupShown() {
menu.removeEventListener("popupshown", onPopupShown);
is(menupopup.nodeType, Node.ELEMENT_NODE, "We have a menupopup.");
ok(menupopup.firstChild, "We have a first container entry.");
let firstContext = menupopup.firstChild;
is(firstContext.nodeType, Node.ELEMENT_NODE, "We have a first container entry.");
ok(firstContext.hasAttribute("usercontextid"), "We have a usercontextid value.");
aContextMenu.addEventListener("popuphidden", function onPopupHidden() {
aContextMenu.removeEventListener("popuphidden", onPopupHidden);
firstContext.doCommand();
});
aContextMenu.hidePopup();
});
menupopup.showPopup(); menupopup.showPopup();
is(menupopup.nodeType, Node.ELEMENT_NODE, "We have a menupopup.");
ok(menupopup.firstChild, "We have a first container entry.");
let firstContext = menupopup.firstChild;
is(firstContext.nodeType, Node.ELEMENT_NODE, "We have a first container entry.");
ok(firstContext.hasAttribute('usercontextid'), "We have a usercontextid value.");
firstContext.doCommand();
aContextMenu.hidePopup();
}); });
} }

Просмотреть файл

@ -0,0 +1,52 @@
// Tests referrer on context menu navigation - open link in new container tab.
// Selects "open link in new container tab" from the context menu.
// The test runs from a container ID 1.
// Output: we have the correct referrer policy applied.
function startNewTabTestCase(aTestNumber) {
info("browser_referrer_open_link_in_container_tab: " +
getReferrerTestDescription(aTestNumber));
contextMenuOpened(gTestWindow, "testlink").then(function(aContextMenu) {
someTabLoaded(gTestWindow).then(function(aNewTab) {
gTestWindow.gBrowser.selectedTab = aNewTab;
checkReferrerAndStartNextTest(aTestNumber, null, aNewTab,
startNewTabTestCase, { userContextId: 1 });
});
let menu = gTestWindow.document.getElementById("context-openlinkinusercontext-menu");
let menupopup = menu.menupopup;
menu.addEventListener("popupshown", function onPopupShown() {
menu.removeEventListener("popupshown", onPopupShown);
is(menupopup.nodeType, Node.ELEMENT_NODE, "We have a menupopup.");
ok(menupopup.firstChild, "We have a first container entry.");
let firstContext = menupopup.firstChild;
is(firstContext.nodeType, Node.ELEMENT_NODE, "We have a first container entry.");
ok(firstContext.hasAttribute("usercontextid"), "We have a usercontextid value.");
is("1", firstContext.getAttribute("usercontextid"), "We have the right usercontextid value.");
aContextMenu.addEventListener("popuphidden", function onPopupHidden() {
aContextMenu.removeEventListener("popuphidden", onPopupHidden);
firstContext.doCommand();
});
aContextMenu.hidePopup();
});
menupopup.showPopup();
});
}
function test() {
waitForExplicitFinish();
SpecialPowers.pushPrefEnv(
{set: [["privacy.userContext.enabled", true]]},
function() {
requestLongerTimeout(10); // slowwww shutdown on e10s
startReferrerTest(startNewTabTestCase, { userContextId: 1 });
});
}

Просмотреть файл

@ -0,0 +1,63 @@
// Tests referrer on context menu navigation - open link in new container tab.
// Selects "open link in new container tab" from the context menu.
// The test runs from a container ID 2.
// Output: we have no referrer.
function getReferrerTest(aTestNumber) {
let test = _referrerTests[aTestNumber];
if (test) {
// We want all the referrer tests to fail!
test.result = "";
}
return test;
}
function startNewTabTestCase(aTestNumber) {
info("browser_referrer_open_link_in_container_tab: " +
getReferrerTestDescription(aTestNumber));
contextMenuOpened(gTestWindow, "testlink").then(function(aContextMenu) {
someTabLoaded(gTestWindow).then(function(aNewTab) {
gTestWindow.gBrowser.selectedTab = aNewTab;
checkReferrerAndStartNextTest(aTestNumber, null, aNewTab,
startNewTabTestCase, { userContextId: 2 });
});
let menu = gTestWindow.document.getElementById("context-openlinkinusercontext-menu");
let menupopup = menu.menupopup;
menu.addEventListener("popupshown", function onPopupShown() {
menu.removeEventListener("popupshown", onPopupShown);
is(menupopup.nodeType, Node.ELEMENT_NODE, "We have a menupopup.");
ok(menupopup.firstChild, "We have a first container entry.");
let firstContext = menupopup.firstChild;
is(firstContext.nodeType, Node.ELEMENT_NODE, "We have a first container entry.");
ok(firstContext.hasAttribute("usercontextid"), "We have a usercontextid value.");
is("1", firstContext.getAttribute("usercontextid"), "We have the right usercontextid value.");
aContextMenu.addEventListener("popuphidden", function onPopupHidden() {
aContextMenu.removeEventListener("popuphidden", onPopupHidden);
firstContext.doCommand();
});
aContextMenu.hidePopup();
});
menupopup.showPopup();
});
}
function test() {
waitForExplicitFinish();
SpecialPowers.pushPrefEnv(
{set: [["privacy.userContext.enabled", true]]},
function() {
requestLongerTimeout(10); // slowwww shutdown on e10s
startReferrerTest(startNewTabTestCase, { userContextId: 2 });
});
}

Просмотреть файл

@ -0,0 +1,34 @@
// Tests referrer on context menu navigation - open link in new tab.
// Selects "open link in new tab" from the context menu.
// This test starts from a container tab. We don't want to propagate the
// referrer.
function getReferrerTest(aTestNumber) {
let test = _referrerTests[aTestNumber];
if (test) {
// We want all the referrer tests to fail!
test.result = "";
}
return test;
}
function startNewTabTestCase(aTestNumber) {
info("browser_referrer_open_link_in_tab: " +
getReferrerTestDescription(aTestNumber));
contextMenuOpened(gTestWindow, "testlink").then(function(aContextMenu) {
someTabLoaded(gTestWindow).then(function(aNewTab) {
gTestWindow.gBrowser.selectedTab = aNewTab;
checkReferrerAndStartNextTest(aTestNumber, null, aNewTab,
startNewTabTestCase,
{ userContextId: 4 });
});
doContextMenuCommand(gTestWindow, aContextMenu, "context-openlinkintab");
});
}
function test() {
requestLongerTimeout(10); // slowwww shutdown on e10s
startReferrerTest(startNewTabTestCase, { userContextId: 4 });
}

Просмотреть файл

@ -0,0 +1,26 @@
// Tests referrer on context menu navigation - open link in new window.
// Selects "open link in new window" from the context menu.
// This test runs from a container tab. The new tab/window will be loaded in
// the same container.
function startNewWindowTestCase(aTestNumber) {
info("browser_referrer_open_link_in_window: " +
getReferrerTestDescription(aTestNumber));
contextMenuOpened(gTestWindow, "testlink").then(function(aContextMenu) {
newWindowOpened().then(function(aNewWindow) {
someTabLoaded(aNewWindow).then(function() {
checkReferrerAndStartNextTest(aTestNumber, aNewWindow, null,
startNewWindowTestCase,
{ userContextId: 1 });
});
});
doContextMenuCommand(gTestWindow, aContextMenu, "context-openlink");
});
}
function test() {
requestLongerTimeout(10); // slowwww shutdown on e10s
startReferrerTest(startNewWindowTestCase, { userContextId: 1 });
}

Просмотреть файл

@ -195,7 +195,7 @@ function doContextMenuCommand(aWindow, aMenu, aItemId) {
* @return {Promise} * @return {Promise}
* @resolves When the source url for this test case is loaded. * @resolves When the source url for this test case is loaded.
*/ */
function referrerTestCaseLoaded(aTestNumber) { function referrerTestCaseLoaded(aTestNumber, aParams) {
let test = getReferrerTest(aTestNumber); let test = getReferrerTest(aTestNumber);
let server = rounds == 0 ? REFERRER_POLICYSERVER_URL : let server = rounds == 0 ? REFERRER_POLICYSERVER_URL :
REFERRER_POLICYSERVER_URL_ATTRIBUTE; REFERRER_POLICYSERVER_URL_ATTRIBUTE;
@ -204,7 +204,7 @@ function referrerTestCaseLoaded(aTestNumber) {
"&policy=" + escape(test.policy || "") + "&policy=" + escape(test.policy || "") +
"&rel=" + escape(test.rel || ""); "&rel=" + escape(test.rel || "");
var browser = gTestWindow.gBrowser; var browser = gTestWindow.gBrowser;
browser.selectedTab = browser.addTab(url); browser.selectedTab = browser.addTab(url, aParams);
return BrowserTestUtils.browserLoaded(browser.selectedBrowser); return BrowserTestUtils.browserLoaded(browser.selectedBrowser);
} }
@ -216,7 +216,7 @@ function referrerTestCaseLoaded(aTestNumber) {
* @param aStartTestCase The callback to start the next test, aTestNumber + 1. * @param aStartTestCase The callback to start the next test, aTestNumber + 1.
*/ */
function checkReferrerAndStartNextTest(aTestNumber, aNewWindow, aNewTab, function checkReferrerAndStartNextTest(aTestNumber, aNewWindow, aNewTab,
aStartTestCase) { aStartTestCase, aParams = {}) {
referrerResultExtracted(aNewWindow || gTestWindow).then(function(result) { referrerResultExtracted(aNewWindow || gTestWindow).then(function(result) {
// Compare the actual result against the expected one. // Compare the actual result against the expected one.
let test = getReferrerTest(aTestNumber); let test = getReferrerTest(aTestNumber);
@ -232,13 +232,13 @@ function checkReferrerAndStartNextTest(aTestNumber, aNewWindow, aNewTab,
// Move on to the next test. Or finish if we're done. // Move on to the next test. Or finish if we're done.
var nextTestNumber = aTestNumber + 1; var nextTestNumber = aTestNumber + 1;
if (getReferrerTest(nextTestNumber)) { if (getReferrerTest(nextTestNumber)) {
referrerTestCaseLoaded(nextTestNumber).then(function() { referrerTestCaseLoaded(nextTestNumber, aParams).then(function() {
aStartTestCase(nextTestNumber); aStartTestCase(nextTestNumber);
}); });
} else if (rounds == 0) { } else if (rounds == 0) {
nextTestNumber = 0; nextTestNumber = 0;
rounds = 1; rounds = 1;
referrerTestCaseLoaded(nextTestNumber).then(function() { referrerTestCaseLoaded(nextTestNumber, aParams).then(function() {
aStartTestCase(nextTestNumber); aStartTestCase(nextTestNumber);
}); });
} else { } else {
@ -253,7 +253,7 @@ function checkReferrerAndStartNextTest(aTestNumber, aNewWindow, aNewTab,
* the test number - 0, 1, 2... Needs to trigger the navigation from the source * the test number - 0, 1, 2... Needs to trigger the navigation from the source
* page, and call checkReferrerAndStartNextTest() when the target is loaded. * page, and call checkReferrerAndStartNextTest() when the target is loaded.
*/ */
function startReferrerTest(aStartTestCase) { function startReferrerTest(aStartTestCase, params = {}) {
waitForExplicitFinish(); waitForExplicitFinish();
// Open the window where we'll load the source URLs. // Open the window where we'll load the source URLs.
@ -264,7 +264,7 @@ function startReferrerTest(aStartTestCase) {
// Load and start the first test. // Load and start the first test.
delayedStartupFinished(gTestWindow).then(function() { delayedStartupFinished(gTestWindow).then(function() {
referrerTestCaseLoaded(0).then(function() { referrerTestCaseLoaded(0, params).then(function() {
aStartTestCase(0); aStartTestCase(0);
}); });
}); });

Просмотреть файл

@ -19,4 +19,5 @@ tags = openwindow
[browser_serviceworkers.js] [browser_serviceworkers.js]
[browser_broadcastchannel.js] [browser_broadcastchannel.js]
[browser_blobUrl.js] [browser_blobUrl.js]
[browser_middleClick.js]
[browser_imageCache.js] [browser_imageCache.js]

Просмотреть файл

@ -0,0 +1,41 @@
"use strict";
const BASE_ORIGIN = "http://example.com";
const URI = BASE_ORIGIN +
"/browser/browser/components/contextualidentity/test/browser/empty_file.html";
add_task(function* () {
info("Opening a new container tab...");
let tab = gBrowser.addTab(URI, { userContextId: 1 });
gBrowser.selectedTab = tab;
let browser = gBrowser.getBrowserForTab(tab);
yield BrowserTestUtils.browserLoaded(browser);
info("Create a HTMLAnchorElement...");
let position = yield ContentTask.spawn(browser, URI,
function(URI) {
let anchor = content.document.createElement("a");
anchor.setAttribute('id', 'clickMe');
anchor.setAttribute("href", URI);
anchor.appendChild(content.document.createTextNode("click me!"));
content.document.body.appendChild(anchor);
}
);
info("Synthesize a mouse click and wait for a new tab...");
let newTab = yield new Promise((resolve, reject) => {
gBrowser.tabContainer.addEventListener("TabOpen", function onTabOpen(openEvent) {
gBrowser.tabContainer.removeEventListener("TabOpen", onTabOpen);
resolve(openEvent.target);
})
BrowserTestUtils.synthesizeMouseAtCenter("#clickMe", { button: 1 }, browser);
});
is(newTab.getAttribute("usercontextid"), 1, "Correct UserContextId?");
yield BrowserTestUtils.removeTab(tab);
yield BrowserTestUtils.removeTab(newTab);
});

Просмотреть файл

@ -18,4 +18,7 @@ export MOZ_PACKAGE_JSSHELL=1
# Need this to prevent name conflicts with the normal nightly build packages # Need this to prevent name conflicts with the normal nightly build packages
export MOZ_PKG_SPECIAL=asan export MOZ_PKG_SPECIAL=asan
#upload symbols
MOZ_AUTOMATION_UPLOAD_SYMBOLS=1
. "$topsrcdir/build/mozconfig.common.override" . "$topsrcdir/build/mozconfig.common.override"

Просмотреть файл

@ -83,6 +83,11 @@ var ContentClick = {
noReferrer: json.noReferrer, noReferrer: json.noReferrer,
allowMixedContent: json.allowMixedContent }; allowMixedContent: json.allowMixedContent };
// The new tab/window must use the same userContextId.
if (json.originAttributes.userContextId) {
params.userContextId = json.originAttributes.userContextId;
}
window.openLinkIn(json.href, where, params); window.openLinkIn(json.href, where, params);
} }
}; };

Просмотреть файл

@ -15,7 +15,7 @@ def yasm_version(yasm):
yasm, '--version', yasm, '--version',
onerror=lambda: die('Failed to get yasm version.') onerror=lambda: die('Failed to get yasm version.')
).splitlines()[0].split()[1] ).splitlines()[0].split()[1]
return version return Version(version)
# Until we move all the yasm consumers out of old-configure. # Until we move all the yasm consumers out of old-configure.
# bug 1257904 # bug 1257904

Просмотреть файл

@ -52,12 +52,11 @@
fun:_cairo_xlib_surface_finish fun:_cairo_xlib_surface_finish
... ...
} }
# The three following leaks are deep in Gtk+3, and it doesn't seem we're doing # The following leak is deep in Gtk+3, and it doesn't seem we're doing
# anything wrong on our end with the container objects. Those suppressions # anything wrong on our end with the container objects. This suppression
# are purposefully verbose so as to avoid them catching actual leaks due to # is purposefully verbose so as to avoid catching actual leaks due to
# Gecko code. # Gecko code.
# Note: valgrind doesn't support more than 24 elements in a suppression stack, # Note: valgrind doesn't support more than 24 elements in a suppression stack.
# which explains why the second has an ellipsis above g_slice_alloc.
{ {
Bug 1187649 Bug 1187649
Memcheck:Leak Memcheck:Leak
@ -85,36 +84,11 @@
fun:_ZN13nsLookAndFeel4InitEv fun:_ZN13nsLookAndFeel4InitEv
... ...
} }
# set_color() in gtkstyle.c of GTK version 3.4.4 only can leak GdkRGBA
# allocations when the theme has transparent colors:
# https://git.gnome.org/browse/gtk+/tree/gtk/deprecated/gtkstyle.c?h=3.4.4#n676
{ {
Bug 1187649 Bug 1250704
Memcheck:Leak
match-leak-kinds: definite
...
fun:g_slice_alloc
fun:g_slice_copy
fun:boxed_proxy_lcopy_value
fun:gtk_style_context_get_valist
fun:gtk_style_context_get
fun:set_color
fun:gtk_style_update_from_context
fun:gtk_style_constructed
fun:g_object_newv
fun:g_object_new_valist
fun:g_object_new
fun:_gtk_style_new_for_path
fun:gtk_style_new
fun:gtk_widget_get_default_style
fun:gtk_widget_init
fun:g_type_create_instance
fun:g_object_constructor
fun:g_object_newv
fun:g_object_new
fun:gtk_accel_label_new
fun:_ZN13nsLookAndFeel4InitEv
...
}
{
Bug 1187649
Memcheck:Leak Memcheck:Leak
match-leak-kinds: definite match-leak-kinds: definite
fun:malloc fun:malloc
@ -130,8 +104,6 @@
fun:g_object_newv fun:g_object_newv
fun:g_object_new_valist fun:g_object_new_valist
fun:g_object_new fun:g_object_new
fun:gtk_widget_get_style
fun:_ZN13nsIconChannel4InitEP6nsIURI
... ...
} }
{ {

Просмотреть файл

@ -211,8 +211,8 @@
#include "nsIWebBrowserFind.h" #include "nsIWebBrowserFind.h"
#include "nsIWidget.h" #include "nsIWidget.h"
#include "mozilla/dom/EncodingUtils.h" #include "mozilla/dom/EncodingUtils.h"
#include "mozilla/dom/PerformanceNavigation.h"
#include "mozilla/dom/ScriptSettings.h" #include "mozilla/dom/ScriptSettings.h"
#include "nsPerformance.h"
#ifdef MOZ_TOOLKIT_SEARCH #ifdef MOZ_TOOLKIT_SEARCH
#include "nsIBrowserSearchService.h" #include "nsIBrowserSearchService.h"

Просмотреть файл

@ -0,0 +1,17 @@
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>Test marquee attribute event handlers in iframe sandbox</title>
</head>
<body>
<!-- Note that the width here is slightly longer than the contents, to make
sure we bounce and finish very quickly. -->
<marquee loop="2" width="145" behavior="alternate" truespeed scrolldelay="1"
onstart="parent.postMessage(window.name + ' marquee onstart', '*');"
onbounce="parent.postMessage(window.name + ' marquee onbounce', '*');"
onfinish="parent.postMessage(window.name + ' marquee onfinish', '*');">
Will bounce and finish
</marquee>
</body>
</html>

Просмотреть файл

@ -1,5 +1,6 @@
[DEFAULT] [DEFAULT]
support-files = support-files =
file_marquee_event_handlers.html
file_other_auxiliary_navigation_by_location.html file_other_auxiliary_navigation_by_location.html
file_our_auxiliary_navigation_by_location.html file_our_auxiliary_navigation_by_location.html
file_parent_navigation_by_location.html file_parent_navigation_by_location.html
@ -8,6 +9,7 @@ support-files =
file_top_navigation_by_location_exotic.html file_top_navigation_by_location_exotic.html
[test_child_navigation_by_location.html] [test_child_navigation_by_location.html]
[test_marquee_event_handlers.html]
[test_other_auxiliary_navigation_by_location.html] [test_other_auxiliary_navigation_by_location.html]
tags = openwindow tags = openwindow
skip-if = (buildapp == 'b2g' && toolkit != 'gonk') #bug 948948, NS_ERROR_FAILURE from nsWindowWatcher::GetPrompt skip-if = (buildapp == 'b2g' && toolkit != 'gonk') #bug 948948, NS_ERROR_FAILURE from nsWindowWatcher::GetPrompt

Просмотреть файл

@ -0,0 +1,95 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=1277475
html5 sandboxed iframe should not run marquee attribute event handlers without allow-scripts
-->
<head>
<meta charset="utf-8">
<title>Test for Bug 1277475 - html5 sandboxed iframe should not run marquee attribute event handlers without allow-scripts</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1277475">Mozilla Bug 1277475</a>
<p id="display"></p>
<div id="content">Tests for Bug 1277475</div>
<iframe id="if1" name="if1" src="file_marquee_event_handlers.html"
sandbox="allow-same-origin allow-forms allow-top-navigation allow-pointer-lock allow-orientation-lock allow-popups allow-modals allow-popups-to-escape-sandbox">
</iframe>
<iframe id="if2" name="if2" src="file_marquee_event_handlers.html"
sandbox="allow-scripts"></iframe>
<script>
SimpleTest.waitForExplicitFinish();
var expectedMessages = new Set();
var numberOfMessagesExpected = 4;
var unexpectedMessages = new Set();
window.onmessage = function (event) {
info(event.data + " message received");
if (event.data.startsWith("if2") || event.data == "if1 chaser") {
expectedMessages.add(event.data);
if (expectedMessages.size == numberOfMessagesExpected) {
checkRecievedMessages();
}
} else {
unexpectedMessages.add(event.data);
}
}
function checkRecievedMessages() {
// Check the expected messages explicitly as a cross-check.
ok(expectedMessages.has("if1 chaser"),
"if1 chaser message should have been received");
ok(expectedMessages.has("if2 marquee onstart"),
"if2 marquee onstart should have run in iframe sandbox with allow-scripts");
ok(expectedMessages.has("if2 marquee onbounce"),
"if2 marquee onbounce should have run in iframe sandbox with allow-scripts");
ok(expectedMessages.has("if2 marquee onfinish"),
"if2 marquee onfinish should have run in iframe sandbox with allow-scripts");
unexpectedMessages.forEach(
(v) => {
ok(false, v + " should NOT have run in iframe sandbox without allow-scripts")
}
);
SimpleTest.finish();
}
// If things are working properly the attribute event handlers won't run on
// the marquee in if1, so add our own capturing listeners on its window, so we
// know when they have fired. (These will run as we are not sandboxed.)
var if1FiredEvents = new Set();
var if1NumberOfEventsExpected = 3;
var if1Win = document.getElementById("if1").contentWindow;
if1Win.addEventListener("start", () => { checkMarqueeEvent("start"); }, true);
if1Win.addEventListener("bounce", () => { checkMarqueeEvent("bounce"); }, true);
if1Win.addEventListener("finish", () => { checkMarqueeEvent("finish"); }, true);
function checkMarqueeEvent(eventType) {
info("if1 event " + eventType + " fired");
if1FiredEvents.add(eventType);
if (if1FiredEvents.size == if1NumberOfEventsExpected) {
// Only send the chasing message after a tick of the event loop to allow
// event handlers on the marquee to process.
SimpleTest.executeSoon(sendChasingMessage);
}
}
function sendChasingMessage() {
// Add our own message listener to if1's window and echo back a chasing
// message to make sure that any messages from incorrectly run marquee
// attribute event handlers should have arrived before it.
if1Win.addEventListener("message",
(e) => { if1Win.parent.postMessage(e.data, "*"); });
if1Win.postMessage("if1 chaser", "*");
info("if1 chaser message sent");
}
</script>
</body>
</html>

Просмотреть файл

@ -5,10 +5,12 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "gfxPrefs.h" #include "gfxPrefs.h"
#include "mozilla/dom/Event.h"
#include "mozilla/EventForwards.h" #include "mozilla/EventForwards.h"
#include "mozilla/TextEventDispatcher.h" #include "mozilla/TextEventDispatcher.h"
#include "mozilla/TextEvents.h" #include "mozilla/TextEvents.h"
#include "mozilla/TextInputProcessor.h" #include "mozilla/TextInputProcessor.h"
#include "nsContentUtils.h"
#include "nsIDocShell.h" #include "nsIDocShell.h"
#include "nsIWidget.h" #include "nsIWidget.h"
#include "nsPIDOMWindow.h" #include "nsPIDOMWindow.h"

Просмотреть файл

@ -110,7 +110,6 @@ EXPORTS += [
'nsNameSpaceManager.h', 'nsNameSpaceManager.h',
'nsNodeInfoManager.h', 'nsNodeInfoManager.h',
'nsNodeUtils.h', 'nsNodeUtils.h',
'nsPerformance.h',
'nsPIDOMWindow.h', 'nsPIDOMWindow.h',
'nsPIDOMWindowInlines.h', 'nsPIDOMWindowInlines.h',
'nsPIWindowRoot.h', 'nsPIWindowRoot.h',
@ -190,12 +189,6 @@ EXPORTS.mozilla.dom += [
'NodeInfo.h', 'NodeInfo.h',
'NodeInfoInlines.h', 'NodeInfoInlines.h',
'NodeIterator.h', 'NodeIterator.h',
'PerformanceEntry.h',
'PerformanceMark.h',
'PerformanceMeasure.h',
'PerformanceObserver.h',
'PerformanceObserverEntryList.h',
'PerformanceResourceTiming.h',
'ProcessGlobal.h', 'ProcessGlobal.h',
'ResponsiveImageSelector.h', 'ResponsiveImageSelector.h',
'SameProcessMessageQueue.h', 'SameProcessMessageQueue.h',
@ -302,7 +295,6 @@ UNIFIED_SOURCES += [
'nsNodeInfoManager.cpp', 'nsNodeInfoManager.cpp',
'nsNodeUtils.cpp', 'nsNodeUtils.cpp',
'nsOpenURIInFrameParams.cpp', 'nsOpenURIInFrameParams.cpp',
'nsPerformance.cpp',
'nsPlainTextSerializer.cpp', 'nsPlainTextSerializer.cpp',
'nsPropertyTable.cpp', 'nsPropertyTable.cpp',
'nsQueryContentEventResult.cpp', 'nsQueryContentEventResult.cpp',
@ -331,12 +323,6 @@ UNIFIED_SOURCES += [
'nsXMLContentSerializer.cpp', 'nsXMLContentSerializer.cpp',
'nsXMLHttpRequest.cpp', 'nsXMLHttpRequest.cpp',
'nsXMLNameSpaceMap.cpp', 'nsXMLNameSpaceMap.cpp',
'PerformanceEntry.cpp',
'PerformanceMark.cpp',
'PerformanceMeasure.cpp',
'PerformanceObserver.cpp',
'PerformanceObserverEntryList.cpp',
'PerformanceResourceTiming.cpp',
'PostMessageEvent.cpp', 'PostMessageEvent.cpp',
'ProcessGlobal.cpp', 'ProcessGlobal.cpp',
'ResponsiveImageSelector.cpp', 'ResponsiveImageSelector.cpp',

Просмотреть файл

@ -7238,6 +7238,36 @@ nsContentUtils::CallOnAllRemoteChildren(nsPIDOMWindowOuter* aWindow,
} }
} }
struct UIStateChangeInfo {
UIStateChangeType mShowAccelerators;
UIStateChangeType mShowFocusRings;
UIStateChangeInfo(UIStateChangeType aShowAccelerators,
UIStateChangeType aShowFocusRings)
: mShowAccelerators(aShowAccelerators),
mShowFocusRings(aShowFocusRings)
{}
};
bool
SetKeyboardIndicatorsChild(TabParent* aParent, void* aArg)
{
UIStateChangeInfo* stateInfo = static_cast<UIStateChangeInfo*>(aArg);
Unused << aParent->SendSetKeyboardIndicators(stateInfo->mShowAccelerators,
stateInfo->mShowFocusRings);
return false;
}
void
nsContentUtils::SetKeyboardIndicatorsOnRemoteChildren(nsPIDOMWindowOuter* aWindow,
UIStateChangeType aShowAccelerators,
UIStateChangeType aShowFocusRings)
{
UIStateChangeInfo stateInfo(aShowAccelerators, aShowFocusRings);
CallOnAllRemoteChildren(aWindow, SetKeyboardIndicatorsChild,
(void *)&stateInfo);
}
void void
nsContentUtils::TransferablesToIPCTransferables(nsISupportsArray* aTransferables, nsContentUtils::TransferablesToIPCTransferables(nsISupportsArray* aTransferables,
nsTArray<IPCDataTransfer>& aIPC, nsTArray<IPCDataTransfer>& aIPC,

Просмотреть файл

@ -34,6 +34,7 @@
#include "mozilla/Logging.h" #include "mozilla/Logging.h"
#include "mozilla/NotNull.h" #include "mozilla/NotNull.h"
#include "nsIContentPolicy.h" #include "nsIContentPolicy.h"
#include "nsPIDOMWindow.h"
#if defined(XP_WIN) #if defined(XP_WIN)
// Undefine LoadImage to prevent naming conflict with Windows. // Undefine LoadImage to prevent naming conflict with Windows.
@ -2392,6 +2393,15 @@ public:
CallOnRemoteChildFunction aCallback, CallOnRemoteChildFunction aCallback,
void* aArg); void* aArg);
/*
* Call nsPIDOMWindow::SetKeyboardIndicators all all remote children. This is
* in here rather than nsGlobalWindow because TabParent indirectly includes
* Windows headers which aren't allowed there.
*/
static void SetKeyboardIndicatorsOnRemoteChildren(nsPIDOMWindowOuter* aWindow,
UIStateChangeType aShowAccelerators,
UIStateChangeType aShowFocusRings);
/** /**
* Given an nsIFile, attempts to read it into aString. * Given an nsIFile, attempts to read it into aString.
* *

Просмотреть файл

@ -5,12 +5,12 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsDOMNavigationTiming.h" #include "nsDOMNavigationTiming.h"
#include "nsPerformance.h"
#include "nsCOMPtr.h" #include "nsCOMPtr.h"
#include "nsContentUtils.h" #include "nsContentUtils.h"
#include "nsIScriptSecurityManager.h" #include "nsIScriptSecurityManager.h"
#include "prtime.h" #include "prtime.h"
#include "nsIURI.h" #include "nsIURI.h"
#include "mozilla/dom/PerformanceNavigation.h"
#include "mozilla/TimeStamp.h" #include "mozilla/TimeStamp.h"
nsDOMNavigationTiming::nsDOMNavigationTiming() nsDOMNavigationTiming::nsDOMNavigationTiming()

Просмотреть файл

@ -17,17 +17,6 @@ typedef unsigned long long DOMTimeMilliSec;
typedef double DOMHighResTimeStamp; typedef double DOMHighResTimeStamp;
typedef unsigned short nsDOMPerformanceNavigationType; typedef unsigned short nsDOMPerformanceNavigationType;
namespace mozilla {
namespace dom {
namespace PerformanceNavigation {
static const nsDOMPerformanceNavigationType TYPE_NAVIGATE = 0;
static const nsDOMPerformanceNavigationType TYPE_RELOAD = 1;
static const nsDOMPerformanceNavigationType TYPE_BACK_FORWARD = 2;
static const nsDOMPerformanceNavigationType TYPE_RESERVED = 255;
} // namespace PerformanceNavigation
} // namespace dom
} // namespace mozilla
class nsDOMNavigationTiming final class nsDOMNavigationTiming final
{ {
public: public:

Просмотреть файл

@ -8481,7 +8481,7 @@ nsDocument::IsScriptEnabled()
{ {
// If this document is sandboxed without 'allow-scripts' // If this document is sandboxed without 'allow-scripts'
// script is not enabled // script is not enabled
if (mSandboxFlags & SANDBOXED_SCRIPTS) { if (HasScriptsBlockedBySandbox()) {
return false; return false;
} }
@ -13223,6 +13223,12 @@ nsIDocument::SetPageUseCounter(UseCounter aUseCounter)
contentParent->SetChildDocumentUseCounter(aUseCounter); contentParent->SetChildDocumentUseCounter(aUseCounter);
} }
bool
nsIDocument::HasScriptsBlockedBySandbox()
{
return mSandboxFlags & SANDBOXED_SCRIPTS;
}
static bool static bool
MightBeAboutOrChromeScheme(nsIURI* aURI) MightBeAboutOrChromeScheme(nsIURI* aURI)
{ {

Просмотреть файл

@ -22,6 +22,7 @@
#include "nsIHTMLDocument.h" #include "nsIHTMLDocument.h"
#include "nsIDocShell.h" #include "nsIDocShell.h"
#include "nsIDocShellTreeOwner.h" #include "nsIDocShellTreeOwner.h"
#include "nsIFormControl.h"
#include "nsLayoutUtils.h" #include "nsLayoutUtils.h"
#include "nsIPresShell.h" #include "nsIPresShell.h"
#include "nsFrameTraversal.h" #include "nsFrameTraversal.h"
@ -46,6 +47,7 @@
#include "mozilla/ContentEvents.h" #include "mozilla/ContentEvents.h"
#include "mozilla/dom/Element.h" #include "mozilla/dom/Element.h"
#include "mozilla/dom/HTMLInputElement.h"
#include "mozilla/EventDispatcher.h" #include "mozilla/EventDispatcher.h"
#include "mozilla/EventStateManager.h" #include "mozilla/EventStateManager.h"
#include "mozilla/EventStates.h" #include "mozilla/EventStates.h"

Просмотреть файл

@ -3437,11 +3437,26 @@ nsFrameLoader::GetNewTabContext(MutableTabContext* aTabContext,
bool isPrivate = parentContext->UsePrivateBrowsing(); bool isPrivate = parentContext->UsePrivateBrowsing();
attrs.SyncAttributesWithPrivateBrowsing(isPrivate); attrs.SyncAttributesWithPrivateBrowsing(isPrivate);
UIStateChangeType showAccelerators = UIStateChangeType_NoChange;
UIStateChangeType showFocusRings = UIStateChangeType_NoChange;
nsIDocument* doc = mOwnerContent->OwnerDoc();
if (doc) {
nsCOMPtr<nsPIWindowRoot> root = nsContentUtils::GetWindowRoot(doc);
if (root) {
showAccelerators =
root->ShowAccelerators() ? UIStateChangeType_Set : UIStateChangeType_Clear;
showFocusRings =
root->ShowFocusRings() ? UIStateChangeType_Set : UIStateChangeType_Clear;
}
}
bool tabContextUpdated = bool tabContextUpdated =
aTabContext->SetTabContext(OwnerIsMozBrowserFrame(), aTabContext->SetTabContext(OwnerIsMozBrowserFrame(),
mIsPrerendered, mIsPrerendered,
ownApp, ownApp,
containingApp, containingApp,
showAccelerators,
showFocusRings,
attrs, attrs,
signedPkgOrigin, signedPkgOrigin,
presentationURLStr); presentationURLStr);

Просмотреть файл

@ -50,6 +50,7 @@
#include "nsXULAppAPI.h" #include "nsXULAppAPI.h"
#include "nsQueryObject.h" #include "nsQueryObject.h"
#include <algorithm> #include <algorithm>
#include "chrome/common/ipc_channel.h" // for IPC::Channel::kMaximumMessageSize
#ifdef MOZ_CRASHREPORTER #ifdef MOZ_CRASHREPORTER
#include "nsExceptionHandler.h" #include "nsExceptionHandler.h"
@ -703,13 +704,13 @@ nsFrameMessageManager::SendRpcMessage(const nsAString& aMessageName,
aRetval, false); aRetval, false);
} }
static void static bool
RecordMessageSize(size_t aDataLength, const nsAString& aMessageName) AllowMessage(size_t aDataLength, const nsAString& aMessageName)
{ {
static const size_t kMinTelemetryMessageSize = 8192; static const size_t kMinTelemetryMessageSize = 8192;
if (aDataLength < kMinTelemetryMessageSize) { if (aDataLength < kMinTelemetryMessageSize) {
return; return true;
} }
NS_ConvertUTF16toUTF8 messageName(aMessageName); NS_ConvertUTF16toUTF8 messageName(aMessageName);
@ -717,6 +718,19 @@ RecordMessageSize(size_t aDataLength, const nsAString& aMessageName)
Telemetry::Accumulate(Telemetry::MESSAGE_MANAGER_MESSAGE_SIZE2, messageName, Telemetry::Accumulate(Telemetry::MESSAGE_MANAGER_MESSAGE_SIZE2, messageName,
aDataLength); aDataLength);
// A message includes more than structured clone data, so subtract
// 20KB to make it more likely that a message within this bound won't
// result in an overly large IPC message.
static const size_t kMaxMessageSize = IPC::Channel::kMaximumMessageSize - 20 * 1024;
if (aDataLength < kMaxMessageSize) {
return true;
}
Telemetry::Accumulate(Telemetry::REJECTED_MESSAGE_MANAGER_MESSAGE,
messageName);
return false;
} }
nsresult nsresult
@ -746,7 +760,9 @@ nsFrameMessageManager::SendMessage(const nsAString& aMessageName,
return NS_ERROR_DOM_DATA_CLONE_ERR; return NS_ERROR_DOM_DATA_CLONE_ERR;
} }
RecordMessageSize(data.DataLength(), aMessageName); if (!AllowMessage(data.DataLength(), aMessageName)) {
return NS_ERROR_FAILURE;
}
JS::Rooted<JSObject*> objects(aCx); JS::Rooted<JSObject*> objects(aCx);
if (aArgc >= 3 && aObjects.isObject()) { if (aArgc >= 3 && aObjects.isObject()) {
@ -828,7 +844,9 @@ nsFrameMessageManager::DispatchAsyncMessage(const nsAString& aMessageName,
return NS_ERROR_DOM_DATA_CLONE_ERR; return NS_ERROR_DOM_DATA_CLONE_ERR;
} }
RecordMessageSize(data.DataLength(), aMessageName); if (!AllowMessage(data.DataLength(), aMessageName)) {
return NS_ERROR_FAILURE;
}
JS::Rooted<JSObject*> objects(aCx); JS::Rooted<JSObject*> objects(aCx);
if (aArgc >= 3 && aObjects.isObject()) { if (aArgc >= 3 && aObjects.isObject()) {

Просмотреть файл

@ -15,10 +15,10 @@
#include "nsContentSecurityManager.h" #include "nsContentSecurityManager.h"
#include "nsScreen.h" #include "nsScreen.h"
#include "nsHistory.h" #include "nsHistory.h"
#include "nsPerformance.h"
#include "nsDOMNavigationTiming.h" #include "nsDOMNavigationTiming.h"
#include "nsIDOMStorageManager.h" #include "nsIDOMStorageManager.h"
#include "mozilla/dom/DOMStorage.h" #include "mozilla/dom/DOMStorage.h"
#include "mozilla/dom/Performance.h"
#include "mozilla/dom/StorageEvent.h" #include "mozilla/dom/StorageEvent.h"
#include "mozilla/dom/StorageEventBinding.h" #include "mozilla/dom/StorageEventBinding.h"
#include "mozilla/IntegerPrintfMacros.h" #include "mozilla/IntegerPrintfMacros.h"
@ -1206,13 +1206,6 @@ nsGlobalWindow::nsGlobalWindow(nsGlobalWindow *aOuterWindow)
mCleanMessageManager(false), mCleanMessageManager(false),
mNeedsFocus(true), mNeedsFocus(true),
mHasFocus(false), mHasFocus(false),
#if defined(XP_MACOSX)
mShowAccelerators(false),
mShowFocusRings(false),
#else
mShowAccelerators(true),
mShowFocusRings(true),
#endif
mShowFocusRingForContent(false), mShowFocusRingForContent(false),
mFocusByKeyOccurred(false), mFocusByKeyOccurred(false),
mHasGamepad(false), mHasGamepad(false),
@ -1267,8 +1260,6 @@ nsGlobalWindow::nsGlobalWindow(nsGlobalWindow *aOuterWindow)
Preferences::AddStrongObserver(mObserver, "intl.accept_languages"); Preferences::AddStrongObserver(mObserver, "intl.accept_languages");
} }
InitializeShowFocusRings();
} else { } else {
// |this| is an outer window. Outer windows start out frozen and // |this| is an outer window. Outer windows start out frozen and
// remain frozen until they get an inner window, so freeze this // remain frozen until they get an inner window, so freeze this
@ -2820,10 +2811,10 @@ nsGlobalWindow::SetNewDocument(nsIDocument* aDocument,
currentInner->AsInner()->CreatePerformanceObjectIfNeeded(); currentInner->AsInner()->CreatePerformanceObjectIfNeeded();
if (currentInner->mPerformance) { if (currentInner->mPerformance) {
newInnerWindow->mPerformance = newInnerWindow->mPerformance =
new nsPerformance(newInnerWindow->AsInner(), Performance::CreateForMainThread(newInnerWindow->AsInner(),
currentInner->mPerformance->GetDOMTiming(), currentInner->mPerformance->GetDOMTiming(),
currentInner->mPerformance->GetChannel(), currentInner->mPerformance->GetChannel(),
currentInner->mPerformance->GetParentPerformance()); currentInner->mPerformance->GetParentPerformance());
} }
} }
@ -3841,7 +3832,7 @@ nsGlobalWindow::GetHistory(ErrorResult& aError)
return mHistory; return mHistory;
} }
nsPerformance* Performance*
nsPIDOMWindowInner::GetPerformance() nsPIDOMWindowInner::GetPerformance()
{ {
MOZ_ASSERT(IsInnerWindow()); MOZ_ASSERT(IsInnerWindow());
@ -3849,7 +3840,7 @@ nsPIDOMWindowInner::GetPerformance()
return mPerformance; return mPerformance;
} }
nsPerformance* Performance*
nsGlobalWindow::GetPerformance() nsGlobalWindow::GetPerformance()
{ {
return AsInner()->GetPerformance(); return AsInner()->GetPerformance();
@ -3874,7 +3865,7 @@ nsPIDOMWindowInner::CreatePerformanceObjectIfNeeded()
if (timing) { if (timing) {
// If we are dealing with an iframe, we will need the parent's performance // If we are dealing with an iframe, we will need the parent's performance
// object (so we can add the iframe as a resource of that page). // object (so we can add the iframe as a resource of that page).
nsPerformance* parentPerformance = nullptr; Performance* parentPerformance = nullptr;
nsCOMPtr<nsPIDOMWindowOuter> parentWindow = GetScriptableParentOrNull(); nsCOMPtr<nsPIDOMWindowOuter> parentWindow = GetScriptableParentOrNull();
if (parentWindow) { if (parentWindow) {
nsPIDOMWindowInner* parentInnerWindow = nullptr; nsPIDOMWindowInner* parentInnerWindow = nullptr;
@ -3886,7 +3877,8 @@ nsPIDOMWindowInner::CreatePerformanceObjectIfNeeded()
} }
} }
mPerformance = mPerformance =
new nsPerformance(this, timing, timedChannel, parentPerformance); Performance::CreateForMainThread(this, timing, timedChannel,
parentPerformance);
} }
} }
@ -10037,63 +10029,51 @@ nsGlobalWindow::GetFocusMethod()
return mFocusMethod; return mFocusMethod;
} }
void
nsGlobalWindow::InitializeShowFocusRings()
{
MOZ_ASSERT(IsInnerWindow());
// Initialize the focus ring state from the parent window. For root windows,
// there is no need to do this as SetKeyboardIndicators will propogate any
// non-default value to child windows.
nsPIDOMWindowOuter* root = GetPrivateRoot();
if (root && GetOuterWindow() != root) {
bool showAccelerators = false, showFocusRings = false;
root->GetKeyboardIndicators(&showAccelerators, &showFocusRings);
mShowFocusRings = showFocusRings;
}
}
bool bool
nsGlobalWindow::ShouldShowFocusRing() nsGlobalWindow::ShouldShowFocusRing()
{ {
FORWARD_TO_INNER(ShouldShowFocusRing, (), false); FORWARD_TO_INNER(ShouldShowFocusRing, (), false);
return mShowFocusRings || mShowFocusRingForContent || mFocusByKeyOccurred; if (mShowFocusRingForContent || mFocusByKeyOccurred) {
return true;
}
nsCOMPtr<nsPIWindowRoot> root = GetTopWindowRoot();
return root ? root->ShowFocusRings() : false;
} }
void void
nsGlobalWindow::SetKeyboardIndicators(UIStateChangeType aShowAccelerators, nsGlobalWindow::SetKeyboardIndicators(UIStateChangeType aShowAccelerators,
UIStateChangeType aShowFocusRings) UIStateChangeType aShowFocusRings)
{ {
FORWARD_TO_INNER_VOID(SetKeyboardIndicators, (aShowAccelerators, aShowFocusRings)); MOZ_ASSERT(IsOuterWindow());
nsPIDOMWindowOuter* piWin = GetPrivateRoot();
if (!piWin) {
return;
}
MOZ_ASSERT(piWin == AsOuter());
bool oldShouldShowFocusRing = ShouldShowFocusRing(); bool oldShouldShowFocusRing = ShouldShowFocusRing();
// only change the flags that have been modified // only change the flags that have been modified
if (aShowAccelerators != UIStateChangeType_NoChange) nsCOMPtr<nsPIWindowRoot> windowRoot = do_QueryInterface(mChromeEventHandler);
mShowAccelerators = aShowAccelerators == UIStateChangeType_Set; if (!windowRoot) {
if (aShowFocusRings != UIStateChangeType_NoChange) return;
mShowFocusRings = aShowFocusRings == UIStateChangeType_Set;
// propagate the indicators to child windows
nsCOMPtr<nsIDocShell> docShell = GetDocShell();
if (docShell) {
int32_t childCount = 0;
docShell->GetChildCount(&childCount);
for (int32_t i = 0; i < childCount; ++i) {
nsCOMPtr<nsIDocShellTreeItem> childShell;
docShell->GetChildAt(i, getter_AddRefs(childShell));
if (!childShell) {
continue;
}
if (nsCOMPtr<nsPIDOMWindowOuter> childWindow = childShell->GetWindow()) {
childWindow->SetKeyboardIndicators(aShowAccelerators, aShowFocusRings);
}
}
} }
if (aShowAccelerators != UIStateChangeType_NoChange) {
windowRoot->SetShowAccelerators(aShowAccelerators == UIStateChangeType_Set);
}
if (aShowFocusRings != UIStateChangeType_NoChange) {
windowRoot->SetShowFocusRings(aShowFocusRings == UIStateChangeType_Set);
}
nsContentUtils::SetKeyboardIndicatorsOnRemoteChildren(GetOuterWindow(),
aShowAccelerators,
aShowFocusRings);
bool newShouldShowFocusRing = ShouldShowFocusRing(); bool newShouldShowFocusRing = ShouldShowFocusRing();
if (mHasFocus && mFocusedNode && if (mHasFocus && mFocusedNode &&
oldShouldShowFocusRing != newShouldShowFocusRing && oldShouldShowFocusRing != newShouldShowFocusRing &&
@ -10107,16 +10087,6 @@ nsGlobalWindow::SetKeyboardIndicators(UIStateChangeType aShowAccelerators,
} }
} }
void
nsGlobalWindow::GetKeyboardIndicators(bool* aShowAccelerators,
bool* aShowFocusRings)
{
FORWARD_TO_INNER_VOID(GetKeyboardIndicators, (aShowAccelerators, aShowFocusRings));
*aShowAccelerators = mShowAccelerators;
*aShowFocusRings = mShowFocusRings;
}
bool bool
nsGlobalWindow::TakeFocus(bool aFocus, uint32_t aFocusMethod) nsGlobalWindow::TakeFocus(bool aFocus, uint32_t aFocusMethod)
{ {

Просмотреть файл

@ -1257,7 +1257,8 @@ public:
already_AddRefed<nsWindowRoot> GetWindowRootOuter(); already_AddRefed<nsWindowRoot> GetWindowRootOuter();
already_AddRefed<nsWindowRoot> GetWindowRoot(mozilla::ErrorResult& aError); already_AddRefed<nsWindowRoot> GetWindowRoot(mozilla::ErrorResult& aError);
nsPerformance* GetPerformance();
mozilla::dom::Performance* GetPerformance();
protected: protected:
// Web IDL helpers // Web IDL helpers
@ -1607,8 +1608,6 @@ public:
virtual void SetKeyboardIndicators(UIStateChangeType aShowAccelerators, virtual void SetKeyboardIndicators(UIStateChangeType aShowAccelerators,
UIStateChangeType aShowFocusRings) override; UIStateChangeType aShowFocusRings) override;
virtual void GetKeyboardIndicators(bool* aShowAccelerators,
bool* aShowFocusRings) override;
// Inner windows only. // Inner windows only.
void UpdateCanvasFocus(bool aFocusChanged, nsIContent* aNewContent); void UpdateCanvasFocus(bool aFocusChanged, nsIContent* aNewContent);
@ -1759,12 +1758,6 @@ protected:
bool mNeedsFocus : 1; bool mNeedsFocus : 1;
bool mHasFocus : 1; bool mHasFocus : 1;
// whether to show keyboard accelerators
bool mShowAccelerators : 1;
// whether to show focus rings
bool mShowFocusRings : 1;
// when true, show focus rings for the current focused content only. // when true, show focus rings for the current focused content only.
// This will be reset when another element is focused // This will be reset when another element is focused
bool mShowFocusRingForContent : 1; bool mShowFocusRingForContent : 1;

Просмотреть файл

@ -2758,6 +2758,8 @@ public:
return mUserHasInteracted; return mUserHasInteracted;
} }
bool HasScriptsBlockedBySandbox();
void ReportHasScrollLinkedEffect(); void ReportHasScrollLinkedEffect();
bool HasScrollLinkedEffect() const bool HasScrollLinkedEffect() const
{ {

Просмотреть файл

@ -27,6 +27,7 @@
#include "nsGlobalWindow.h" #include "nsGlobalWindow.h"
#include "mozilla/dom/BindingUtils.h" #include "mozilla/dom/BindingUtils.h"
#include "mozilla/dom/Date.h"
#include "mozilla/dom/Element.h" #include "mozilla/dom/Element.h"
#include "mozilla/dom/ScriptSettings.h" #include "mozilla/dom/ScriptSettings.h"

Просмотреть файл

@ -31,7 +31,6 @@ class nsIDocument;
class nsIIdleObserver; class nsIIdleObserver;
class nsIScriptTimeoutHandler; class nsIScriptTimeoutHandler;
class nsIURI; class nsIURI;
class nsPerformance;
class nsPIDOMWindowInner; class nsPIDOMWindowInner;
class nsPIDOMWindowOuter; class nsPIDOMWindowOuter;
class nsPIWindowRoot; class nsPIWindowRoot;
@ -44,6 +43,7 @@ namespace mozilla {
namespace dom { namespace dom {
class AudioContext; class AudioContext;
class Element; class Element;
class Performance;
class ServiceWorkerRegistrationMainThread; class ServiceWorkerRegistrationMainThread;
} // namespace dom } // namespace dom
namespace gfx { namespace gfx {
@ -67,7 +67,8 @@ enum UIStateChangeType
{ {
UIStateChangeType_NoChange, UIStateChangeType_NoChange,
UIStateChangeType_Set, UIStateChangeType_Set,
UIStateChangeType_Clear UIStateChangeType_Clear,
UIStateChangeType_Invalid // used for serialization only
}; };
enum class FullscreenReason enum class FullscreenReason
@ -410,12 +411,6 @@ public:
virtual void SetKeyboardIndicators(UIStateChangeType aShowAccelerators, virtual void SetKeyboardIndicators(UIStateChangeType aShowAccelerators,
UIStateChangeType aShowFocusRings) = 0; UIStateChangeType aShowFocusRings) = 0;
/**
* Get the keyboard indicator state for accelerators and focus rings.
*/
virtual void GetKeyboardIndicators(bool* aShowAccelerators,
bool* aShowFocusRings) = 0;
/** /**
* Indicates that the page in the window has been hidden. This is used to * Indicates that the page in the window has been hidden. This is used to
* reset the focus state. * reset the focus state.
@ -616,7 +611,7 @@ protected:
nsIDocShell* MOZ_NON_OWNING_REF mDocShell; // Weak Reference nsIDocShell* MOZ_NON_OWNING_REF mDocShell; // Weak Reference
// mPerformance is only used on inner windows. // mPerformance is only used on inner windows.
RefPtr<nsPerformance> mPerformance; RefPtr<mozilla::dom::Performance> mPerformance;
typedef nsRefPtrHashtable<nsStringHashKey, typedef nsRefPtrHashtable<nsStringHashKey,
mozilla::dom::ServiceWorkerRegistrationMainThread> mozilla::dom::ServiceWorkerRegistrationMainThread>
@ -746,7 +741,7 @@ public:
GetServiceWorkerRegistration(const nsAString& aScope); GetServiceWorkerRegistration(const nsAString& aScope);
void InvalidateServiceWorkerRegistration(const nsAString& aScope); void InvalidateServiceWorkerRegistration(const nsAString& aScope);
nsPerformance* GetPerformance(); mozilla::dom::Performance* GetPerformance();
bool HasMutationListeners(uint32_t aMutationEventType) const bool HasMutationListeners(uint32_t aMutationEventType) const
{ {

Просмотреть файл

@ -54,6 +54,11 @@ public:
// Enumerate all stored browsers that for which the weak reference is valid. // Enumerate all stored browsers that for which the weak reference is valid.
virtual void EnumerateBrowsers(BrowserEnumerator aEnumFunc, void* aArg) = 0; virtual void EnumerateBrowsers(BrowserEnumerator aEnumFunc, void* aArg) = 0;
virtual bool ShowAccelerators() = 0;
virtual bool ShowFocusRings() = 0;
virtual void SetShowAccelerators(bool aEnable) = 0;
virtual void SetShowFocusRings(bool aEnable) = 0;
}; };
NS_DEFINE_STATIC_IID_ACCESSOR(nsPIWindowRoot, NS_IWINDOWROOT_IID) NS_DEFINE_STATIC_IID_ACCESSOR(nsPIWindowRoot, NS_IWINDOWROOT_IID)

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -1,491 +0,0 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef nsPerformance_h___
#define nsPerformance_h___
#include "nsCOMPtr.h"
#include "nsAutoPtr.h"
#include "mozilla/Attributes.h"
#include "nsWrapperCache.h"
#include "nsDOMNavigationTiming.h"
#include "nsContentUtils.h"
#include "nsPIDOMWindow.h"
#include "js/TypeDecls.h"
#include "js/RootingAPI.h"
#include "mozilla/dom/BindingDeclarations.h"
#include "mozilla/DOMEventTargetHelper.h"
class nsITimedChannel;
class nsPerformance;
class nsIHttpChannel;
namespace mozilla {
class ErrorResult;
namespace dom {
class PerformanceEntry;
class PerformanceObserver;
} // namespace dom
} // namespace mozilla
// Script "performance.timing" object
class nsPerformanceTiming final : public nsWrapperCache
{
public:
typedef mozilla::TimeStamp TimeStamp;
/**
* @param aPerformance
* The performance object (the JS parent).
* This will allow access to "window.performance.timing" attribute for
* the navigation timing (can't be null).
* @param aChannel
* An nsITimedChannel used to gather all the networking timings by both
* the navigation timing and the resource timing (can't be null).
* @param aHttpChannel
* An nsIHttpChannel (the resource's http channel).
* This will be used by the resource timing cross-domain check
* algorithm.
* Argument is null for the navigation timing (navigation timing uses
* another algorithm for the cross-domain redirects).
* @param aZeroTime
* The offset that will be added to the timestamp of each event. This
* argument should be equal to performance.navigationStart for
* navigation timing and "0" for the resource timing.
*/
nsPerformanceTiming(nsPerformance* aPerformance,
nsITimedChannel* aChannel,
nsIHttpChannel* aHttpChannel,
DOMHighResTimeStamp aZeroTime);
NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(nsPerformanceTiming)
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(nsPerformanceTiming)
nsDOMNavigationTiming* GetDOMTiming() const;
nsPerformance* GetParentObject() const
{
return mPerformance;
}
/**
* @param aStamp
* The TimeStamp recorded for a specific event. This TimeStamp can
* be null.
* @return the duration of an event with a given TimeStamp, relative to the
* navigationStart TimeStamp (the moment the user landed on the
* page), if the given TimeStamp is valid. Otherwise, it will return
* the FetchStart timing value.
*/
inline DOMHighResTimeStamp TimeStampToDOMHighResOrFetchStart(TimeStamp aStamp)
{
return (!aStamp.IsNull())
? TimeStampToDOMHighRes(aStamp)
: FetchStartHighRes();
}
/**
* The nsITimedChannel records an absolute timestamp for each event.
* The nsDOMNavigationTiming will record the moment when the user landed on
* the page. This is a window.performance unique timestamp, so it can be used
* for all the events (navigation timing and resource timing events).
*
* The algorithm operates in 2 steps:
* 1. The first step is to subtract the two timestamps: the argument (the
* envet's timesramp) and the navigation start timestamp. This will result in
* a relative timestamp of the event (relative to the navigation start -
* window.performance.timing.navigationStart).
* 2. The second step is to add any required offset (the mZeroTime). For now,
* this offset value is either 0 (for the resource timing), or equal to
* "performance.navigationStart" (for navigation timing).
* For the resource timing, mZeroTime is set to 0, causing the result to be a
* relative time.
* For the navigation timing, mZeroTime is set to "performance.navigationStart"
* causing the result be an absolute time.
*
* @param aStamp
* The TimeStamp recorded for a specific event. This TimeStamp can't
* be null.
* @return number of milliseconds value as one of:
* - relative to the navigation start time, time the user has landed on the
* page
* - an absolute wall clock time since the unix epoch
*/
inline DOMHighResTimeStamp TimeStampToDOMHighRes(TimeStamp aStamp) const
{
MOZ_ASSERT(!aStamp.IsNull());
mozilla::TimeDuration duration =
aStamp - GetDOMTiming()->GetNavigationStartTimeStamp();
return duration.ToMilliseconds() + mZeroTime;
}
virtual JSObject* WrapObject(JSContext *cx, JS::Handle<JSObject*> aGivenProto) override;
// PerformanceNavigation WebIDL methods
DOMTimeMilliSec NavigationStart() const {
if (!nsContentUtils::IsPerformanceTimingEnabled()) {
return 0;
}
return GetDOMTiming()->GetNavigationStart();
}
DOMTimeMilliSec UnloadEventStart() {
if (!nsContentUtils::IsPerformanceTimingEnabled()) {
return 0;
}
return GetDOMTiming()->GetUnloadEventStart();
}
DOMTimeMilliSec UnloadEventEnd() {
if (!nsContentUtils::IsPerformanceTimingEnabled()) {
return 0;
}
return GetDOMTiming()->GetUnloadEventEnd();
}
uint16_t GetRedirectCount() const;
// Checks if the resource is either same origin as the page that started
// the load, or if the response contains the Timing-Allow-Origin header
// with a value of * or matching the domain of the loading Principal
bool CheckAllowedOrigin(nsIHttpChannel* aResourceChannel, nsITimedChannel* aChannel);
// Cached result of CheckAllowedOrigin. If false, security sensitive
// attributes of the resourceTiming object will be set to 0
bool TimingAllowed() const;
// If this is false the values of redirectStart/End will be 0
// This is false if no redirects occured, or if any of the responses failed
// the timing-allow-origin check in HttpBaseChannel::TimingAllowCheck
bool ShouldReportCrossOriginRedirect() const;
// High resolution (used by resource timing)
DOMHighResTimeStamp FetchStartHighRes();
DOMHighResTimeStamp RedirectStartHighRes();
DOMHighResTimeStamp RedirectEndHighRes();
DOMHighResTimeStamp DomainLookupStartHighRes();
DOMHighResTimeStamp DomainLookupEndHighRes();
DOMHighResTimeStamp ConnectStartHighRes();
DOMHighResTimeStamp ConnectEndHighRes();
DOMHighResTimeStamp RequestStartHighRes();
DOMHighResTimeStamp ResponseStartHighRes();
DOMHighResTimeStamp ResponseEndHighRes();
// Low resolution (used by navigation timing)
DOMTimeMilliSec FetchStart();
DOMTimeMilliSec RedirectStart();
DOMTimeMilliSec RedirectEnd();
DOMTimeMilliSec DomainLookupStart();
DOMTimeMilliSec DomainLookupEnd();
DOMTimeMilliSec ConnectStart();
DOMTimeMilliSec ConnectEnd();
DOMTimeMilliSec RequestStart();
DOMTimeMilliSec ResponseStart();
DOMTimeMilliSec ResponseEnd();
DOMTimeMilliSec DomLoading() {
if (!nsContentUtils::IsPerformanceTimingEnabled()) {
return 0;
}
return GetDOMTiming()->GetDomLoading();
}
DOMTimeMilliSec DomInteractive() const {
if (!nsContentUtils::IsPerformanceTimingEnabled()) {
return 0;
}
return GetDOMTiming()->GetDomInteractive();
}
DOMTimeMilliSec DomContentLoadedEventStart() const {
if (!nsContentUtils::IsPerformanceTimingEnabled()) {
return 0;
}
return GetDOMTiming()->GetDomContentLoadedEventStart();
}
DOMTimeMilliSec DomContentLoadedEventEnd() const {
if (!nsContentUtils::IsPerformanceTimingEnabled()) {
return 0;
}
return GetDOMTiming()->GetDomContentLoadedEventEnd();
}
DOMTimeMilliSec DomComplete() const {
if (!nsContentUtils::IsPerformanceTimingEnabled()) {
return 0;
}
return GetDOMTiming()->GetDomComplete();
}
DOMTimeMilliSec LoadEventStart() const {
if (!nsContentUtils::IsPerformanceTimingEnabled()) {
return 0;
}
return GetDOMTiming()->GetLoadEventStart();
}
DOMTimeMilliSec LoadEventEnd() const {
if (!nsContentUtils::IsPerformanceTimingEnabled()) {
return 0;
}
return GetDOMTiming()->GetLoadEventEnd();
}
private:
~nsPerformanceTiming();
bool IsInitialized() const;
void InitializeTimingInfo(nsITimedChannel* aChannel);
RefPtr<nsPerformance> mPerformance;
DOMHighResTimeStamp mFetchStart;
// This is an offset that will be added to each timing ([ms] resolution).
// There are only 2 possible values: (1) logicaly equal to navigationStart
// TimeStamp (results are absolute timstamps - wallclock); (2) "0" (results
// are relative to the navigation start).
DOMHighResTimeStamp mZeroTime;
TimeStamp mAsyncOpen;
TimeStamp mRedirectStart;
TimeStamp mRedirectEnd;
TimeStamp mDomainLookupStart;
TimeStamp mDomainLookupEnd;
TimeStamp mConnectStart;
TimeStamp mConnectEnd;
TimeStamp mRequestStart;
TimeStamp mResponseStart;
TimeStamp mCacheReadStart;
TimeStamp mResponseEnd;
TimeStamp mCacheReadEnd;
uint16_t mRedirectCount;
bool mTimingAllowed;
bool mAllRedirectsSameOrigin;
bool mInitialized;
// If the resourceTiming object should have non-zero redirectStart and
// redirectEnd attributes. It is false if there were no redirects, or if
// any of the responses didn't pass the timing-allow-check
bool mReportCrossOriginRedirect;
};
// Script "performance.navigation" object
class nsPerformanceNavigation final : public nsWrapperCache
{
public:
explicit nsPerformanceNavigation(nsPerformance* aPerformance);
NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(nsPerformanceNavigation)
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(nsPerformanceNavigation)
nsDOMNavigationTiming* GetDOMTiming() const;
nsPerformanceTiming* GetPerformanceTiming() const;
nsPerformance* GetParentObject() const
{
return mPerformance;
}
virtual JSObject* WrapObject(JSContext *cx, JS::Handle<JSObject*> aGivenProto) override;
// PerformanceNavigation WebIDL methods
uint16_t Type() const {
return GetDOMTiming()->GetType();
}
uint16_t RedirectCount() const {
return GetPerformanceTiming()->GetRedirectCount();
}
private:
~nsPerformanceNavigation();
RefPtr<nsPerformance> mPerformance;
};
// Base class for main-thread and worker Performance API
class PerformanceBase : public mozilla::DOMEventTargetHelper
{
public:
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(PerformanceBase,
DOMEventTargetHelper)
PerformanceBase();
explicit PerformanceBase(nsPIDOMWindowInner* aWindow);
typedef mozilla::dom::PerformanceEntry PerformanceEntry;
typedef mozilla::dom::PerformanceObserver PerformanceObserver;
void GetEntries(nsTArray<RefPtr<PerformanceEntry>>& aRetval);
void GetEntriesByType(const nsAString& aEntryType,
nsTArray<RefPtr<PerformanceEntry>>& aRetval);
void GetEntriesByName(const nsAString& aName,
const mozilla::dom::Optional<nsAString>& aEntryType,
nsTArray<RefPtr<PerformanceEntry>>& aRetval);
void ClearResourceTimings();
virtual DOMHighResTimeStamp Now() const = 0;
void Mark(const nsAString& aName, mozilla::ErrorResult& aRv);
void ClearMarks(const mozilla::dom::Optional<nsAString>& aName);
void Measure(const nsAString& aName,
const mozilla::dom::Optional<nsAString>& aStartMark,
const mozilla::dom::Optional<nsAString>& aEndMark,
mozilla::ErrorResult& aRv);
void ClearMeasures(const mozilla::dom::Optional<nsAString>& aName);
void SetResourceTimingBufferSize(uint64_t aMaxSize);
void AddObserver(PerformanceObserver* aObserver);
void RemoveObserver(PerformanceObserver* aObserver);
void NotifyObservers();
void CancelNotificationObservers();
protected:
virtual ~PerformanceBase();
virtual void InsertUserEntry(PerformanceEntry* aEntry);
void InsertResourceEntry(PerformanceEntry* aEntry);
void ClearUserEntries(const mozilla::dom::Optional<nsAString>& aEntryName,
const nsAString& aEntryType);
DOMHighResTimeStamp ResolveTimestampFromName(const nsAString& aName,
mozilla::ErrorResult& aRv);
virtual nsISupports* GetAsISupports() = 0;
virtual void DispatchBufferFullEvent() = 0;
virtual mozilla::TimeStamp CreationTimeStamp() const = 0;
virtual DOMHighResTimeStamp CreationTime() const = 0;
virtual bool IsPerformanceTimingAttribute(const nsAString& aName) = 0;
virtual DOMHighResTimeStamp
GetPerformanceTimingFromString(const nsAString& aTimingName) = 0;
bool IsResourceEntryLimitReached() const
{
return mResourceEntries.Length() >= mResourceTimingBufferSize;
}
void LogEntry(PerformanceEntry* aEntry, const nsACString& aOwner) const;
void TimingNotification(PerformanceEntry* aEntry, const nsACString& aOwner, uint64_t epoch);
void RunNotificationObserversTask();
void QueueEntry(PerformanceEntry* aEntry);
DOMHighResTimeStamp RoundTime(double aTime) const;
nsTObserverArray<PerformanceObserver*> mObservers;
private:
nsTArray<RefPtr<PerformanceEntry>> mUserEntries;
nsTArray<RefPtr<PerformanceEntry>> mResourceEntries;
uint64_t mResourceTimingBufferSize;
static const uint64_t kDefaultResourceTimingBufferSize = 150;
bool mPendingNotificationObserversTask;
};
// Script "performance" object
class nsPerformance final : public PerformanceBase
{
public:
nsPerformance(nsPIDOMWindowInner* aWindow,
nsDOMNavigationTiming* aDOMTiming,
nsITimedChannel* aChannel,
nsPerformance* aParentPerformance);
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_INHERITED(nsPerformance,
PerformanceBase)
static bool IsEnabled(JSContext* aCx, JSObject* aGlobal);
static bool IsObserverEnabled(JSContext* aCx, JSObject* aGlobal);
nsDOMNavigationTiming* GetDOMTiming() const
{
return mDOMTiming;
}
nsITimedChannel* GetChannel() const
{
return mChannel;
}
nsPerformance* GetParentPerformance() const
{
return mParentPerformance;
}
JSObject* WrapObject(JSContext *cx,
JS::Handle<JSObject*> aGivenProto) override;
// Performance WebIDL methods
DOMHighResTimeStamp Now() const override;
nsPerformanceTiming* Timing();
nsPerformanceNavigation* Navigation();
void AddEntry(nsIHttpChannel* channel,
nsITimedChannel* timedChannel);
using PerformanceBase::GetEntries;
using PerformanceBase::GetEntriesByType;
using PerformanceBase::GetEntriesByName;
using PerformanceBase::ClearResourceTimings;
using PerformanceBase::Mark;
using PerformanceBase::ClearMarks;
using PerformanceBase::Measure;
using PerformanceBase::ClearMeasures;
using PerformanceBase::SetResourceTimingBufferSize;
void GetMozMemory(JSContext *aCx, JS::MutableHandle<JSObject*> aObj);
IMPL_EVENT_HANDLER(resourcetimingbufferfull)
mozilla::TimeStamp CreationTimeStamp() const override;
DOMHighResTimeStamp CreationTime() const override;
protected:
~nsPerformance();
nsISupports* GetAsISupports() override
{
return this;
}
void InsertUserEntry(PerformanceEntry* aEntry) override;
bool IsPerformanceTimingAttribute(const nsAString& aName) override;
DOMHighResTimeStamp
GetPerformanceTimingFromString(const nsAString& aTimingName) override;
void DispatchBufferFullEvent() override;
RefPtr<nsDOMNavigationTiming> mDOMTiming;
nsCOMPtr<nsITimedChannel> mChannel;
RefPtr<nsPerformanceTiming> mTiming;
RefPtr<nsPerformanceNavigation> mNavigation;
RefPtr<nsPerformance> mParentPerformance;
JS::Heap<JSObject*> mMozMemory;
};
inline nsDOMNavigationTiming*
nsPerformanceNavigation::GetDOMTiming() const
{
return mPerformance->GetDOMTiming();
}
inline nsPerformanceTiming*
nsPerformanceNavigation::GetPerformanceTiming() const
{
return mPerformance->Timing();
}
inline nsDOMNavigationTiming*
nsPerformanceTiming::GetDOMTiming() const
{
return mPerformance->GetDOMTiming();
}
#endif /* nsPerformance_h___ */

Просмотреть файл

@ -6,6 +6,7 @@
#include "mozilla/dom/Event.h" // for nsIDOMEvent::InternalDOMEvent() #include "mozilla/dom/Event.h" // for nsIDOMEvent::InternalDOMEvent()
#include "mozilla/dom/ScreenBinding.h" #include "mozilla/dom/ScreenBinding.h"
#include "nsContentUtils.h"
#include "nsScreen.h" #include "nsScreen.h"
#include "nsIDocument.h" #include "nsIDocument.h"
#include "nsIDocShell.h" #include "nsIDocShell.h"

Просмотреть файл

@ -1046,7 +1046,7 @@ nsScriptLoader::StartLoad(nsScriptLoadRequest *aRequest, const nsAString &aType,
MOZ_ASSERT(aRequest->IsLoading()); MOZ_ASSERT(aRequest->IsLoading());
// If this document is sandboxed without 'allow-scripts', abort. // If this document is sandboxed without 'allow-scripts', abort.
if (mDocument->GetSandboxFlags() & SANDBOXED_SCRIPTS) { if (mDocument->HasScriptsBlockedBySandbox()) {
return NS_OK; return NS_OK;
} }
@ -1488,7 +1488,7 @@ nsScriptLoader::ProcessScriptElement(nsIScriptElement *aElement)
// inline script // inline script
// Is this document sandboxed without 'allow-scripts'? // Is this document sandboxed without 'allow-scripts'?
if (mDocument->GetSandboxFlags() & SANDBOXED_SCRIPTS) { if (mDocument->HasScriptsBlockedBySandbox()) {
return false; return false;
} }

Просмотреть файл

@ -13,6 +13,8 @@
#include "nsIChannelEventSink.h" #include "nsIChannelEventSink.h"
#include "nsIAsyncVerifyRedirectCallback.h" #include "nsIAsyncVerifyRedirectCallback.h"
#include "nsIInterfaceRequestor.h" #include "nsIInterfaceRequestor.h"
#include "nsIStreamListener.h"
#include "nsIURI.h"
#include "nsString.h" #include "nsString.h"
#include "nsWeakReference.h" #include "nsWeakReference.h"
#include "nsIDocument.h" #include "nsIDocument.h"

Просмотреть файл

@ -18,6 +18,7 @@
#include "nsPrintfCString.h" #include "nsPrintfCString.h"
#include "XPCJSMemoryReporter.h" #include "XPCJSMemoryReporter.h"
#include "js/MemoryMetrics.h" #include "js/MemoryMetrics.h"
#include "nsQueryObject.h"
#include "nsServiceManagerUtils.h" #include "nsServiceManagerUtils.h"
using namespace mozilla; using namespace mozilla;

Просмотреть файл

@ -7,6 +7,7 @@
#ifndef nsWindowMemoryReporter_h__ #ifndef nsWindowMemoryReporter_h__
#define nsWindowMemoryReporter_h__ #define nsWindowMemoryReporter_h__
#include "nsGlobalWindow.h"
#include "nsIMemoryReporter.h" #include "nsIMemoryReporter.h"
#include "nsIObserver.h" #include "nsIObserver.h"
#include "nsITimer.h" #include "nsITimer.h"

Просмотреть файл

@ -37,6 +37,15 @@ nsWindowRoot::nsWindowRoot(nsPIDOMWindowOuter* aWindow)
{ {
mWindow = aWindow; mWindow = aWindow;
MOZ_ASSERT(mWindow->IsOuterWindow()); MOZ_ASSERT(mWindow->IsOuterWindow());
// Keyboard indicators are not shown on Mac by default.
#if defined(XP_MACOSX)
mShowAccelerators = false;
mShowFocusRings = false;
#else
mShowAccelerators = true;
mShowFocusRings = true;
#endif
} }
nsWindowRoot::~nsWindowRoot() nsWindowRoot::~nsWindowRoot()

Просмотреть файл

@ -72,6 +72,26 @@ public:
virtual void RemoveBrowser(mozilla::dom::TabParent* aBrowser) override; virtual void RemoveBrowser(mozilla::dom::TabParent* aBrowser) override;
virtual void EnumerateBrowsers(BrowserEnumerator aEnumFunc, void *aArg) override; virtual void EnumerateBrowsers(BrowserEnumerator aEnumFunc, void *aArg) override;
virtual bool ShowAccelerators() override
{
return mShowAccelerators;
}
virtual bool ShowFocusRings() override
{
return mShowFocusRings;
}
virtual void SetShowAccelerators(bool aEnable) override
{
mShowAccelerators = aEnable;
}
virtual void SetShowFocusRings(bool aEnable) override
{
mShowFocusRings = aEnable;
}
protected: protected:
virtual ~nsWindowRoot(); virtual ~nsWindowRoot();
@ -86,6 +106,11 @@ protected:
RefPtr<mozilla::EventListenerManager> mListenerManager; // [Strong] RefPtr<mozilla::EventListenerManager> mListenerManager; // [Strong]
nsCOMPtr<nsIDOMNode> mPopupNode; // [OWNER] nsCOMPtr<nsIDOMNode> mPopupNode; // [OWNER]
// True if focus rings and accelerators are enabled for this
// window hierarchy.
bool mShowAccelerators;
bool mShowFocusRings;
nsCOMPtr<mozilla::dom::EventTarget> mParent; nsCOMPtr<mozilla::dom::EventTarget> mParent;
// The TabParents that are currently registered with this top-level window. // The TabParents that are currently registered with this top-level window.

Просмотреть файл

@ -995,7 +995,7 @@ nsXMLHttpRequest::GetResponse(JSContext* aCx,
} }
bool bool
nsXMLHttpRequest::IsCrossSiteCORSRequest() nsXMLHttpRequest::IsCrossSiteCORSRequest() const
{ {
if (!mChannel) { if (!mChannel) {
return false; return false;
@ -1197,10 +1197,10 @@ nsXMLHttpRequest::SlowAbort()
/*Method that checks if it is safe to expose a header value to the client. /*Method that checks if it is safe to expose a header value to the client.
It is used to check what headers are exposed for CORS requests.*/ It is used to check what headers are exposed for CORS requests.*/
bool bool
nsXMLHttpRequest::IsSafeHeader(const nsACString& header, nsIHttpChannel* httpChannel) nsXMLHttpRequest::IsSafeHeader(const nsACString& aHeader, NotNull<nsIHttpChannel*> aHttpChannel) const
{ {
// See bug #380418. Hide "Set-Cookie" headers from non-chrome scripts. // See bug #380418. Hide "Set-Cookie" headers from non-chrome scripts.
if (!IsSystemXHR() && nsContentUtils::IsForbiddenResponseHeader(header)) { if (!IsSystemXHR() && nsContentUtils::IsForbiddenResponseHeader(aHeader)) {
NS_WARNING("blocked access to response header"); NS_WARNING("blocked access to response header");
return false; return false;
} }
@ -1223,14 +1223,14 @@ nsXMLHttpRequest::IsSafeHeader(const nsACString& header, nsIHttpChannel* httpCha
"last-modified", "pragma" "last-modified", "pragma"
}; };
for (uint32_t i = 0; i < ArrayLength(kCrossOriginSafeHeaders); ++i) { for (uint32_t i = 0; i < ArrayLength(kCrossOriginSafeHeaders); ++i) {
if (header.LowerCaseEqualsASCII(kCrossOriginSafeHeaders[i])) { if (aHeader.LowerCaseEqualsASCII(kCrossOriginSafeHeaders[i])) {
return true; return true;
} }
} }
nsAutoCString headerVal; nsAutoCString headerVal;
// The "Access-Control-Expose-Headers" header contains a comma separated // The "Access-Control-Expose-Headers" header contains a comma separated
// list of method names. // list of method names.
httpChannel-> aHttpChannel->
GetResponseHeader(NS_LITERAL_CSTRING("Access-Control-Expose-Headers"), GetResponseHeader(NS_LITERAL_CSTRING("Access-Control-Expose-Headers"),
headerVal); headerVal);
nsCCharSeparatedTokenizer exposeTokens(headerVal, ','); nsCCharSeparatedTokenizer exposeTokens(headerVal, ',');
@ -1243,7 +1243,7 @@ nsXMLHttpRequest::IsSafeHeader(const nsACString& header, nsIHttpChannel* httpCha
if (!NS_IsValidHTTPToken(token)) { if (!NS_IsValidHTTPToken(token)) {
return false; return false;
} }
if (header.Equals(token, nsCaseInsensitiveCStringComparator())) { if (aHeader.Equals(token, nsCaseInsensitiveCStringComparator())) {
isSafe = true; isSafe = true;
} }
} }
@ -1264,7 +1264,8 @@ nsXMLHttpRequest::GetAllResponseHeaders(nsCString& aResponseHeaders)
} }
if (nsCOMPtr<nsIHttpChannel> httpChannel = GetCurrentHttpChannel()) { if (nsCOMPtr<nsIHttpChannel> httpChannel = GetCurrentHttpChannel()) {
RefPtr<nsHeaderVisitor> visitor = new nsHeaderVisitor(this, httpChannel); RefPtr<nsHeaderVisitor> visitor =
new nsHeaderVisitor(*this, WrapNotNull(httpChannel));
if (NS_SUCCEEDED(httpChannel->VisitResponseHeaders(visitor))) { if (NS_SUCCEEDED(httpChannel->VisitResponseHeaders(visitor))) {
aResponseHeaders = visitor->Headers(); aResponseHeaders = visitor->Headers();
} }
@ -1358,7 +1359,7 @@ nsXMLHttpRequest::GetResponseHeader(const nsACString& header,
} }
// Check for dangerous headers // Check for dangerous headers
if (!IsSafeHeader(header, httpChannel)) { if (!IsSafeHeader(header, WrapNotNull(httpChannel))) {
return; return;
} }
@ -1458,7 +1459,7 @@ nsXMLHttpRequest::GetCurrentJARChannel()
} }
bool bool
nsXMLHttpRequest::IsSystemXHR() nsXMLHttpRequest::IsSystemXHR() const
{ {
return mIsSystem || nsContentUtils::IsSystemPrincipal(mPrincipal); return mIsSystem || nsContentUtils::IsSystemPrincipal(mPrincipal);
} }
@ -3648,7 +3649,7 @@ NS_IMPL_ISUPPORTS(nsXMLHttpRequest::nsHeaderVisitor, nsIHttpHeaderVisitor)
NS_IMETHODIMP nsXMLHttpRequest:: NS_IMETHODIMP nsXMLHttpRequest::
nsHeaderVisitor::VisitHeader(const nsACString &header, const nsACString &value) nsHeaderVisitor::VisitHeader(const nsACString &header, const nsACString &value)
{ {
if (mXHR->IsSafeHeader(header, mHttpChannel)) { if (mXHR.IsSafeHeader(header, mHttpChannel)) {
mHeaders.Append(header); mHeaders.Append(header);
mHeaders.AppendLiteral(": "); mHeaders.AppendLiteral(": ");
mHeaders.Append(value); mHeaders.Append(value);

Просмотреть файл

@ -7,7 +7,6 @@
#ifndef nsXMLHttpRequest_h__ #ifndef nsXMLHttpRequest_h__
#define nsXMLHttpRequest_h__ #define nsXMLHttpRequest_h__
#include "mozilla/Attributes.h"
#include "nsIXMLHttpRequest.h" #include "nsIXMLHttpRequest.h"
#include "nsISupportsUtils.h" #include "nsISupportsUtils.h"
#include "nsString.h" #include "nsString.h"
@ -30,8 +29,10 @@
#include "nsIXPConnect.h" #include "nsIXPConnect.h"
#include "nsIInputStream.h" #include "nsIInputStream.h"
#include "mozilla/Assertions.h" #include "mozilla/Assertions.h"
#include "mozilla/Attributes.h"
#include "mozilla/DOMEventTargetHelper.h" #include "mozilla/DOMEventTargetHelper.h"
#include "mozilla/MemoryReporting.h" #include "mozilla/MemoryReporting.h"
#include "mozilla/NotNull.h"
#include "mozilla/dom/TypedArray.h" #include "mozilla/dom/TypedArray.h"
#include "mozilla/dom/XMLHttpRequestBinding.h" #include "mozilla/dom/XMLHttpRequestBinding.h"
@ -423,7 +424,7 @@ private:
return Send(Nullable<RequestBody>(aBody)); return Send(Nullable<RequestBody>(aBody));
} }
bool IsCrossSiteCORSRequest(); bool IsCrossSiteCORSRequest() const;
bool IsDeniedCrossSiteCORSRequest(); bool IsDeniedCrossSiteCORSRequest();
// Tell our channel what network interface ID we were told to use. // Tell our channel what network interface ID we were told to use.
@ -515,7 +516,8 @@ public:
} }
} }
void GetAllResponseHeaders(nsCString& aResponseHeaders); void GetAllResponseHeaders(nsCString& aResponseHeaders);
bool IsSafeHeader(const nsACString& aHeaderName, nsIHttpChannel* aHttpChannel); bool IsSafeHeader(const nsACString& aHeaderName,
mozilla::NotNull<nsIHttpChannel*> aHttpChannel) const;
void OverrideMimeType(const nsAString& aMimeType) void OverrideMimeType(const nsAString& aMimeType)
{ {
// XXX Should we do some validation here? // XXX Should we do some validation here?
@ -615,7 +617,7 @@ protected:
already_AddRefed<nsIHttpChannel> GetCurrentHttpChannel(); already_AddRefed<nsIHttpChannel> GetCurrentHttpChannel();
already_AddRefed<nsIJARChannel> GetCurrentJARChannel(); already_AddRefed<nsIJARChannel> GetCurrentJARChannel();
bool IsSystemXHR(); bool IsSystemXHR() const;
void ChangeStateToDone(); void ChangeStateToDone();
@ -643,15 +645,16 @@ protected:
public: public:
NS_DECL_ISUPPORTS NS_DECL_ISUPPORTS
NS_DECL_NSIHTTPHEADERVISITOR NS_DECL_NSIHTTPHEADERVISITOR
nsHeaderVisitor(nsXMLHttpRequest* aXMLHttpRequest, nsIHttpChannel* aHttpChannel) nsHeaderVisitor(const nsXMLHttpRequest& aXMLHttpRequest,
mozilla::NotNull<nsIHttpChannel*> aHttpChannel)
: mXHR(aXMLHttpRequest), mHttpChannel(aHttpChannel) {} : mXHR(aXMLHttpRequest), mHttpChannel(aHttpChannel) {}
const nsACString &Headers() { return mHeaders; } const nsACString &Headers() { return mHeaders; }
private: private:
virtual ~nsHeaderVisitor() {} virtual ~nsHeaderVisitor() {}
nsCString mHeaders; nsCString mHeaders;
nsXMLHttpRequest* mXHR; const nsXMLHttpRequest& mXHR;
nsCOMPtr<nsIHttpChannel> mHttpChannel; mozilla::NotNull<nsCOMPtr<nsIHttpChannel>> mHttpChannel;
}; };
// The bytes of our response body. Only used for DEFAULT, ARRAYBUFFER and // The bytes of our response body. Only used for DEFAULT, ARRAYBUFFER and

Просмотреть файл

@ -245,7 +245,6 @@ support-files =
wholeTexty-helper.xml wholeTexty-helper.xml
file_nonascii_blob_url.html file_nonascii_blob_url.html
referrerHelper.js referrerHelper.js
test_performance_user_timing.js
img_referrer_testserver.sjs img_referrer_testserver.sjs
file_audioLoop.html file_audioLoop.html
file_webaudioLoop.html file_webaudioLoop.html
@ -257,8 +256,6 @@ support-files =
referrer_testserver.sjs referrer_testserver.sjs
script_postmessages_fileList.js script_postmessages_fileList.js
iframe_postMessages.html iframe_postMessages.html
test_performance_observer.js
performance_observer.html
test_anonymousContent_style_csp.html^headers^ test_anonymousContent_style_csp.html^headers^
file_explicit_user_agent.sjs file_explicit_user_agent.sjs
referrer_change_server.sjs referrer_change_server.sjs
@ -797,8 +794,6 @@ skip-if = toolkit != 'gonk'
skip-if = toolkit != 'gonk' skip-if = toolkit != 'gonk'
[test_orientation_sandbox_no_lock.html] [test_orientation_sandbox_no_lock.html]
skip-if = toolkit != 'gonk' skip-if = toolkit != 'gonk'
[test_performance_observer.html]
[test_performance_user_timing.html]
[test_plugin_freezing.html] [test_plugin_freezing.html]
skip-if = buildapp == 'b2g' || toolkit == 'android' #CLICK_TO_PLAY skip-if = buildapp == 'b2g' || toolkit == 'android' #CLICK_TO_PLAY
[test_pluginAudioNotification.html] [test_pluginAudioNotification.html]

Просмотреть файл

@ -885,25 +885,6 @@ DOMInterfaces = {
'wrapperCache': False 'wrapperCache': False
}, },
'Performance': [{
'nativeType': 'nsPerformance',
},
{
'nativeType': 'mozilla::dom::workers::Performance',
'headerFile': 'mozilla/dom/workers/bindings/Performance.h',
'workers': True,
}],
'PerformanceTiming': {
'nativeType': 'nsPerformanceTiming',
'headerFile': 'nsPerformance.h'
},
'PerformanceNavigation': {
'nativeType': 'nsPerformanceNavigation',
'headerFile': 'nsPerformance.h'
},
'Plugin': { 'Plugin': {
'headerFile' : 'nsPluginArray.h', 'headerFile' : 'nsPluginArray.h',
'nativeType': 'nsPluginElement', 'nativeType': 'nsPluginElement',

Просмотреть файл

@ -1,70 +0,0 @@
<html>
<head>
</head>
<body>
<h1>This example is taken from <a href="https://schema.org/Recipe">https://schema.org/Recipe</a></h1>
<div itemscope itemtype="http://schema.org/Recipe">
<span itemprop="name">Mom's World Famous Banana Bread</span> By <span itemprop="author">John Smith</span>,
<meta itemprop="datePublished" content="2009-05-08">May 8, 2009
<img itemprop="image" src="bananabread.jpg" alt="Banana bread on a plate" />
<span itemprop="description">This classic banana bread recipe comes
from my mom -- the walnuts add a nice texture and flavor to the banana
bread.</span> Prep Time:
<meta itemprop="prepTime" content="PT15M">15 minutes Cook time:
<meta itemprop="cookTime" content="PT1H">1 hour Yield: <span itemprop="recipeYield">1 loaf</span>
<div itemprop="nutrition" itemscope itemtype="http://schema.org/NutritionInformation">
Nutrition facts:
<span itemprop="calories">240 calories</span>,
<span itemprop="fatContent">9 grams fat</span>
</div>
Ingredients: - <span itemprop="recipeIngredient">3 or 4 ripe bananas, smashed</span> - <span itemprop="recipeIngredient">1 egg</span> - <span itemprop="recipeIngredient">3/4 cup of sugar</span> ... Instructions:
<span itemprop="recipeInstructions">
Preheat the oven to 350 degrees. Mix in the ingredients in a bowl. Add
the flour last. Pour the mixture into a loaf pan and bake for one hour.
</span> 140 comments:
<div itemprop="interactionStatistic" itemscope itemtype="http://schema.org/InteractionCounter">
<meta itemprop="interactionType" content="http://schema.org/CommentAction" />
<meta itemprop="userInteractionCount" content="140" />
</div>
From Janel, May 5 -- thank you, great recipe! ...
</div>
<h1>This example is taken from <a href="https://schema.org/Book">https://schema.org/Book</a></h1>
<div itemscope itemtype="http://schema.org/Book">
<img itemprop="image" src="catcher-in-the-rye-book-cover.jpg" alt="cover art: red horse, city in background" />
<span itemprop="name">The Catcher in the Rye</span> -
<link itemprop="bookFormat" href="http://schema.org/Paperback">Mass Market Paperback by <a itemprop="author" href="/author/jd_salinger.html">J.D. Salinger</a>
<div itemprop="aggregateRating" itemscope itemtype="http://schema.org/AggregateRating">
<span itemprop="ratingValue">4</span> stars -
<span itemprop="reviewCount">3077</span> reviews
</div>
<div itemprop="offers" itemscope itemtype="http://schema.org/Offer">
Price: <span itemprop="price" content="6.99">$6.99</span>
<meta itemprop="priceCurrency" content="USD" />
<link itemprop="availability" href="http://schema.org/InStock">In Stock
</div>
Product details
<span itemprop="numberOfPages">224</span> pages Publisher: <span itemprop="publisher">Little, Brown, and Company</span> -
<meta itemprop="datePublished" content="1991-05-01">May 1, 1991 Language: <span itemprop="inLanguage">English</span> ISBN-10:
<span itemprop="isbn">0316769487</span> Reviews:
<div itemprop="review" itemscope itemtype="http://schema.org/Review">
<span itemprop="reviewRating">5</span> stars -
<b>"<span itemprop="name">A masterpiece of literature</span>"</b> by
<span itemprop="author">John Doe</span>, Written on
<meta itemprop="datePublished" content="2006-05-04">May 4, 2006
<span itemprop="reviewBody">I really enjoyed this book. It captures the essential
challenge people face as they try make sense of their lives and grow to adulthood.</span>
</div>
<div itemprop="review" itemscope itemtype="http://schema.org/Review">
<span itemprop="reviewRating">4</span> stars -
<b>"<span itemprop="name">A good read.</span>" </b> by <span itemprop="author">Bob Smith</span>, Written on
<meta itemprop="datePublished" content="2006-06-15">June 15, 2006
<span itemprop="reviewBody">Catcher in the Rye is a fun book. It's a good book to read.</span>
</div>
</div>
</body>
</html>

Просмотреть файл

@ -1,18 +0,0 @@
<html>
<head>
</head>
<body>
<h1>This example is taken from <a href="https://html.spec.whatwg.org/multipage/microdata.html">https://html.spec.whatwg.org/multipage/microdata.html</a>, and modified.</h1>
<div itemscope id="amanda" itemref="a b"></div>
<p id="a">Name: <span itemprop="name">Amanda</span></p>
<div id="b" itemprop="band" itemscope itemref="c"></div>
<div id="c">
<p>Band: <span itemprop="name">Jazz Band</span></p>
<p>Size: <span itemprop="size">12</span> players</p>
<span itemprop="cycle" itemscope itemref="b">This is an error.</span>
</div>
</body>
</html>

Просмотреть файл

@ -1,23 +0,0 @@
<html>
<head>
</head>
<body>
<h1>This example is taken from <a href="https://html.spec.whatwg.org/multipage/microdata.html">https://html.spec.whatwg.org/multipage/microdata.html</a></h1>
<figure itemscope itemtype="http://n.whatwg.org/work" itemref="licenses">
<img itemprop="work" src="images/house.jpeg" alt="A white house, boarded up, sits in a forest.">
<figcaption itemprop="title">The house I found.</figcaption>
</figure>
<figure itemscope itemtype="http://n.whatwg.org/work" itemref="licenses">
<img itemprop="work" src="images/mailbox.jpeg" alt="Outside the house is a mailbox. It has a leaflet inside.">
<figcaption itemprop="title">The mailbox.</figcaption>
</figure>
<footer>
<p id="licenses">All images licensed under the <a itemprop="license"
href="http://www.opensource.org/licenses/mit-license.php">MIT
license</a>.</p>
</footer>
</body>
</html>

Просмотреть файл

@ -1,50 +0,0 @@
<html>
<head>
<meta charset=utf-8>
</head>
<body>
<h1>This example is taken from <a href="http://microformats.org/wiki/hcard-examples">http://microformats.org/wiki/hcard-examples</a></h1>
<div class="vcard">
<span class="fn n">
<a class="url" href="http://t37.net">
<span class="given-name">Fréderic</span>
<span class="family-name">de Villamil</span>
</a>
</span>
<span class="nickname">neuro</span>
<a class="email" href="mailto:neuroNOSPAM@t37.net">
<span class="type">pref</span><span>erred email</span>
</a>
<span class="org">Omatis</span>
<span class="adr">
<abbr class="type" title="dom">France</abbr>
<span class="type">home</span> address
<abbr class="type" title="postal">mail</abbr> and
<abbr class="type" title="parcel">shipments</abbr>:
<span class="street-address">12 rue Danton</span>
<span class="locality">Le Kremlin-Bicetre</span>
<span class="postal-code">94270</span>
<span class="country-name">France</span>
</span>
<span class="geo">
<abbr class="latitude" title="48.816667">N 48° 81.6667</abbr>
<abbr class="longitude" title="2.366667">E 2° 36.6667</abbr>
</span>
</div>
<h1>This example is taken from <a href="http://microformats.org/wiki/hCalendar">http://microformats.org/wiki/hCalendar</a></h1>
<div class="vevent">
<a class="url" href="http://conferences.oreillynet.com/pub/w/40/program.html">
http://conferences.oreillynet.com/pub/w/40/program.html
</a>
<span class="summary">Web 2.0 Conference</span>:
<abbr class="dtstart" title="2005-10-05">October 5</abbr>-
<abbr class="dtend" title="2005-10-07">7</abbr>,
at the <span class="location">Argent Hotel, San Francisco, CA</span>
</div>
</body>
</html>

Просмотреть файл

@ -136,10 +136,6 @@ support-files =
file_focus.html file_focus.html
file_http_401_response.sjs file_http_401_response.sjs
file_http_407_response.sjs file_http_407_response.sjs
file_microdata.html
file_microdata_bad_itemref.html
file_microdata_itemref.html
file_microformats.html
file_post_request.html file_post_request.html
file_wyciwyg.html file_wyciwyg.html
file_audio.html file_audio.html

Просмотреть файл

@ -597,7 +597,9 @@ CreateGLWithEGL(const gl::SurfaceCaps& caps, gl::CreateContextFlags flags,
out_failReason->AppendLiteral("\n"); out_failReason->AppendLiteral("\n");
} }
out_failReason->AppendLiteral("Error during EGL OpenGL init."); out_failReason->AppendLiteral("Error during EGL OpenGL init.");
*out_failureId = "FEATURE_FAILURE_WEBGL_EGL_INIT"; if (out_failureId->IsEmpty()) {
*out_failureId = "FEATURE_FAILURE_WEBGL_EGL_INIT";
}
return nullptr; return nullptr;
} }
@ -621,7 +623,9 @@ CreateGLWithANGLE(const gl::SurfaceCaps& caps, gl::CreateContextFlags flags,
out_failReason->AppendLiteral("\n"); out_failReason->AppendLiteral("\n");
} }
out_failReason->AppendLiteral("Error during ANGLE OpenGL init."); out_failReason->AppendLiteral("Error during ANGLE OpenGL init.");
*out_failureId = "FEATURE_FAILURE_WEBGL_ANGLE_INIT"; if (out_failureId->IsEmpty()) {
*out_failureId = "FEATURE_FAILURE_WEBGL_ANGLE_INIT";
}
return nullptr; return nullptr;
} }
@ -659,7 +663,9 @@ CreateGLWithDefault(const gl::SurfaceCaps& caps, gl::CreateContextFlags flags,
out_failReason->AppendASCII("\n"); out_failReason->AppendASCII("\n");
} }
out_failReason->AppendASCII("Error during native OpenGL init."); out_failReason->AppendASCII("Error during native OpenGL init.");
*out_failureId = "FEATURE_FAILURE_WEBGL_DEFAULT_INIT"; if (out_failureId->IsEmpty()) {
*out_failureId = "FEATURE_FAILURE_WEBGL_DEFAULT_INIT";
}
return nullptr; return nullptr;
} }

Просмотреть файл

@ -11,6 +11,7 @@
#include "mozilla/dom/Exceptions.h" #include "mozilla/dom/Exceptions.h"
#include "mozilla/dom/File.h" #include "mozilla/dom/File.h"
#include "mozilla/dom/FunctionBinding.h" #include "mozilla/dom/FunctionBinding.h"
#include "mozilla/dom/Performance.h"
#include "mozilla/dom/StructuredCloneHolder.h" #include "mozilla/dom/StructuredCloneHolder.h"
#include "mozilla/dom/ToJSValue.h" #include "mozilla/dom/ToJSValue.h"
#include "mozilla/Maybe.h" #include "mozilla/Maybe.h"
@ -20,7 +21,6 @@
#include "nsGlobalWindow.h" #include "nsGlobalWindow.h"
#include "nsJSUtils.h" #include "nsJSUtils.h"
#include "nsNetUtil.h" #include "nsNetUtil.h"
#include "nsPerformance.h"
#include "ScriptSettings.h" #include "ScriptSettings.h"
#include "WorkerPrivate.h" #include "WorkerPrivate.h"
#include "WorkerRunnable.h" #include "WorkerRunnable.h"
@ -1355,7 +1355,7 @@ Console::MethodInternal(JSContext* aCx, MethodName aMethodName,
nsGlobalWindow *win = nsGlobalWindow::Cast(mWindow); nsGlobalWindow *win = nsGlobalWindow::Cast(mWindow);
MOZ_ASSERT(win); MOZ_ASSERT(win);
RefPtr<nsPerformance> performance = win->GetPerformance(); RefPtr<Performance> performance = win->GetPerformance();
if (!performance) { if (!performance) {
return; return;
} }

Просмотреть файл

@ -13,6 +13,7 @@
#include "mozilla/DOMEventTargetHelper.h" #include "mozilla/DOMEventTargetHelper.h"
#include "mozilla/EventStateManager.h" #include "mozilla/EventStateManager.h"
#include "mozilla/InternalMutationEvent.h" #include "mozilla/InternalMutationEvent.h"
#include "mozilla/dom/Performance.h"
#include "mozilla/MiscEvents.h" #include "mozilla/MiscEvents.h"
#include "mozilla/MouseEvents.h" #include "mozilla/MouseEvents.h"
#include "mozilla/Preferences.h" #include "mozilla/Preferences.h"
@ -30,7 +31,6 @@
#include "nsIScrollableFrame.h" #include "nsIScrollableFrame.h"
#include "nsJSEnvironment.h" #include "nsJSEnvironment.h"
#include "nsLayoutUtils.h" #include "nsLayoutUtils.h"
#include "nsPerformance.h"
#include "nsPIWindowRoot.h" #include "nsPIWindowRoot.h"
#include "WorkerPrivate.h" #include "WorkerPrivate.h"
@ -1096,7 +1096,8 @@ Event::TimeStamp() const
if (NS_WARN_IF(!win)) { if (NS_WARN_IF(!win)) {
return 0.0; return 0.0;
} }
nsPerformance* perf = win->GetPerformance();
Performance* perf = win->GetPerformance();
if (NS_WARN_IF(!perf)) { if (NS_WARN_IF(!perf)) {
return 0.0; return 0.0;
} }

Просмотреть файл

@ -830,7 +830,7 @@ EventListenerManager::SetEventHandler(nsIAtom* aName,
if (doc) { if (doc) {
// Don't allow adding an event listener if the document is sandboxed // Don't allow adding an event listener if the document is sandboxed
// without 'allow-scripts'. // without 'allow-scripts'.
if (doc->GetSandboxFlags() & SANDBOXED_SCRIPTS) { if (doc->HasScriptsBlockedBySandbox()) {
return NS_ERROR_DOM_SECURITY_ERR; return NS_ERROR_DOM_SECURITY_ERR;
} }

Просмотреть файл

@ -29,7 +29,7 @@ Gamepad::UpdateTimestamp()
{ {
nsCOMPtr<nsPIDOMWindowInner> newWindow(do_QueryInterface(mParent)); nsCOMPtr<nsPIDOMWindowInner> newWindow(do_QueryInterface(mParent));
if(newWindow) { if(newWindow) {
nsPerformance* perf = newWindow->GetPerformance(); Performance* perf = newWindow->GetPerformance();
if (perf) { if (perf) {
mTimestamp = perf->Now(); mTimestamp = perf->Now();
} }

Просмотреть файл

@ -10,12 +10,12 @@
#include "mozilla/ErrorResult.h" #include "mozilla/ErrorResult.h"
#include "mozilla/dom/GamepadBinding.h" #include "mozilla/dom/GamepadBinding.h"
#include "mozilla/dom/GamepadButton.h" #include "mozilla/dom/GamepadButton.h"
#include "mozilla/dom/Performance.h"
#include <stdint.h> #include <stdint.h>
#include "nsCOMPtr.h" #include "nsCOMPtr.h"
#include "nsString.h" #include "nsString.h"
#include "nsTArray.h" #include "nsTArray.h"
#include "nsWrapperCache.h" #include "nsWrapperCache.h"
#include "nsPerformance.h"
namespace mozilla { namespace mozilla {
namespace dom { namespace dom {

Просмотреть файл

@ -2015,7 +2015,10 @@ HTMLInputElement::SetWidth(uint32_t aWidth)
NS_IMETHODIMP NS_IMETHODIMP
HTMLInputElement::GetValue(nsAString& aValue) HTMLInputElement::GetValue(nsAString& aValue)
{ {
GetValueInternal(aValue); nsresult rv = GetValueInternal(aValue);
if (NS_FAILED(rv)) {
return rv;
}
// Don't return non-sanitized value for types that are experimental on mobile. // Don't return non-sanitized value for types that are experimental on mobile.
if (IsExperimentalMobileType(mType)) { if (IsExperimentalMobileType(mType)) {
@ -2032,8 +2035,8 @@ HTMLInputElement::GetValueInternal(nsAString& aValue) const
case VALUE_MODE_VALUE: case VALUE_MODE_VALUE:
if (IsSingleLineTextControl(false)) { if (IsSingleLineTextControl(false)) {
mInputData.mState->GetValue(aValue, true); mInputData.mState->GetValue(aValue, true);
} else { } else if (!aValue.Assign(mInputData.mValue, fallible)) {
aValue.Assign(mInputData.mValue); return NS_ERROR_OUT_OF_MEMORY;
} }
return NS_OK; return NS_OK;
@ -2169,6 +2172,15 @@ HTMLInputElement::GetValueAsDecimal() const
: decimalValue; : decimalValue;
} }
void
HTMLInputElement::GetValue(nsAString& aValue, ErrorResult& aRv)
{
nsresult rv = GetValue(aValue);
if (NS_FAILED(rv)) {
aRv.Throw(rv);
}
}
void void
HTMLInputElement::SetValue(const nsAString& aValue, ErrorResult& aRv) HTMLInputElement::SetValue(const nsAString& aValue, ErrorResult& aRv)
{ {
@ -6314,13 +6326,23 @@ HTMLInputElement::SaveState()
inputState = new HTMLInputElementState(); inputState = new HTMLInputElementState();
nsAutoString value; nsAutoString value;
GetValue(value); nsresult rv = GetValue(value);
DebugOnly<nsresult> rv = if (NS_FAILED(rv)) {
nsLinebreakConverter::ConvertStringLineBreaks( return rv;
value, }
nsLinebreakConverter::eLinebreakPlatform,
nsLinebreakConverter::eLinebreakContent); if (!IsSingleLineTextControl(false)) {
NS_ASSERTION(NS_SUCCEEDED(rv), "Converting linebreaks failed!"); rv = nsLinebreakConverter::ConvertStringLineBreaks(
value,
nsLinebreakConverter::eLinebreakPlatform,
nsLinebreakConverter::eLinebreakContent);
if (NS_FAILED(rv)) {
NS_ERROR("Converting linebreaks failed!");
return rv;
}
}
inputState->SetValue(value); inputState->SetValue(value);
break; break;
} }

Просмотреть файл

@ -632,7 +632,7 @@ public:
SetHTMLAttr(nsGkAtoms::value, aValue, aRv); SetHTMLAttr(nsGkAtoms::value, aValue, aRv);
} }
// XPCOM GetValue() is OK void GetValue(nsAString& aValue, ErrorResult& aRv);
void SetValue(const nsAString& aValue, ErrorResult& aRv); void SetValue(const nsAString& aValue, ErrorResult& aRv);
Nullable<Date> GetValueAsDate(ErrorResult& aRv); Nullable<Date> GetValueAsDate(ErrorResult& aRv);

Просмотреть файл

@ -1085,7 +1085,11 @@ HTMLTextAreaElement::SaveState()
value, value,
nsLinebreakConverter::eLinebreakPlatform, nsLinebreakConverter::eLinebreakPlatform,
nsLinebreakConverter::eLinebreakContent); nsLinebreakConverter::eLinebreakContent);
NS_ASSERTION(NS_SUCCEEDED(rv), "Converting linebreaks failed!");
if (NS_FAILED(rv)) {
NS_ERROR("Converting linebreaks failed!");
return rv;
}
nsCOMPtr<nsISupportsString> pState = nsCOMPtr<nsISupportsString> pState =
do_CreateInstance(NS_SUPPORTS_STRING_CONTRACTID); do_CreateInstance(NS_SUPPORTS_STRING_CONTRACTID);

Просмотреть файл

@ -28,7 +28,7 @@
#include "mozilla/Preferences.h" #include "mozilla/Preferences.h"
#include "mozilla/dom/WakeLock.h" #include "mozilla/dom/WakeLock.h"
#include "mozilla/dom/power/PowerManagerService.h" #include "mozilla/dom/power/PowerManagerService.h"
#include "nsPerformance.h" #include "mozilla/dom/Performance.h"
#include "mozilla/dom/VideoPlaybackQuality.h" #include "mozilla/dom/VideoPlaybackQuality.h"
NS_IMPL_NS_NEW_HTML_ELEMENT(Video) NS_IMPL_NS_NEW_HTML_ELEMENT(Video)
@ -235,7 +235,7 @@ HTMLVideoElement::GetVideoPlaybackQuality()
if (sVideoStatsEnabled) { if (sVideoStatsEnabled) {
if (nsPIDOMWindowInner* window = OwnerDoc()->GetInnerWindow()) { if (nsPIDOMWindowInner* window = OwnerDoc()->GetInnerWindow()) {
nsPerformance* perf = window->GetPerformance(); Performance* perf = window->GetPerformance();
if (perf) { if (perf) {
creationTime = perf->Now(); creationTime = perf->Now();
} }

Просмотреть файл

@ -1762,8 +1762,7 @@ ContentParent::ShutDownProcess(ShutDownMethod aMethod)
} }
// If Close() fails with an error, we'll end up back in this function, but // If Close() fails with an error, we'll end up back in this function, but
// with aMethod = CLOSE_CHANNEL_WITH_ERROR. It's important that we call // with aMethod = CLOSE_CHANNEL_WITH_ERROR.
// CloseWithError() in this case; see bug 895204.
if (aMethod == CLOSE_CHANNEL && !mCalledClose) { if (aMethod == CLOSE_CHANNEL && !mCalledClose) {
// Close() can only be called once: It kicks off the destruction // Close() can only be called once: It kicks off the destruction
@ -1779,14 +1778,6 @@ ContentParent::ShutDownProcess(ShutDownMethod aMethod)
#endif #endif
} }
if (aMethod == CLOSE_CHANNEL_WITH_ERROR && !mCalledCloseWithError) {
MessageChannel* channel = GetIPCChannel();
if (channel) {
mCalledCloseWithError = true;
channel->CloseWithError();
}
}
const ManagedContainer<POfflineCacheUpdateParent>& ocuParents = const ManagedContainer<POfflineCacheUpdateParent>& ocuParents =
ManagedPOfflineCacheUpdateParent(); ManagedPOfflineCacheUpdateParent();
for (auto iter = ocuParents.ConstIter(); !iter.Done(); iter.Next()) { for (auto iter = ocuParents.ConstIter(); !iter.Done(); iter.Next()) {
@ -2315,7 +2306,6 @@ ContentParent::InitializeMembers()
mMetamorphosed = false; mMetamorphosed = false;
mSendPermissionUpdates = false; mSendPermissionUpdates = false;
mCalledClose = false; mCalledClose = false;
mCalledCloseWithError = false;
mCalledKillHard = false; mCalledKillHard = false;
mCreatedPairedMinidumps = false; mCreatedPairedMinidumps = false;
mShutdownPending = false; mShutdownPending = false;

Просмотреть файл

@ -1168,10 +1168,9 @@ private:
bool mIsNuwaProcess; bool mIsNuwaProcess;
bool mHasGamepadListener; bool mHasGamepadListener;
// These variables track whether we've called Close(), CloseWithError() // These variables track whether we've called Close() and KillHard() on our
// and KillHard() on our channel. // channel.
bool mCalledClose; bool mCalledClose;
bool mCalledCloseWithError;
bool mCalledKillHard; bool mCalledKillHard;
bool mCreatedPairedMinidumps; bool mCreatedPairedMinidumps;
bool mShutdownPending; bool mShutdownPending;

Просмотреть файл

@ -593,6 +593,9 @@ child:
async ParentActivated(bool aActivated); async ParentActivated(bool aActivated);
async SetKeyboardIndicators(UIStateChangeType showAccelerators,
UIStateChangeType showFocusRings);
/** /**
* StopIMEStateManagement() is called when the process loses focus and * StopIMEStateManagement() is called when the process loses focus and
* should stop managing IME state. * should stop managing IME state.

Просмотреть файл

@ -7,6 +7,8 @@
include protocol PBrowser; include protocol PBrowser;
include PBrowserOrId; include PBrowserOrId;
using UIStateChangeType from "nsPIDOMWindow.h";
namespace mozilla { namespace mozilla {
namespace dom { namespace dom {
@ -55,6 +57,10 @@ struct FrameIPCTabContext
// This value would be empty if the TabContext isn't created for // This value would be empty if the TabContext isn't created for
// presented content. // presented content.
nsString presentationURL; nsString presentationURL;
// Keyboard indicator state inherited from the parent.
UIStateChangeType showAccelerators;
UIStateChangeType showFocusRings;
}; };
// XXXcatalinb: This is only used by ServiceWorkerClients::OpenWindow. // XXXcatalinb: This is only used by ServiceWorkerClients::OpenWindow.

Просмотреть файл

@ -854,6 +854,8 @@ TabChild::Init()
do_QueryInterface(window->GetChromeEventHandler()); do_QueryInterface(window->GetChromeEventHandler());
docShell->SetChromeEventHandler(chromeHandler); docShell->SetChromeEventHandler(chromeHandler);
window->SetKeyboardIndicators(ShowAccelerators(), ShowFocusRings());
// Set prerender flag if necessary. // Set prerender flag if necessary.
if (mIsPrerendered) { if (mIsPrerendered) {
docShell->SetIsPrerendered(); docShell->SetIsPrerendered();
@ -1860,6 +1862,16 @@ bool TabChild::RecvParentActivated(const bool& aActivated)
return true; return true;
} }
bool TabChild::RecvSetKeyboardIndicators(const UIStateChangeType& aShowAccelerators,
const UIStateChangeType& aShowFocusRings)
{
nsCOMPtr<nsPIDOMWindowOuter> window = do_GetInterface(WebNavigation());
NS_ENSURE_TRUE(window, true);
window->SetKeyboardIndicators(aShowAccelerators, aShowFocusRings);
return true;
}
bool bool
TabChild::RecvStopIMEStateManagement() TabChild::RecvStopIMEStateManagement()
{ {
@ -2912,7 +2924,6 @@ TabChild::EnableDisableCommands(const nsAString& aAction,
aEnabledCommands, aDisabledCommands); aEnabledCommands, aDisabledCommands);
} }
NS_IMETHODIMP NS_IMETHODIMP
TabChild::GetTabId(uint64_t* aId) TabChild::GetTabId(uint64_t* aId)
{ {

Просмотреть файл

@ -669,6 +669,9 @@ protected:
virtual bool RecvParentActivated(const bool& aActivated) override; virtual bool RecvParentActivated(const bool& aActivated) override;
virtual bool RecvSetKeyboardIndicators(const UIStateChangeType& aShowAccelerators,
const UIStateChangeType& aShowFocusRings) override;
virtual bool RecvStopIMEStateManagement() override; virtual bool RecvStopIMEStateManagement() override;
virtual bool RecvMenuKeyboardListenerInstalled( virtual bool RecvMenuKeyboardListenerInstalled(

Просмотреть файл

@ -26,6 +26,8 @@ TabContext::TabContext()
, mIsMozBrowserElement(false) , mIsMozBrowserElement(false)
, mContainingAppId(NO_APP_ID) , mContainingAppId(NO_APP_ID)
, mOriginAttributes() , mOriginAttributes()
, mShowAccelerators(UIStateChangeType_NoChange)
, mShowFocusRings(UIStateChangeType_NoChange)
{ {
} }
@ -203,11 +205,25 @@ TabContext::PresentationURL() const
return mPresentationURL; return mPresentationURL;
} }
UIStateChangeType
TabContext::ShowAccelerators() const
{
return mShowAccelerators;
}
UIStateChangeType
TabContext::ShowFocusRings() const
{
return mShowFocusRings;
}
bool bool
TabContext::SetTabContext(bool aIsMozBrowserElement, TabContext::SetTabContext(bool aIsMozBrowserElement,
bool aIsPrerendered, bool aIsPrerendered,
mozIApplication* aOwnApp, mozIApplication* aOwnApp,
mozIApplication* aAppFrameOwnerApp, mozIApplication* aAppFrameOwnerApp,
UIStateChangeType aShowAccelerators,
UIStateChangeType aShowFocusRings,
const DocShellOriginAttributes& aOriginAttributes, const DocShellOriginAttributes& aOriginAttributes,
const nsACString& aSignedPkgOriginNoSuffix, const nsACString& aSignedPkgOriginNoSuffix,
const nsAString& aPresentationURL) const nsAString& aPresentationURL)
@ -244,6 +260,8 @@ TabContext::SetTabContext(bool aIsMozBrowserElement,
mContainingApp = aAppFrameOwnerApp; mContainingApp = aAppFrameOwnerApp;
mSignedPkgOriginNoSuffix = aSignedPkgOriginNoSuffix; mSignedPkgOriginNoSuffix = aSignedPkgOriginNoSuffix;
mPresentationURL = aPresentationURL; mPresentationURL = aPresentationURL;
mShowAccelerators = aShowAccelerators;
mShowFocusRings = aShowFocusRings;
return true; return true;
} }
@ -257,7 +275,9 @@ TabContext::AsIPCTabContext() const
mSignedPkgOriginNoSuffix, mSignedPkgOriginNoSuffix,
mIsMozBrowserElement, mIsMozBrowserElement,
mIsPrerendered, mIsPrerendered,
mPresentationURL)); mPresentationURL,
mShowAccelerators,
mShowFocusRings));
} }
static already_AddRefed<mozIApplication> static already_AddRefed<mozIApplication>
@ -282,6 +302,8 @@ MaybeInvalidTabContext::MaybeInvalidTabContext(const IPCTabContext& aParams)
nsAutoCString originSuffix; nsAutoCString originSuffix;
nsAutoCString signedPkgOriginNoSuffix; nsAutoCString signedPkgOriginNoSuffix;
nsAutoString presentationURL; nsAutoString presentationURL;
UIStateChangeType showAccelerators;
UIStateChangeType showFocusRings;
switch(aParams.type()) { switch(aParams.type()) {
case IPCTabContext::TPopupIPCTabContext: { case IPCTabContext::TPopupIPCTabContext: {
@ -344,6 +366,8 @@ MaybeInvalidTabContext::MaybeInvalidTabContext(const IPCTabContext& aParams)
containingAppId = ipcContext.frameOwnerAppId(); containingAppId = ipcContext.frameOwnerAppId();
signedPkgOriginNoSuffix = ipcContext.signedPkgOriginNoSuffix(); signedPkgOriginNoSuffix = ipcContext.signedPkgOriginNoSuffix();
presentationURL = ipcContext.presentationURL(); presentationURL = ipcContext.presentationURL();
showAccelerators = ipcContext.showAccelerators();
showFocusRings = ipcContext.showFocusRings();
originSuffix = ipcContext.originSuffix(); originSuffix = ipcContext.originSuffix();
originAttributes.PopulateFromSuffix(originSuffix); originAttributes.PopulateFromSuffix(originSuffix);
break; break;
@ -392,6 +416,8 @@ MaybeInvalidTabContext::MaybeInvalidTabContext(const IPCTabContext& aParams)
isPrerendered, isPrerendered,
ownApp, ownApp,
containingApp, containingApp,
showAccelerators,
showFocusRings,
originAttributes, originAttributes,
signedPkgOriginNoSuffix, signedPkgOriginNoSuffix,
presentationURL); presentationURL);

Просмотреть файл

@ -10,6 +10,7 @@
#include "mozIApplication.h" #include "mozIApplication.h"
#include "nsCOMPtr.h" #include "nsCOMPtr.h"
#include "mozilla/BasePrincipal.h" #include "mozilla/BasePrincipal.h"
#include "nsPIWindowRoot.h"
namespace mozilla { namespace mozilla {
namespace dom { namespace dom {
@ -136,6 +137,9 @@ public:
*/ */
const nsAString& PresentationURL() const; const nsAString& PresentationURL() const;
UIStateChangeType ShowAccelerators() const;
UIStateChangeType ShowFocusRings() const;
protected: protected:
friend class MaybeInvalidTabContext; friend class MaybeInvalidTabContext;
@ -169,6 +173,8 @@ protected:
bool aIsPrerendered, bool aIsPrerendered,
mozIApplication* aOwnApp, mozIApplication* aOwnApp,
mozIApplication* aAppFrameOwnerApp, mozIApplication* aAppFrameOwnerApp,
UIStateChangeType aShowAccelerators,
UIStateChangeType aShowFocusRings,
const DocShellOriginAttributes& aOriginAttributes, const DocShellOriginAttributes& aOriginAttributes,
const nsACString& aSignedPkgOriginNoSuffix, const nsACString& aSignedPkgOriginNoSuffix,
const nsAString& aPresentationURL); const nsAString& aPresentationURL);
@ -238,6 +244,12 @@ private:
* The requested presentation URL. * The requested presentation URL.
*/ */
nsString mPresentationURL; nsString mPresentationURL;
/**
* Keyboard indicator state (focus rings, accelerators).
*/
UIStateChangeType mShowAccelerators;
UIStateChangeType mShowFocusRings;
}; };
/** /**
@ -258,6 +270,8 @@ public:
bool aIsPrerendered, bool aIsPrerendered,
mozIApplication* aOwnApp, mozIApplication* aOwnApp,
mozIApplication* aAppFrameOwnerApp, mozIApplication* aAppFrameOwnerApp,
UIStateChangeType aShowAccelerators,
UIStateChangeType aShowFocusRings,
const DocShellOriginAttributes& aOriginAttributes, const DocShellOriginAttributes& aOriginAttributes,
const nsACString& aSignedPkgOriginNoSuffix = EmptyCString(), const nsACString& aSignedPkgOriginNoSuffix = EmptyCString(),
const nsAString& aPresentationURL = EmptyString()) const nsAString& aPresentationURL = EmptyString())
@ -266,6 +280,8 @@ public:
aIsPrerendered, aIsPrerendered,
aOwnApp, aOwnApp,
aAppFrameOwnerApp, aAppFrameOwnerApp,
aShowAccelerators,
aShowFocusRings,
aOriginAttributes, aOriginAttributes,
aSignedPkgOriginNoSuffix, aSignedPkgOriginNoSuffix,
aPresentationURL); aPresentationURL);

Просмотреть файл

@ -10,6 +10,7 @@
#include "ipc/IPCMessageUtils.h" #include "ipc/IPCMessageUtils.h"
#include "mozilla/dom/AudioChannelBinding.h" #include "mozilla/dom/AudioChannelBinding.h"
#include "nsIDOMEvent.h" #include "nsIDOMEvent.h"
#include "nsPIDOMWindow.h"
#include "nsCOMPtr.h" #include "nsCOMPtr.h"
#ifdef MOZ_CRASHREPORTER #ifdef MOZ_CRASHREPORTER
@ -104,6 +105,13 @@ struct ParamTraits<nsSizeMode>
nsSizeMode_Invalid> nsSizeMode_Invalid>
{}; {};
template<>
struct ParamTraits<UIStateChangeType>
: public ContiguousEnumSerializer<UIStateChangeType,
UIStateChangeType_NoChange,
UIStateChangeType_Invalid>
{ };
} // namespace IPC } // namespace IPC
#endif // TABMESSAGE_UTILS_H #endif // TABMESSAGE_UTILS_H

Просмотреть файл

@ -200,7 +200,7 @@ nsresult nsJSThunk::EvaluateScript(nsIChannel *aChannel,
// Sandboxed document check: javascript: URI's are disabled // Sandboxed document check: javascript: URI's are disabled
// in a sandboxed document unless 'allow-scripts' was specified. // in a sandboxed document unless 'allow-scripts' was specified.
nsIDocument* doc = aOriginalInnerWindow->GetExtantDoc(); nsIDocument* doc = aOriginalInnerWindow->GetExtantDoc();
if (doc && (doc->GetSandboxFlags() & SANDBOXED_SCRIPTS)) { if (doc && doc->HasScriptsBlockedBySandbox()) {
return NS_ERROR_DOM_RETVAL_UNDEFINED; return NS_ERROR_DOM_RETVAL_UNDEFINED;
} }

Просмотреть файл

@ -6,8 +6,13 @@
#include <stdint.h> #include <stdint.h>
#include <algorithm> #include <algorithm>
#include "nsIStringBundle.h"
#include "nsDebug.h"
#include "nsString.h"
#include "mozilla/Preferences.h" #include "mozilla/Preferences.h"
#include "mozilla/StaticMutex.h" #include "mozilla/StaticMutex.h"
#include "mozilla/StaticPtr.h"
#include "nsThreadUtils.h"
#include "CubebUtils.h" #include "CubebUtils.h"
#include "nsAutoRef.h" #include "nsAutoRef.h"
#include "prdtoa.h" #include "prdtoa.h"
@ -25,6 +30,9 @@ cubeb* sCubebContext;
double sVolumeScale; double sVolumeScale;
uint32_t sCubebLatency; uint32_t sCubebLatency;
bool sCubebLatencyPrefSet; bool sCubebLatencyPrefSet;
StaticAutoPtr<char> sBrandName;
const char kBrandBundleURL[] = "chrome://branding/locale/brand.properties";
// Prefered samplerate, in Hz (characteristic of the hardware, mixer, platform, // Prefered samplerate, in Hz (characteristic of the hardware, mixer, platform,
// and API used). // and API used).
@ -101,15 +109,45 @@ void InitPreferredSampleRate()
} }
} }
void InitBrandName()
{
if (sBrandName) {
return;
}
nsXPIDLString brandName;
nsCOMPtr<nsIStringBundleService> stringBundleService =
mozilla::services::GetStringBundleService();
if (stringBundleService) {
nsCOMPtr<nsIStringBundle> brandBundle;
nsresult rv = stringBundleService->CreateBundle(kBrandBundleURL,
getter_AddRefs(brandBundle));
if (NS_SUCCEEDED(rv)) {
rv = brandBundle->GetStringFromName(MOZ_UTF16("brandShortName"),
getter_Copies(brandName));
NS_WARN_IF_FALSE(NS_SUCCEEDED(rv),
"Could not get the program name for a cubeb stream.");
}
}
/* cubeb expects a c-string. */
const char* ascii = NS_LossyConvertUTF16toASCII(brandName).get();
sBrandName = new char[brandName.Length() + 1];
PodCopy(sBrandName.get(), ascii, brandName.Length());
sBrandName[brandName.Length()] = 0;
}
cubeb* GetCubebContextUnlocked() cubeb* GetCubebContextUnlocked()
{ {
sMutex.AssertCurrentThreadOwns(); sMutex.AssertCurrentThreadOwns();
if (sCubebContext || if (sCubebContext) {
cubeb_init(&sCubebContext, "CubebUtils") == CUBEB_OK) {
return sCubebContext; return sCubebContext;
} }
NS_WARNING("cubeb_init failed");
return nullptr; NS_WARN_IF_FALSE(sBrandName, "Could not get brandName?");
DebugOnly<int> rv = cubeb_init(&sCubebContext, sBrandName);
NS_WARN_IF_FALSE(rv == CUBEB_OK, "Could not get a cubeb context.");
return sCubebContext;
} }
uint32_t GetCubebLatency() uint32_t GetCubebLatency()
@ -130,6 +168,9 @@ void InitLibrary()
Preferences::RegisterCallback(PrefChanged, PREF_VOLUME_SCALE); Preferences::RegisterCallback(PrefChanged, PREF_VOLUME_SCALE);
PrefChanged(PREF_CUBEB_LATENCY, nullptr); PrefChanged(PREF_CUBEB_LATENCY, nullptr);
Preferences::RegisterCallback(PrefChanged, PREF_CUBEB_LATENCY); Preferences::RegisterCallback(PrefChanged, PREF_CUBEB_LATENCY);
#ifndef MOZ_WIDGET_ANDROID
NS_DispatchToMainThread(NS_NewRunnableFunction(&InitBrandName));
#endif
} }
void ShutdownLibrary() void ShutdownLibrary()
@ -142,6 +183,7 @@ void ShutdownLibrary()
cubeb_destroy(sCubebContext); cubeb_destroy(sCubebContext);
sCubebContext = nullptr; sCubebContext = nullptr;
} }
sBrandName = nullptr;
} }
uint32_t MaxNumberOfChannels() uint32_t MaxNumberOfChannels()

Просмотреть файл

@ -1555,26 +1555,26 @@ void BaseMediaResource::SetLoadInBackground(bool aLoadInBackground) {
void BaseMediaResource::ModifyLoadFlags(nsLoadFlags aFlags) void BaseMediaResource::ModifyLoadFlags(nsLoadFlags aFlags)
{ {
nsCOMPtr<nsILoadGroup> loadGroup; nsCOMPtr<nsILoadGroup> loadGroup;
DebugOnly<nsresult> rv = mChannel->GetLoadGroup(getter_AddRefs(loadGroup)); nsresult rv = mChannel->GetLoadGroup(getter_AddRefs(loadGroup));
NS_ASSERTION(NS_SUCCEEDED(rv), "GetLoadGroup() failed!"); MOZ_ASSERT(NS_SUCCEEDED(rv), "GetLoadGroup() failed!");
nsresult status; nsresult status;
mChannel->GetStatus(&status); mChannel->GetStatus(&status);
// Note: if (NS_FAILED(status)), the channel won't be in the load group. bool inLoadGroup = false;
if (loadGroup && if (loadGroup) {
NS_SUCCEEDED(status)) {
rv = loadGroup->RemoveRequest(mChannel, nullptr, status); rv = loadGroup->RemoveRequest(mChannel, nullptr, status);
NS_ASSERTION(NS_SUCCEEDED(rv), "RemoveRequest() failed!"); if (NS_SUCCEEDED(rv)) {
inLoadGroup = true;
}
} }
rv = mChannel->SetLoadFlags(aFlags); rv = mChannel->SetLoadFlags(aFlags);
NS_ASSERTION(NS_SUCCEEDED(rv), "SetLoadFlags() failed!"); MOZ_ASSERT(NS_SUCCEEDED(rv), "SetLoadFlags() failed!");
if (loadGroup && if (inLoadGroup) {
NS_SUCCEEDED(status)) {
rv = loadGroup->AddRequest(mChannel, nullptr); rv = loadGroup->AddRequest(mChannel, nullptr);
NS_ASSERTION(NS_SUCCEEDED(rv), "AddRequest() failed!"); MOZ_ASSERT(NS_SUCCEEDED(rv), "AddRequest() failed!");
} }
} }

Просмотреть файл

@ -512,10 +512,13 @@ RTCPeerConnection.prototype = {
// This wrapper helps implement legacy callbacks in a manner that produces // This wrapper helps implement legacy callbacks in a manner that produces
// correct line-numbers in errors, provided that methods validate their inputs // correct line-numbers in errors, provided that methods validate their inputs
// before putting themselves on the pc's operations chain. // before putting themselves on the pc's operations chain.
//
// It also serves as guard against settling promises past close().
_legacyCatch: function(onSuccess, onError, func) { _legacyCatchAndCloseGuard: function(onSuccess, onError, func) {
if (!onSuccess) { if (!onSuccess) {
return func(); return func().then(v => (this._closed ? new Promise(() => {}) : v),
e => (this._closed ? new Promise(() => {}) : Promise.reject(e)));
} }
try { try {
return func().then(this._wrapLegacyCallback(onSuccess), return func().then(this._wrapLegacyCallback(onSuccess),
@ -711,7 +714,7 @@ RTCPeerConnection.prototype = {
} else { } else {
options = optionsOrOnSuccess; options = optionsOrOnSuccess;
} }
return this._legacyCatch(onSuccess, onError, () => { return this._legacyCatchAndCloseGuard(onSuccess, onError, () => {
// TODO: Remove error on constraint-like RTCOptions next cycle (1197021). // TODO: Remove error on constraint-like RTCOptions next cycle (1197021).
// Note that webidl bindings make o.mandatory implicit but not o.optional. // Note that webidl bindings make o.mandatory implicit but not o.optional.
function convertLegacyOptions(o) { function convertLegacyOptions(o) {
@ -778,7 +781,7 @@ RTCPeerConnection.prototype = {
} else { } else {
options = optionsOrOnSuccess; options = optionsOrOnSuccess;
} }
return this._legacyCatch(onSuccess, onError, () => { return this._legacyCatchAndCloseGuard(onSuccess, onError, () => {
let origin = Cu.getWebIDLCallerPrincipal().origin; let origin = Cu.getWebIDLCallerPrincipal().origin;
return this._chain(() => { return this._chain(() => {
let p = Promise.all([this.getPermission(), this._certificateReady]) let p = Promise.all([this.getPermission(), this._certificateReady])
@ -828,7 +831,7 @@ RTCPeerConnection.prototype = {
}, },
setLocalDescription: function(desc, onSuccess, onError) { setLocalDescription: function(desc, onSuccess, onError) {
return this._legacyCatch(onSuccess, onError, () => { return this._legacyCatchAndCloseGuard(onSuccess, onError, () => {
this._localType = desc.type; this._localType = desc.type;
let type; let type;
@ -912,7 +915,7 @@ RTCPeerConnection.prototype = {
}, },
setRemoteDescription: function(desc, onSuccess, onError) { setRemoteDescription: function(desc, onSuccess, onError) {
return this._legacyCatch(onSuccess, onError, () => { return this._legacyCatchAndCloseGuard(onSuccess, onError, () => {
this._remoteType = desc.type; this._remoteType = desc.type;
let type; let type;
@ -1013,7 +1016,7 @@ RTCPeerConnection.prototype = {
addIceCandidate: function(c, onSuccess, onError) { addIceCandidate: function(c, onSuccess, onError) {
return this._legacyCatch(onSuccess, onError, () => { return this._legacyCatchAndCloseGuard(onSuccess, onError, () => {
if (!c.candidate && !c.sdpMLineIndex) { if (!c.candidate && !c.sdpMLineIndex) {
throw new this._win.DOMException("Invalid candidate passed to addIceCandidate!", throw new this._win.DOMException("Invalid candidate passed to addIceCandidate!",
"InvalidParameterError"); "InvalidParameterError");
@ -1213,7 +1216,7 @@ RTCPeerConnection.prototype = {
}, },
getStats: function(selector, onSuccess, onError) { getStats: function(selector, onSuccess, onError) {
return this._legacyCatch(onSuccess, onError, () => { return this._legacyCatchAndCloseGuard(onSuccess, onError, () => {
return this._chain(() => new this._win.Promise((resolve, reject) => { return this._chain(() => new this._win.Promise((resolve, reject) => {
this._onGetStatsSuccess = resolve; this._onGetStatsSuccess = resolve;
this._onGetStatsFailure = reject; this._onGetStatsFailure = reject;

Просмотреть файл

@ -278,51 +278,51 @@ MediaKeySystemAccess::GetKeySystemStatus(const nsAString& aKeySystem,
return EnsureMinCDMVersion(mps, aKeySystem, aMinCdmVersion, aOutMessage, aOutCdmVersion); return EnsureMinCDMVersion(mps, aKeySystem, aMinCdmVersion, aOutMessage, aOutCdmVersion);
} }
#ifdef MOZ_ADOBE_EME if (Preferences::GetBool("media.gmp-eme-adobe.visible", false)) {
if (aKeySystem.EqualsLiteral("com.adobe.primetime")) { if (aKeySystem.EqualsLiteral("com.adobe.primetime")) {
if (!Preferences::GetBool("media.gmp-eme-adobe.enabled", false)) { if (!Preferences::GetBool("media.gmp-eme-adobe.enabled", false)) {
aOutMessage = NS_LITERAL_CSTRING("Adobe EME disabled"); aOutMessage = NS_LITERAL_CSTRING("Adobe EME disabled");
return MediaKeySystemStatus::Cdm_disabled; return MediaKeySystemStatus::Cdm_disabled;
} }
#ifdef XP_WIN #ifdef XP_WIN
// Win Vista and later only. // Win Vista and later only.
if (!IsVistaOrLater()) { if (!IsVistaOrLater()) {
aOutMessage = NS_LITERAL_CSTRING("Minimum Windows version (Vista) not met for Adobe EME"); aOutMessage = NS_LITERAL_CSTRING("Minimum Windows version (Vista) not met for Adobe EME");
return MediaKeySystemStatus::Cdm_not_supported; return MediaKeySystemStatus::Cdm_not_supported;
} }
#endif #endif
#ifdef XP_MACOSX #ifdef XP_MACOSX
if (!nsCocoaFeatures::OnLionOrLater()) { if (!nsCocoaFeatures::OnLionOrLater()) {
aOutMessage = NS_LITERAL_CSTRING("Minimum MacOSX version (10.7) not met for Adobe EME"); aOutMessage = NS_LITERAL_CSTRING("Minimum MacOSX version (10.7) not met for Adobe EME");
return MediaKeySystemStatus::Cdm_not_supported; return MediaKeySystemStatus::Cdm_not_supported;
}
#endif
return EnsureMinCDMVersion(mps, aKeySystem, aMinCdmVersion, aOutMessage, aOutCdmVersion);
} }
#endif
return EnsureMinCDMVersion(mps, aKeySystem, aMinCdmVersion, aOutMessage, aOutCdmVersion);
} }
#endif
#ifdef MOZ_WIDEVINE_EME if (Preferences::GetBool("media.gmp-widevinecdm.visible", false)) {
if (aKeySystem.EqualsLiteral("com.widevine.alpha")) { if (aKeySystem.EqualsLiteral("com.widevine.alpha")) {
#ifdef XP_WIN #ifdef XP_WIN
// Win Vista and later only. // Win Vista and later only.
if (!IsVistaOrLater()) { if (!IsVistaOrLater()) {
aOutMessage = NS_LITERAL_CSTRING("Minimum Windows version (Vista) not met for Widevine EME"); aOutMessage = NS_LITERAL_CSTRING("Minimum Windows version (Vista) not met for Widevine EME");
return MediaKeySystemStatus::Cdm_not_supported; return MediaKeySystemStatus::Cdm_not_supported;
} }
#endif #endif
#ifdef XP_MACOSX #ifdef XP_MACOSX
if (!nsCocoaFeatures::OnLionOrLater()) { if (!nsCocoaFeatures::OnLionOrLater()) {
aOutMessage = NS_LITERAL_CSTRING("Minimum MacOSX version (10.7) not met for Widevine EME"); aOutMessage = NS_LITERAL_CSTRING("Minimum MacOSX version (10.7) not met for Widevine EME");
return MediaKeySystemStatus::Cdm_not_supported; return MediaKeySystemStatus::Cdm_not_supported;
} }
#endif #endif
if (!Preferences::GetBool("media.gmp-widevinecdm.enabled", false)) { if (!Preferences::GetBool("media.gmp-widevinecdm.enabled", false)) {
aOutMessage = NS_LITERAL_CSTRING("Widevine EME disabled"); aOutMessage = NS_LITERAL_CSTRING("Widevine EME disabled");
return MediaKeySystemStatus::Cdm_disabled; return MediaKeySystemStatus::Cdm_disabled;
}
return EnsureMinCDMVersion(mps, aKeySystem, aMinCdmVersion, aOutMessage, aOutCdmVersion);
} }
return EnsureMinCDMVersion(mps, aKeySystem, aMinCdmVersion, aOutMessage, aOutCdmVersion);
} }
#endif
return MediaKeySystemStatus::Cdm_not_supported; return MediaKeySystemStatus::Cdm_not_supported;
} }

Просмотреть файл

@ -4,9 +4,6 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this # License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/. # file, You can obtain one at http://mozilla.org/MPL/2.0/.
for cdm in CONFIG['MOZ_EME_MODULES']:
DEFINES['MOZ_%s_EME' % cdm.upper()] = True
EXPORTS.mozilla.dom += [ EXPORTS.mozilla.dom += [
'MediaEncryptedEvent.h', 'MediaEncryptedEvent.h',
'MediaKeyError.h', 'MediaKeyError.h',

Просмотреть файл

@ -23,9 +23,7 @@
#include "GMPUtils.h" #include "GMPUtils.h"
#include "prio.h" #include "prio.h"
#include "base/task.h" #include "base/task.h"
#ifdef MOZ_WIDEVINE_EME
#include "widevine-adapter/WidevineAdapter.h" #include "widevine-adapter/WidevineAdapter.h"
#endif
using namespace mozilla::ipc; using namespace mozilla::ipc;
using mozilla::dom::CrashReporterChild; using mozilla::dom::CrashReporterChild;
@ -376,17 +374,12 @@ GMPChild::AnswerStartPlugin(const nsString& aAdapter)
return false; return false;
} }
#ifdef MOZ_WIDEVINE_EME
bool isWidevine = aAdapter.EqualsLiteral("widevine"); bool isWidevine = aAdapter.EqualsLiteral("widevine");
#endif
#if defined(MOZ_GMP_SANDBOX) && defined(XP_MACOSX) #if defined(MOZ_GMP_SANDBOX) && defined(XP_MACOSX)
MacSandboxPluginType pluginType = MacSandboxPluginType_GMPlugin_Default; MacSandboxPluginType pluginType = MacSandboxPluginType_GMPlugin_Default;
#ifdef MOZ_WIDEVINE_EME
if (isWidevine) { if (isWidevine) {
pluginType = MacSandboxPluginType_GMPlugin_EME_Widevine; pluginType = MacSandboxPluginType_GMPlugin_EME_Widevine;
} }
#endif
if (!SetMacSandboxInfo(pluginType)) { if (!SetMacSandboxInfo(pluginType)) {
NS_WARNING("Failed to set Mac GMP sandbox info"); NS_WARNING("Failed to set Mac GMP sandbox info");
delete platformAPI; delete platformAPI;
@ -394,12 +387,7 @@ GMPChild::AnswerStartPlugin(const nsString& aAdapter)
} }
#endif #endif
GMPAdapter* adapter = nullptr; GMPAdapter* adapter = (isWidevine) ? new WidevineAdapter() : nullptr;
#ifdef MOZ_WIDEVINE_EME
if (isWidevine) {
adapter = new WidevineAdapter();
}
#endif
if (!mGMPLoader->Load(libPath.get(), if (!mGMPLoader->Load(libPath.get(),
libPath.Length(), libPath.Length(),
mNodeId.BeginWriting(), mNodeId.BeginWriting(),

Просмотреть файл

@ -40,10 +40,8 @@ using CrashReporter::GetIDFromMinidump;
#include "WMFDecoderModule.h" #include "WMFDecoderModule.h"
#endif #endif
#ifdef MOZ_WIDEVINE_EME
#include "mozilla/dom/WidevineCDMManifestBinding.h" #include "mozilla/dom/WidevineCDMManifestBinding.h"
#include "widevine-adapter/WidevineAdapter.h" #include "widevine-adapter/WidevineAdapter.h"
#endif
namespace mozilla { namespace mozilla {
@ -809,7 +807,6 @@ GMPParent::ReadGMPMetaData()
return ReadGMPInfoFile(infoFile); return ReadGMPInfoFile(infoFile);
} }
#ifdef MOZ_WIDEVINE_EME
// Maybe this is the Widevine adapted plugin? // Maybe this is the Widevine adapted plugin?
nsCOMPtr<nsIFile> manifestFile; nsCOMPtr<nsIFile> manifestFile;
rv = mDirectory->Clone(getter_AddRefs(manifestFile)); rv = mDirectory->Clone(getter_AddRefs(manifestFile));
@ -818,9 +815,6 @@ GMPParent::ReadGMPMetaData()
} }
manifestFile->AppendRelativePath(NS_LITERAL_STRING("manifest.json")); manifestFile->AppendRelativePath(NS_LITERAL_STRING("manifest.json"));
return ReadChromiumManifestFile(manifestFile); return ReadChromiumManifestFile(manifestFile);
#else
return GenericPromise::CreateAndReject(rv, __func__);
#endif
} }
RefPtr<GenericPromise> RefPtr<GenericPromise>
@ -915,7 +909,6 @@ GMPParent::ReadGMPInfoFile(nsIFile* aFile)
return GenericPromise::CreateAndResolve(true, __func__); return GenericPromise::CreateAndResolve(true, __func__);
} }
#ifdef MOZ_WIDEVINE_EME
RefPtr<GenericPromise> RefPtr<GenericPromise>
GMPParent::ReadChromiumManifestFile(nsIFile* aFile) GMPParent::ReadChromiumManifestFile(nsIFile* aFile)
{ {
@ -968,7 +961,6 @@ GMPParent::ParseChromiumManifest(nsString aJSON)
return GenericPromise::CreateAndResolve(true, __func__); return GenericPromise::CreateAndResolve(true, __func__);
} }
#endif
bool bool
GMPParent::CanBeSharedCrossNodeIds() const GMPParent::CanBeSharedCrossNodeIds() const

Просмотреть файл

@ -167,10 +167,8 @@ private:
bool EnsureProcessLoaded(); bool EnsureProcessLoaded();
RefPtr<GenericPromise> ReadGMPMetaData(); RefPtr<GenericPromise> ReadGMPMetaData();
RefPtr<GenericPromise> ReadGMPInfoFile(nsIFile* aFile); RefPtr<GenericPromise> ReadGMPInfoFile(nsIFile* aFile);
#ifdef MOZ_WIDEVINE_EME
RefPtr<GenericPromise> ParseChromiumManifest(nsString aJSON); // Main thread. RefPtr<GenericPromise> ParseChromiumManifest(nsString aJSON); // Main thread.
RefPtr<GenericPromise> ReadChromiumManifestFile(nsIFile* aFile); // GMP thread. RefPtr<GenericPromise> ReadChromiumManifestFile(nsIFile* aFile); // GMP thread.
#endif
#ifdef MOZ_CRASHREPORTER #ifdef MOZ_CRASHREPORTER
void WriteExtraDataForMinidump(CrashReporter::AnnotationTable& notes); void WriteExtraDataForMinidump(CrashReporter::AnnotationTable& notes);
void GetCrashID(nsString& aResult); void GetCrashID(nsString& aResult);

Просмотреть файл

@ -4,9 +4,6 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this # License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/. # file, You can obtain one at http://mozilla.org/MPL/2.0/.
for cdm in CONFIG['MOZ_EME_MODULES']:
DEFINES['MOZ_%s_EME' % cdm.upper()] = True
XPIDL_MODULE = 'content_geckomediaplugins' XPIDL_MODULE = 'content_geckomediaplugins'
XPIDL_SOURCES += [ XPIDL_SOURCES += [
@ -120,13 +117,9 @@ UNIFIED_SOURCES += [
DIRS += [ DIRS += [
'rlz', 'rlz',
'widevine-adapter',
] ]
if 'widevine' in CONFIG['MOZ_EME_MODULES']:
DIRS += [
'widevine-adapter',
]
IPDL_SOURCES += [ IPDL_SOURCES += [
'GMPTypes.ipdlh', 'GMPTypes.ipdlh',
'PGMP.ipdl', 'PGMP.ipdl',

Просмотреть файл

@ -193,7 +193,7 @@ WidevineDecryptor::DecryptingComplete()
class WidevineBuffer : public cdm::Buffer { class WidevineBuffer : public cdm::Buffer {
public: public:
WidevineBuffer(size_t aSize) { explicit WidevineBuffer(size_t aSize) {
Log("WidevineBuffer(size=" PRIuSIZE ") created", aSize); Log("WidevineBuffer(size=" PRIuSIZE ") created", aSize);
mBuffer.SetLength(aSize); mBuffer.SetLength(aSize);
} }

Просмотреть файл

@ -46,7 +46,7 @@ class CDMWrapper {
public: public:
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(CDMWrapper) NS_INLINE_DECL_THREADSAFE_REFCOUNTING(CDMWrapper)
CDMWrapper(cdm::ContentDecryptionModule_8* aCDM) explicit CDMWrapper(cdm::ContentDecryptionModule_8* aCDM)
: mCDM(aCDM) : mCDM(aCDM)
{ {
MOZ_ASSERT(mCDM); MOZ_ASSERT(mCDM);

Просмотреть файл

@ -126,6 +126,14 @@
finish(); finish();
}, 60000); }, 60000);
var mustNotSettle = (p, ms, msg) => Promise.race([
p.then(() => ok(false, msg + " must not settle"),
e => ok(false, msg + " must not settle. Got " + e.name)),
wait(ms).then(() => ok(true, msg + " must not settle"))
]);
var silence = mustNotSettle(pc.createOffer(), 1000,
"createOffer immediately followed by close");
try { try {
pc.close(); pc.close();
} catch (e) { } catch (e) {
@ -135,7 +143,7 @@
is(pc.signalingState, "closed", "Final signalingState is 'closed'"); is(pc.signalingState, "closed", "Final signalingState is 'closed'");
is(pc.iceConnectionState, "closed", "Final iceConnectionState is 'closed'"); is(pc.iceConnectionState, "closed", "Final iceConnectionState is 'closed'");
finished.then(networkTestFinished); Promise.all([finished, silence]).then(networkTestFinished);
}); });
</script> </script>
</pre> </pre>

Просмотреть файл

@ -10,6 +10,60 @@
#include "mozilla/Alignment.h" #include "mozilla/Alignment.h"
#include "nsTArray.h" #include "nsTArray.h"
/**
* E: element type, must be a POD type.
* N: N bytes alignment for the first element, defaults to 32
* S: S bytes of inline storage
*/
template <typename E, int S, int N = 32>
class AlignedAutoTArray : private AutoTArray<E, S + N>
{
static_assert((N & (N-1)) == 0, "N must be power of 2");
typedef AutoTArray<E, S + N> base_type;
public:
typedef E elem_type;
typedef typename base_type::size_type size_type;
typedef typename base_type::index_type index_type;
AlignedAutoTArray() {}
explicit AlignedAutoTArray(size_type capacity) : base_type(capacity + sExtra) {}
elem_type* Elements() { return getAligned(base_type::Elements()); }
const elem_type* Elements() const { return getAligned(base_type::Elements()); }
elem_type& operator[](index_type i) { return Elements()[i];}
const elem_type& operator[](index_type i) const { return Elements()[i]; }
void SetLength(size_type newLen)
{
base_type::SetLength(newLen + sExtra);
}
MOZ_MUST_USE
bool SetLength(size_type newLen, const mozilla::fallible_t&)
{
return base_type::SetLength(newLen + sExtra, mozilla::fallible);
}
size_type Length() const {
return base_type::Length() <= sExtra ? 0 : base_type::Length() - sExtra;
}
using base_type::ShallowSizeOfExcludingThis;
using base_type::ShallowSizeOfIncludingThis;
private:
AlignedAutoTArray(const AlignedAutoTArray& other) = delete;
void operator=(const AlignedAutoTArray& other) = delete;
static const size_type sPadding = N <= MOZ_ALIGNOF(E) ? 0 : N - MOZ_ALIGNOF(E);
static const size_type sExtra = (sPadding + sizeof(E) - 1) / sizeof(E);
template <typename U>
static U* getAligned(U* p)
{
return reinterpret_cast<U*>(((uintptr_t)p + N - 1) & ~(N-1));
}
};
/** /**
* E: element type, must be a POD type. * E: element type, must be a POD type.
* N: N bytes alignment for the first element, defaults to 32 * N: N bytes alignment for the first element, defaults to 32
@ -63,4 +117,5 @@ private:
} }
}; };
#endif // AlignedTArray_h__ #endif // AlignedTArray_h__

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше