Skip to content

Commit

Permalink
merge mozilla-inbound to mozilla-central a=merge
Browse files Browse the repository at this point in the history
  • Loading branch information
BavarianTomcat committed Mar 18, 2015
2 parents 8bfab8f + bbf229d commit 3c57b5b
Show file tree
Hide file tree
Showing 111 changed files with 891 additions and 482 deletions.
1 change: 1 addition & 0 deletions b2g/app/b2g.js
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,7 @@ pref("media.fragmented-mp4.gonk.enabled", true);
pref("media.video-queue.default-size", 3);

// optimize images' memory usage
pref("image.downscale-during-decode.enabled", true);
pref("image.mem.decodeondraw", true);
pref("image.mem.allow_locking_in_content_processes", false); /* don't allow image locking */
// Limit the surface cache to 1/8 of main memory or 128MB, whichever is smaller.
Expand Down
2 changes: 1 addition & 1 deletion dom/animation/test/chrome/test_running_on_compositor.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
to { transform: translate(100px) }
}
.target {
// Element needs geometry to be eligible for layerization
/* Element needs geometry to be eligible for layerization */
width: 100px;
height: 100px;
background-color: white;
Expand Down
1 change: 0 additions & 1 deletion dom/animation/test/mochitest.ini
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,3 @@ skip-if = buildapp == 'mulet'
[css-transitions/test_element-get-animation-players.html]
skip-if = buildapp == 'mulet'
[mozilla/test_deferred_start.html]
skip-if = buildapp == 'mulet' || buildapp == 'b2g' # bug 1113425, 1119981
19 changes: 12 additions & 7 deletions dom/animation/test/mozilla/test_deferred_start.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
to { transform: translate(100px); }
}
.target {
// Element needs geometry to be eligible for layerization
/* Element needs geometry to be eligible for layerization */
width: 100px;
height: 100px;
background-color: white;
Expand Down Expand Up @@ -60,13 +60,18 @@
assert_unreached('ready promise was rejected');
});

// We need to wait for up to two frames since the animation may not start
// until the beginning of the next refresh driver tick and it won't queue
// the ready Promise callback until that point.
}).then(waitForFrame).then(waitForFrame).then(t.step_func(function() {
// We need to wait for up to three frames. This is because in some
// cases it can take up to two frames for the initial layout
// to take place. Even after that happens we don't actually resolve the
// ready promise until the following tick.
})
.then(waitForFrame)
.then(waitForFrame)
.then(waitForFrame)
.then(t.step_func(function() {
assert_true(promiseCallbackDone,
'ready promise callback was called before the next'
+ ' requestAnimationFrame callback');
'ready promise for an empty animation was resolved'
+ ' within three animation frames');
t.done();
}));
}, 'AnimationPlayer.ready is resolved for an empty animation');
Expand Down
2 changes: 1 addition & 1 deletion dom/base/Element.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1832,7 +1832,7 @@ Element::IsLabelable() const
}

bool
Element::IsInteractiveHTMLContent() const
Element::IsInteractiveHTMLContent(bool aIgnoreTabindex) const
{
return false;
}
Expand Down
2 changes: 1 addition & 1 deletion dom/base/Element.h
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ class Element : public FragmentOrElement
/**
* Returns if the element is interactive content as per HTML specification.
*/
virtual bool IsInteractiveHTMLContent() const;
virtual bool IsInteractiveHTMLContent(bool aIgnoreTabindex) const;

