Skip to content

Commit

Permalink
Merge mozilla-central to autoland
Browse files Browse the repository at this point in the history
  • Loading branch information
BavarianTomcat committed May 5, 2017
2 parents d49a879 + 2c27ed5 commit ba6d384
Show file tree
Hide file tree
Showing 330 changed files with 25,174 additions and 22,938 deletions.
4 changes: 0 additions & 4 deletions accessible/base/NotificationController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -795,10 +795,6 @@ NotificationController::WillRefresh(mozilla::TimeStamp aTime)
// modification are done.
mDocument->ProcessInvalidationList();

// We cannot rely on DOM tree to keep aria-owns relations updated. Make
// a validation to remove dead links.
mDocument->ValidateARIAOwned();

// Process relocation list.
for (uint32_t idx = 0; idx < mRelocations.Length(); idx++) {
if (mRelocations[idx]->IsInDocument()) {
Expand Down
98 changes: 39 additions & 59 deletions accessible/generic/DocAccessible.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1972,19 +1972,30 @@ DocAccessible::FireEventsOnInsertion(Accessible* aContainer)
}

void
DocAccessible::ContentRemoved(Accessible* aContent)
DocAccessible::ContentRemoved(Accessible* aChild)
{
MOZ_DIAGNOSTIC_ASSERT(aContent->Parent(), "Unattached accessible from tree");
Accessible* parent = aChild->Parent();
MOZ_DIAGNOSTIC_ASSERT(parent, "Unattached accessible from tree");

#ifdef A11Y_LOG
logging::TreeInfo("process content removal", 0,
"container", aContent->Parent(), "child", aContent, nullptr);
"container", parent, "child", aChild, nullptr);
#endif

TreeMutation mt(aContent->Parent());
mt.BeforeRemoval(aContent);
aContent->Parent()->RemoveChild(aContent);
UncacheChildrenInSubtree(aContent);
TreeMutation mt(parent);
mt.BeforeRemoval(aChild);

if (aChild->IsRelocated()) {
nsTArray<RefPtr<Accessible> >* owned = mARIAOwnsHash.Get(parent);
MOZ_ASSERT(owned, "IsRelocated flag is out of sync with mARIAOwnsHash");
owned->RemoveElement(aChild);
if (owned->Length() == 0) {
mARIAOwnsHash.Remove(parent);
}
}
parent->RemoveChild(aChild);
UncacheChildrenInSubtree(aChild);

mt.Done();
}

Expand All @@ -1996,11 +2007,11 @@ DocAccessible::ContentRemoved(nsIContent* aContentNode)
if (acc) {
ContentRemoved(acc);
}
else {
TreeWalker walker(this, aContentNode);
while (Accessible* acc = walker.Next()) {
ContentRemoved(acc);
}

dom::AllChildrenIterator iter =
dom::AllChildrenIterator(aContentNode, nsIContent::eAllChildren, true);
while (nsIContent* childNode = iter.GetNextChild()) {
ContentRemoved(childNode);
}
}

Expand All @@ -2027,50 +2038,6 @@ DocAccessible::RelocateARIAOwnedIfNeeded(nsIContent* aElement)
return false;
}

void
DocAccessible::ValidateARIAOwned()
{
for (auto it = mARIAOwnsHash.Iter(); !it.Done(); it.Next()) {
Accessible* owner = it.Key();
nsTArray<RefPtr<Accessible> >* children = it.UserData();

// Owner is about to die, put children back if applicable.
if (owner != this &&
(!mAccessibleCache.GetWeak(reinterpret_cast<void*>(owner)) ||
!owner->IsInDocument())) {
PutChildrenBack(children, 0);
it.Remove();
continue;
}

for (uint32_t idx = 0; idx < children->Length(); idx++) {
Accessible* child = children->ElementAt(idx);
if (!child->IsInDocument()) {
children->RemoveElementAt(idx);
idx--;
continue;
}

NS_ASSERTION(child->Parent(), "No parent for ARIA owned?");

// If DOM node doesn't have a frame anymore then shutdown its accessible.
if (child->Parent() && !child->GetFrame()) {
ContentRemoved(child);
children->RemoveElementAt(idx);
idx--;
continue;
}

NS_ASSERTION(child->Parent() == owner,
"Illigally stolen ARIA owned child!");
}

if (children->Length() == 0) {
it.Remove();
}
}
}

void
DocAccessible::DoARIAOwnsRelocation(Accessible* aOwner)
{
Expand Down Expand Up @@ -2194,7 +2161,7 @@ DocAccessible::PutChildrenBack(nsTArray<RefPtr<Accessible> >* aChildren,
Accessible* prevChild = walker.Prev();
if (prevChild) {
idxInParent = prevChild->IndexInParent() + 1;
MOZ_ASSERT(origContainer == prevChild->Parent(), "Broken tree");
MOZ_DIAGNOSTIC_ASSERT(origContainer == prevChild->Parent(), "Broken tree");
origContainer = prevChild->Parent();
}
else {
Expand Down Expand Up @@ -2225,8 +2192,12 @@ DocAccessible::MoveChild(Accessible* aChild, Accessible* aNewParent,

// If the child was taken from from an ARIA owns element.
if (aChild->IsRelocated()) {
nsTArray<RefPtr<Accessible> >* children = mARIAOwnsHash.Get(curParent);
children->RemoveElement(aChild);
nsTArray<RefPtr<Accessible> >* owned = mARIAOwnsHash.Get(curParent);
MOZ_ASSERT(owned, "IsRelocated flag is out of sync with mARIAOwnsHash");
owned->RemoveElement(aChild);
if (owned->Length() == 0) {
mARIAOwnsHash.Remove(curParent);
}
}

NotificationController::MoveGuard mguard(mNotificationController);
Expand Down Expand Up @@ -2327,10 +2298,19 @@ DocAccessible::UncacheChildrenInSubtree(Accessible* aRoot)
aRoot->mStateFlags |= eIsNotInDocument;
RemoveDependentIDsFor(aRoot);

nsTArray<RefPtr<Accessible> >* owned = mARIAOwnsHash.Get(aRoot);
uint32_t count = aRoot->ContentChildCount();
for (uint32_t idx = 0; idx < count; idx++) {
Accessible* child = aRoot->ContentChildAt(idx);

if (child->IsRelocated()) {
MOZ_ASSERT(owned, "IsRelocated flag is out of sync with mARIAOwnsHash");
owned->RemoveElement(child);
if (owned->Length() == 0) {
mARIAOwnsHash.Remove(aRoot);
}
}

// Removing this accessible from the document doesn't mean anything about
// accessibles for subdocuments, so skip removing those from the tree.
if (!child->IsDoc()) {
Expand Down
7 changes: 1 addition & 6 deletions accessible/generic/DocAccessible.h
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ class DocAccessible : public HyperTextAccessibleWrap,
/**
* Update the tree on content removal.
*/
void ContentRemoved(Accessible* aContent);
void ContentRemoved(Accessible* aAccessible);
void ContentRemoved(nsIContent* aContentNode);

/**
Expand Down Expand Up @@ -504,11 +504,6 @@ class DocAccessible : public HyperTextAccessibleWrap,
*/
void ProcessInvalidationList();

/**
* Validates all aria-owns connections and updates the tree accordingly.
*/
void ValidateARIAOwned();

/**
* Steals or puts back accessible subtrees.
*/
Expand Down
2 changes: 1 addition & 1 deletion addon-sdk/source/lib/sdk/io/buffer.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ function Buffer(subject, encoding /*, bufferLength */) {
let buffer = new Uint8Array(subject > 0 ? Math.floor(subject) : 0);
return buffer;
} catch (e) {
if (/size and count too large/.test(e.message) ||
if (/invalid array length/.test(e.message) ||
/invalid arguments/.test(e.message))
throw new RangeError('Could not instantiate buffer: size of buffer may be too large');
else
Expand Down
2 changes: 0 additions & 2 deletions addon-sdk/source/python-lib/cuddlefish/prefs.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,6 @@
'layout.css.report_errors': True,
'layout.css.grid.enabled': True,
'layout.spammy_warnings.enabled': False,
# Make sure the disk cache doesn't get auto disabled
'network.http.bypass-cachelock-threshold': 200000,
# Always use network provider for geolocation tests
# so we bypass the OSX dialog raised by the corelocation provider
'geo.provider.testing': True,
Expand Down
1 change: 0 additions & 1 deletion addon-sdk/source/test/preferences/test.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
"layout.css.report_errors": true,
"layout.css.grid.enabled": true,
"layout.spammy_warnings.enabled": false,
"network.http.bypass-cachelock-threshold": 200000,
"geo.provider.testing": true,
"browser.pagethumbnails.capturing_disabled": true,
"browser.download.panel.shown": true,
Expand Down
1 change: 1 addition & 0 deletions addon-sdk/source/test/test-xpcom.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ function testRegister(assert, text) {
var channel = ios.newChannelFromURIWithLoadInfo(uri, aLoadInfo);

channel.originalURI = aURI;
aLoadInfo.resultPrincipalURI = aURI;
return channel;
},
getURIFlags: function(aURI) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,16 @@ add_task(function* test_toolbar_element_restyles_on_activation() {
let win2 = yield BrowserTestUtils.openNewBrowserWindow();
yield new Promise(resolve => waitForFocus(resolve, win2));

// Flush any pending styles before we take a measurement.
win1.getComputedStyle(win1.document.firstElementChild);
win2.getComputedStyle(win2.document.firstElementChild);

// Clear the focused element from each window so that when
// we raise them, the focus of the element doesn't cause an
// unrelated style flush.
Services.focus.clearFocus(win1);
Services.focus.clearFocus(win2);

let utils1 = SpecialPowers.getDOMWindowUtils(win1);
restyles.win1.initial = utils1.elementsRestyled;

Expand Down
20 changes: 8 additions & 12 deletions browser/components/about/AboutRedirector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -172,27 +172,23 @@ AboutRedirector::NewChannel(nsIURI* aURI,
rv = NS_NewURI(getter_AddRefs(tempURI), url);
NS_ENSURE_SUCCESS(rv, rv);

// If tempURI links to an external URI (i.e. something other than
// chrome:// or resource://) then set the LOAD_REPLACE flag on the
// channel which forces the channel owner to reflect the displayed
// URL rather then being the systemPrincipal.
// If tempURI links to an internal URI (chrome://, resource://)
// then set the result principal URL on the channel's load info.
// Otherwise, we leave it null which forces the channel principal
// to reflect the displayed URL rather than being the systemPrincipal.
bool isUIResource = false;
rv = NS_URIChainHasFlags(tempURI, nsIProtocolHandler::URI_IS_UI_RESOURCE,
&isUIResource);
NS_ENSURE_SUCCESS(rv, rv);

nsLoadFlags loadFlags = isUIResource
? static_cast<nsLoadFlags>(nsIChannel::LOAD_NORMAL)
: static_cast<nsLoadFlags>(nsIChannel::LOAD_REPLACE);

rv = NS_NewChannelInternal(getter_AddRefs(tempChannel),
tempURI,
aLoadInfo,
nullptr, // aLoadGroup
nullptr, // aCallbacks
loadFlags);
aLoadInfo);
NS_ENSURE_SUCCESS(rv, rv);

if (isUIResource) {
aLoadInfo->SetResultPrincipalURI(aURI);
}
tempChannel->SetOriginalURI(aURI);

NS_ADDREF(*result = tempChannel);
Expand Down
5 changes: 4 additions & 1 deletion browser/components/feeds/FeedConverter.js
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,7 @@ FeedConverter.prototype = {
let aboutFeedsURI = ios.newURI("about:feeds");
chromeChannel = ios.newChannelFromURIWithLoadInfo(aboutFeedsURI, loadInfo);
chromeChannel.originalURI = result.uri;
loadInfo.resultPrincipalURI = result.uri;

// carry the origin attributes from the channel that loaded the feed.
chromeChannel.owner =
Expand Down Expand Up @@ -560,10 +561,12 @@ GenericProtocolHandler.prototype = {
const schemeId = this._getTelemetrySchemeId();
Services.telemetry.getHistogramById("FEED_PROTOCOL_USAGE").add(schemeId);

if (channel instanceof Components.interfaces.nsIHttpChannel)
if (channel instanceof Components.interfaces.nsIHttpChannel) {
// Set this so we know this is supposed to be a feed
channel.setRequestHeader("X-Moz-Is-Feed", "1", false);
}
channel.originalURI = aUri;
aLoadInfo.resultPrincipalURI = aUri;
return channel;
},

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ let TestAboutPage = {
let channel = Services.io.newChannelFromURIWithLoadInfo(newURI,
aLoadInfo);
channel.originalURI = aURI;
aLoadInfo.resultPrincipalURI = aURI;
return channel;
},

Expand Down
4 changes: 2 additions & 2 deletions browser/extensions/pdfjs/README.mozilla
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
This is the PDF.js project output, https://github.com/mozilla/pdf.js

Current extension version is: 1.8.290
Current extension version is: 1.8.314

Taken from upstream commit: 60c232bc
Taken from upstream commit: 3adda80f
1 change: 1 addition & 0 deletions browser/extensions/pdfjs/content/PdfStreamConverter.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -1003,6 +1003,7 @@ PdfStreamConverter.prototype = {

// Keep the URL the same so the browser sees it as the same.
channel.originalURI = aRequest.URI;
channel.loadInfo.resultPrincipalURI = aRequest.loadInfo.resultPrincipalURI;
channel.loadGroup = aRequest.loadGroup;
channel.loadInfo.originAttributes = aRequest.loadInfo.originAttributes;

Expand Down
Loading

0 comments on commit ba6d384

Please sign in to comment.