/**
* Is the attribute named stored in the mapped attributes?
Expand Down
1 change: 1 addition & 0 deletions dom/base/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ EXPORTS += [
'nsDOMNavigationTiming.h',
'nsDOMString.h',
'nsFocusManager.h',
'nsFormData.h',
'nsFrameMessageManager.h',
'nsGenericDOMDataNode.h',
'nsGkAtomList.h',
Expand Down
55 changes: 25 additions & 30 deletions dom/cache/TypeUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ TypeUtils::ToPCacheResponseWithoutBody(PCacheResponse& aOut,

aOut.status() = aIn.GetStatus();
aOut.statusText() = aIn.GetStatusText();
nsRefPtr<InternalHeaders> headers = aIn.Headers();
nsRefPtr<InternalHeaders> headers = aIn.UnfilteredHeaders();
MOZ_ASSERT(headers);
headers->GetPHeaders(aOut.headers());
aOut.headersGuard() = headers->Guard();
Expand Down Expand Up @@ -278,37 +278,14 @@ TypeUtils::ToPCacheQueryParams(PCacheQueryParams& aOut,
already_AddRefed<Response>
TypeUtils::ToResponse(const PCacheResponse& aIn)
{
nsRefPtr<InternalResponse> ir;
switch (aIn.type())
{
case ResponseType::Error:
ir = InternalResponse::NetworkError();
break;
case ResponseType::Opaque:
ir = InternalResponse::OpaqueResponse();
break;
case ResponseType::Default:
ir = new InternalResponse(aIn.status(), aIn.statusText());
break;
case ResponseType::Basic:
{
nsRefPtr<InternalResponse> inner = new InternalResponse(aIn.status(),
aIn.statusText());
ir = InternalResponse::BasicResponse(inner);
break;
}
case ResponseType::Cors:
{
nsRefPtr<InternalResponse> inner = new InternalResponse(aIn.status(),
aIn.statusText());
ir = InternalResponse::CORSResponse(inner);
break;
}
default:
MOZ_CRASH("Unexpected ResponseType!");
if (aIn.type() == ResponseType::Error) {
nsRefPtr<InternalResponse> error = InternalResponse::NetworkError();
nsRefPtr<Response> r = new Response(GetGlobalObject(), error);
return r.forget();
}
MOZ_ASSERT(ir);

nsRefPtr<InternalResponse> ir = new InternalResponse(aIn.status(),
aIn.statusText());
ir->SetUrl(NS_ConvertUTF16toUTF8(aIn.url()));

nsRefPtr<InternalHeaders> internalHeaders =
Expand All @@ -324,6 +301,24 @@ TypeUtils::ToResponse(const PCacheResponse& aIn)
nsCOMPtr<nsIInputStream> stream = ReadStream::Create(aIn.body());
ir->SetBody(stream);

switch (aIn.type())
{
case ResponseType::Default:
break;
case ResponseType::Opaque:
ir = ir->OpaqueResponse();
break;
case ResponseType::Basic:
ir = ir->BasicResponse();
break;
case ResponseType::Cors:
ir = ir->CORSResponse();
break;
default:
MOZ_CRASH("Unexpected ResponseType!");
}
MOZ_ASSERT(ir);

nsRefPtr<Response> ref = new Response(GetGlobalObject(), ir);
return ref.forget();
}
Expand Down
3 changes: 1 addition & 2 deletions dom/cache/test/mochitest/driver.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,7 @@ function runTests(testFile, order) {
SimpleTest.waitForExplicitFinish();

if (typeof order == "undefined") {
order = "sequential"; // sequential by default, see bug 1143222.
// TODO: Make this "both".
order = "both"; // both by default
}

ok(order == "parallel" || order == "sequential" || order == "both",
Expand Down
5 changes: 4 additions & 1 deletion dom/cache/test/mochitest/test_cache_matchAll_request.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@ function checkResponse(r, response, responseText) {
is(r.statusText, response.statusText,
"Both responses should have the same status text");
return r.text().then(function(text) {
is(text, responseText, "The response body should be correct");
// Avoid dumping out the large response text to the log if they're equal.
if (text !== responseText) {
is(text, responseText, "The response body should be correct");
}
});
}

Expand Down
5 changes: 4 additions & 1 deletion dom/cache/test/mochitest/test_cache_match_request.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@ function checkResponse(r) {
is(r.statusText, response.statusText,
"Both responses should have the same status text");
return r.text().then(function(text) {
is(text, responseText, "The response body should be correct");
// Avoid dumping out the large response text to the log if they're equal.
if (text !== responseText) {
is(text, responseText, "The response body should be correct");
}
});
}

Expand Down
21 changes: 19 additions & 2 deletions dom/fetch/Fetch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#include "InternalRequest.h"
#include "InternalResponse.h"

#include "nsFormData.h"
#include "WorkerPrivate.h"
#include "WorkerRunnable.h"
#include "WorkerScope.h"
Expand Down Expand Up @@ -452,6 +453,16 @@ ExtractFromBlob(const File& aFile, nsIInputStream** aStream,
return NS_OK;
}

nsresult
ExtractFromFormData(nsFormData& aFormData, nsIInputStream** aStream,
nsCString& aContentType)
{
uint64_t unusedContentLength;
nsAutoCString unusedCharset;
return aFormData.GetSendInfo(aStream, &unusedContentLength,
aContentType, unusedCharset);
}

nsresult
ExtractFromUSVString(const nsString& aStr,
nsIInputStream** aStream,
Expand Down Expand Up @@ -502,7 +513,7 @@ ExtractFromURLSearchParams(const URLSearchParams& aParams,
} // anonymous namespace

nsresult
ExtractByteStreamFromBody(const OwningArrayBufferOrArrayBufferViewOrBlobOrUSVStringOrURLSearchParams& aBodyInit,
ExtractByteStreamFromBody(const OwningArrayBufferOrArrayBufferViewOrBlobOrFormDataOrUSVStringOrURLSearchParams& aBodyInit,
nsIInputStream** aStream,
nsCString& aContentType)
{
Expand All @@ -517,6 +528,9 @@ ExtractByteStreamFromBody(const OwningArrayBufferOrArrayBufferViewOrBlobOrUSVStr
} else if (aBodyInit.IsBlob()) {
const File& blob = aBodyInit.GetAsBlob();
return ExtractFromBlob(blob, aStream, aContentType);
} else if (aBodyInit.IsFormData()) {
nsFormData& form = aBodyInit.GetAsFormData();
return ExtractFromFormData(form, aStream, aContentType);
} else if (aBodyInit.IsUSVString()) {
nsAutoString str;
str.Assign(aBodyInit.GetAsUSVString());
Expand All @@ -531,7 +545,7 @@ ExtractByteStreamFromBody(const OwningArrayBufferOrArrayBufferViewOrBlobOrUSVStr
}

nsresult
ExtractByteStreamFromBody(const ArrayBufferOrArrayBufferViewOrBlobOrUSVStringOrURLSearchParams& aBodyInit,
ExtractByteStreamFromBody(const ArrayBufferOrArrayBufferViewOrBlobOrFormDataOrUSVStringOrURLSearchParams& aBodyInit,
nsIInputStream** aStream,
nsCString& aContentType)
{
Expand All @@ -546,6 +560,9 @@ ExtractByteStreamFromBody(const ArrayBufferOrArrayBufferViewOrBlobOrUSVStringOrU
} else if (aBodyInit.IsBlob()) {
const File& blob = aBodyInit.GetAsBlob();
return ExtractFromBlob(blob, aStream, aContentType);
} else if (aBodyInit.IsFormData()) {
nsFormData& form = aBodyInit.GetAsFormData();
return ExtractFromFormData(form, aStream, aContentType);
} else if (aBodyInit.IsUSVString()) {
nsAutoString str;
str.Assign(aBodyInit.GetAsUSVString());
Expand Down
8 changes: 4 additions & 4 deletions dom/fetch/Fetch.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ class nsIGlobalObject;
namespace mozilla {
namespace dom {

class ArrayBufferOrArrayBufferViewOrBlobOrUSVStringOrURLSearchParams;
class ArrayBufferOrArrayBufferViewOrBlobOrFormDataOrUSVStringOrURLSearchParams;
class InternalRequest;
class OwningArrayBufferOrArrayBufferViewOrBlobOrUSVStringOrURLSearchParams;
class OwningArrayBufferOrArrayBufferViewOrBlobOrFormDataOrUSVStringOrURLSearchParams;
class RequestOrUSVString;

namespace workers {
Expand All @@ -48,15 +48,15 @@ UpdateRequestReferrer(nsIGlobalObject* aGlobal, InternalRequest* aRequest);
* Stores content type in out param aContentType.
*/
nsresult
ExtractByteStreamFromBody(const OwningArrayBufferOrArrayBufferViewOrBlobOrUSVStringOrURLSearchParams& aBodyInit,
ExtractByteStreamFromBody(const OwningArrayBufferOrArrayBufferViewOrBlobOrFormDataOrUSVStringOrURLSearchParams& aBodyInit,
nsIInputStream** aStream,
nsCString& aContentType);

/*
* Non-owning version.
*/
nsresult
ExtractByteStreamFromBody(const ArrayBufferOrArrayBufferViewOrBlobOrUSVStringOrURLSearchParams& aBodyInit,
ExtractByteStreamFromBody(const ArrayBufferOrArrayBufferViewOrBlobOrFormDataOrUSVStringOrURLSearchParams& aBodyInit,
nsIInputStream** aStream,
nsCString& aContentType);

Expand Down
40 changes: 24 additions & 16 deletions dom/fetch/FetchDriver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -485,16 +485,24 @@ FetchDriver::HttpFetch(bool aCORSFlag, bool aCORSPreflightFlag, bool aAuthentica
internalChan->ForceNoIntercept();
}

// Set up a CORS proxy that will handle the various requirements of the CORS
// protocol. It handles the preflight cache and CORS response headers.
// If the request is allowed, it will start our original request
// and our observer will be notified. On failure, our observer is notified
// directly.
nsRefPtr<nsCORSListenerProxy> corsListener =
new nsCORSListenerProxy(this, mPrincipal, useCredentials);
rv = corsListener->Init(chan, true /* allow data uri */);
if (NS_WARN_IF(NS_FAILED(rv))) {
return FailWithNetworkError();
nsCOMPtr<nsIStreamListener> listener = this;

// Unless the cors mode is explicitly no-cors, we set up a cors proxy even in
// the same-origin case, since the proxy does not enforce cors header checks
// in the same-origin case.
if (mRequest->Mode() != RequestMode::No_cors) {
// Set up a CORS proxy that will handle the various requirements of the CORS
// protocol. It handles the preflight cache and CORS response headers.
// If the request is allowed, it will start our original request
// and our observer will be notified. On failure, our observer is notified
// directly.
nsRefPtr<nsCORSListenerProxy> corsListener =
new nsCORSListenerProxy(this, mPrincipal, useCredentials);
rv = corsListener->Init(chan, true /* allow data uri */);
if (NS_WARN_IF(NS_FAILED(rv))) {
return FailWithNetworkError();
}
listener = corsListener.forget();
}

// If preflight is required, start a "CORS preflight fetch"
Expand All @@ -507,12 +515,12 @@ FetchDriver::HttpFetch(bool aCORSFlag, bool aCORSPreflightFlag, bool aAuthentica
nsAutoTArray<nsCString, 5> unsafeHeaders;
mRequest->Headers()->GetUnsafeHeaders(unsafeHeaders);

rv = NS_StartCORSPreflight(chan, corsListener, mPrincipal,
rv = NS_StartCORSPreflight(chan, listener, mPrincipal,
useCredentials,
unsafeHeaders,
getter_AddRefs(preflightChannel));
} else {
rv = chan->AsyncOpen(corsListener, nullptr);
rv = chan->AsyncOpen(listener, nullptr);
}

if (NS_WARN_IF(NS_FAILED(rv))) {
Expand Down Expand Up @@ -548,13 +556,13 @@ FetchDriver::BeginAndGetFilteredResponse(InternalResponse* aResponse)
nsRefPtr<InternalResponse> filteredResponse;
switch (mRequest->GetResponseTainting()) {
case InternalRequest::RESPONSETAINT_BASIC:
filteredResponse = InternalResponse::BasicResponse(aResponse);
filteredResponse = aResponse->BasicResponse();
break;
case InternalRequest::RESPONSETAINT_CORS:
filteredResponse = InternalResponse::CORSResponse(aResponse);
filteredResponse = aResponse->CORSResponse();
break;
case InternalRequest::RESPONSETAINT_OPAQUE:
filteredResponse = InternalResponse::OpaqueResponse();
filteredResponse = aResponse->OpaqueResponse();
break;
default:
MOZ_CRASH("Unexpected case");
Expand Down Expand Up @@ -775,7 +783,7 @@ FetchDriver::AsyncOnChannelRedirect(nsIChannel* aOldChannel,
if (!NS_IsInternalSameURIRedirect(aOldChannel, aNewChannel, aFlags)) {
rv = DoesNotRequirePreflight(aNewChannel);
if (NS_FAILED(rv)) {
NS_WARNING("nsXMLHttpRequest::OnChannelRedirect: "
NS_WARNING("FetchDriver::OnChannelRedirect: "
"DoesNotRequirePreflight returned failure");
return rv;
}
Expand Down
Loading

0 comments on commit 3c57b5b

Please sign in to comment.