Merge mozilla-central to autoland. a=merge on a CLOSED TREE

This commit is contained in:
Razvan Maries 2019-03-15 05:48:49 +02:00
Родитель 71e059e062 b5f0d05bc9
Коммит 3d59436341
20 изменённых файлов: 184 добавлений и 60 удалений

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

@ -5,14 +5,13 @@
// @flow
import { PROMISE } from "../utils/middleware/promise";
import { getSource } from "../../selectors";
import { getSource, getSourcesEpoch } from "../../selectors";
import { setBreakpointPositions } from "../breakpoints";
import * as parser from "../../workers/parser";
import { isLoaded, isOriginal } from "../../utils/source";
import { Telemetry } from "devtools-modules";
import defer from "../../utils/defer";
import type { ThunkArgs } from "../types";
import type { Source } from "../../types";
@ -23,75 +22,107 @@ const requests = new Map();
const loadSourceHistogram = "DEVTOOLS_DEBUGGER_LOAD_SOURCE_MS";
const telemetry = new Telemetry();
async function loadSource(state, source: Source, { sourceMaps, client }) {
async function loadSource(
state,
source: Source,
{ sourceMaps, client }
): Promise<?{
text: string,
contentType: string
}> {
if (isOriginal(source)) {
return sourceMaps.getOriginalSourceText(source);
const result = await sourceMaps.getOriginalSourceText(source);
if (!result) {
// TODO: This allows pretty files to continue working the way they have
// been, but is very ugly. Remove this when we centralize pretty-printing
// in loadSource. https://github.com/firefox-devtools/debugger/issues/8071
if (source.isPrettyPrinted) {
return null;
}
// The way we currently try to load and select a pending
// selected location, it is possible that we will try to fetch the
// original source text right after the source map has been cleared
// after a navigation event.
throw new Error("Original source text unavailable");
}
return result;
}
if (!source.actors.length) {
throw new Error("No source actor for loadSource");
}
telemetry.start(loadSourceHistogram, source);
const response = await client.sourceContents(source.actors[0]);
telemetry.finish(loadSourceHistogram, source);
return {
id: source.id,
text: response.source,
contentType: response.contentType || "text/javascript"
};
}
async function loadSourceTextPromise(
source: Source,
epoch: number,
{ dispatch, getState, client, sourceMaps }: ThunkArgs
): Promise<?Source> {
if (isLoaded(source)) {
return source;
}
await dispatch({
type: "LOAD_SOURCE_TEXT",
sourceId: source.id,
epoch,
[PROMISE]: loadSource(getState(), source, { sourceMaps, client })
});
const newSource = getSource(getState(), source.id);
if (!newSource) {
return;
}
if (!newSource.isWasm && isLoaded(newSource)) {
parser.setSource(newSource);
await dispatch(setBreakpointPositions(newSource.id));
}
return newSource;
}
/**
* @memberof actions/sources
* @static
*/
export function loadSourceText(source: ?Source) {
return async ({ dispatch, getState, client, sourceMaps }: ThunkArgs) => {
if (!source) {
export function loadSourceText(inputSource: ?Source) {
return async (thunkArgs: ThunkArgs) => {
if (!inputSource) {
return;
}
// This ensures that the falsy check above is preserved into the IIFE
// below in a way that Flow is happy with.
const source = inputSource;
const id = source.id;
// Fetch the source text only once.
if (requests.has(id)) {
return requests.get(id);
const epoch = getSourcesEpoch(thunkArgs.getState());
const id = `${epoch}:${source.id}`;
let promise = requests.get(id);
if (!promise) {
promise = (async () => {
try {
return await loadSourceTextPromise(source, epoch, thunkArgs);
} catch (e) {
// TODO: This swallows errors for now. Ideally we would get rid of
// this once we have a better handle on our async state management.
} finally {
requests.delete(id);
}
})();
requests.set(id, promise);
}
if (isLoaded(source)) {
return Promise.resolve();
}
const deferred = defer();
requests.set(id, deferred.promise);
telemetry.start(loadSourceHistogram, source);
try {
await dispatch({
type: "LOAD_SOURCE_TEXT",
sourceId: source.id,
[PROMISE]: loadSource(getState(), source, { sourceMaps, client })
});
} catch (e) {
deferred.resolve();
requests.delete(id);
return;
}
const newSource = getSource(getState(), source.id);
if (!newSource) {
return;
}
if (!newSource.isWasm && isLoaded(newSource)) {
parser.setSource(newSource);
await dispatch(setBreakpointPositions(newSource.id));
}
// signal that the action is finished
deferred.resolve();
requests.delete(id);
return source;
return promise;
};
}

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

@ -10,7 +10,8 @@ import type { PromiseAction } from "../utils/middleware/promise";
export type LoadSourceAction = PromiseAction<
{|
+type: "LOAD_SOURCE_TEXT",
+sourceId: string
+sourceId: string,
+epoch: number
|},
Source
>;

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

@ -36,6 +36,8 @@ type DisplayedSources = { [ThreadId]: { [SourceId]: boolean } };
type GetDisplayedSourcesSelector = OuterState => { [ThreadId]: SourcesMap };
export type SourcesState = {
epoch: number,
// All known sources.
sources: SourcesMap,
@ -63,6 +65,7 @@ const emptySources = {
export function initialSourcesState(): SourcesState {
return {
...emptySources,
epoch: 1,
selectedLocation: undefined,
pendingSelectedLocation: prefs.pendingSelectedLocation,
projectDirectoryRoot: prefs.projectDirectoryRoot,
@ -164,7 +167,10 @@ function update(
return updateProjectDirectoryRoot(state, action.url);
case "NAVIGATE":
return initialSourcesState();
return {
...initialSourcesState(),
epoch: state.epoch + 1
};
case "SET_FOCUSED_SOURCE_ITEM":
return { ...state, focusedItem: action.item };
@ -296,15 +302,26 @@ function updateProjectDirectoryRoot(state: SourcesState, root: string) {
* Update a source's loaded state fields
* i.e. loadedState, text, error
*/
function updateLoadedState(state, action: LoadSourceAction): SourcesState {
function updateLoadedState(
state: SourcesState,
action: LoadSourceAction
): SourcesState {
const { sourceId } = action;
let source;
// If there was a navigation between the time the action was started and
// completed, we don't want to update the store.
if (action.epoch !== state.epoch) {
return state;
}
if (action.status === "start") {
source = { id: sourceId, loadedState: "loading" };
} else if (action.status === "error") {
source = { id: sourceId, error: action.error, loadedState: "loaded" };
} else {
// TODO: Remove this once we centralize pretty-print and this can no longer
// return a null value when loading a in-progress prettyprinting file.
if (!action.value) {
return state;
}
@ -522,6 +539,10 @@ export function getSources(state: OuterState) {
return state.sources.sources;
}
export function getSourcesEpoch(state: OuterState) {
return state.sources.epoch;
}
export function getUrls(state: OuterState) {
return state.sources.urls;
}

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

@ -6514,6 +6514,8 @@ nsINode* Document::AdoptNode(nsINode& aAdoptedNode, ErrorResult& rv) {
return adoptedNode;
}
bool Document::UseWidthDeviceWidthFallbackViewport() const { return false; }
void Document::ParseWidthAndHeightInMetaViewport(
const nsAString& aWidthString, const nsAString& aHeightString,
const nsAString& aScaleString) {
@ -6553,6 +6555,9 @@ void Document::ParseWidthAndHeightInMetaViewport(
mMinWidth = nsViewportInfo::ExtendToZoom;
mMaxWidth = nsViewportInfo::ExtendToZoom;
}
} else if (aHeightString.IsEmpty() && UseWidthDeviceWidthFallbackViewport()) {
mMinWidth = nsViewportInfo::ExtendToZoom;
mMaxWidth = nsViewportInfo::DeviceSize;
}
mMinHeight = nsViewportInfo::Auto;

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

@ -3576,6 +3576,13 @@ class Document : public nsINode,
protected:
RefPtr<DocumentL10n> mDocumentL10n;
/**
* Return true when you want a document without explicitly specified viewport
* dimensions/scale to be treated as if "width=device-width" had in fact been
* specified.
*/
virtual bool UseWidthDeviceWidthFallbackViewport() const;
private:
void InitializeLocalization(nsTArray<nsString>& aResourceIds);

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

@ -1,2 +1,7 @@
== test_bug920877.html test_bug920877-ref.html
HTTP == test_xmlPrettyPrint_csp.xml test_xmlPrettyPrint_csp-ref.xml
# Ordinarily, reftests use a browser.viewport.desktopWidth of 800px, same as the
# size of the reftest document. This test however needs something more representative
# of a real mobile device, where the desktop viewport width doesn't match the
# width of the device screen.
test-pref(dom.meta-viewport.enabled,true) test-pref(browser.viewport.desktopWidth,1200) test-pref(plain_text.wrap_long_lines,true) == test_bug1525662.txt test_bug1525662-ref.html

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

@ -0,0 +1,15 @@
<html>
<head>
<meta name="viewport" content="width=device-width">
</head>
<body>
<pre style="white-space: pre-wrap; word-wrap: break-word">Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Cras ac velit sed tellus facilisis euismod. Proin vel nulla vel turpis tristique dignissim. Donec lacus ipsum, eleifend ut, volutpat a, ultrices adipiscing, arcu. Etiam ligula dolor, adipiscing ut, porta vitae, bibendum non, dolor. Mauris ligula. Sed placerat tincidunt elit. Vestibulum non libero. Curabitur cursus tortor id sem. Integer consectetuer auctor lacus. Proin nisl nisi, pulvinar eget, pharetra at, aliquam eu, velit. Morbi fringilla. Quisque faucibus, mauris posuere vulputate interdum, lectus libero sollicitudin tellus, sit amet ultrices enim purus ac mauris. Pellentesque sit amet mauris eu ante aliquet egestas. Mauris dapibus, velit consectetuer tristique luctus, enim augue pulvinar libero, fringilla dictum lectus felis eu ligula. In ac lorem.
Integer laoreet. Ut ultricies arcu nec est. Aenean varius nisl ut odio. Nullam arcu. Vestibulum non pede. Proin vel est. Nam condimentum fermentum dui. Donec at arcu. Donec at libero adipiscing odio mattis dapibus. Suspendisse libero neque, faucibus sed, facilisis et, convallis sit amet, justo. Duis purus tortor, ornare ac, convallis ut, pretium et, tellus. Nam accumsan, ipsum eget accumsan mollis, sapien dolor adipiscing metus, id tincidunt ipsum metus sed nulla. Praesent hendrerit lectus eget tortor. Morbi id lectus et elit ultrices hendrerit. Cras gravida velit sed mauris. Proin lacinia tempus est. Sed sapien tortor, fringilla vel, elementum in, volutpat ac, ante. Vivamus eu tellus. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae;
Mauris in sem ac felis pretium placerat. Donec tempus cursus sem. Aliquam scelerisque porttitor sem. Curabitur consectetuer, pede vitae aliquam aliquet, sapien lacus vehicula neque, ut rhoncus nibh neque sed velit. In rhoncus, nulla eu dignissim egestas, diam nibh hendrerit mauris, condimentum laoreet sapien arcu quis mi. Sed euismod sem. Nulla non ligula sed lacus tempor molestie. Quisque varius. In hac habitasse platea dictumst. Sed felis ipsum, consequat et, blandit vitae, tincidunt id, quam. Nunc nunc. Duis gravida. In massa neque, cursus quis, rutrum sed, semper quis, erat. Donec enim. Suspendisse condimentum eros vel elit. Vestibulum adipiscing erat id lorem. Maecenas enim dui, cursus a, pulvinar ac, rutrum sed, sem. Suspendisse gravida ante vel lectus.
Vestibulum molestie, ante at dignissim venenatis, pede urna dictum arcu, vel ullamcorper ligula eros eget metus. Pellentesque nec nisl. Morbi ut nibh. Aenean mauris. Mauris rutrum justo nec velit. Nunc condimentum tortor id augue. Quisque semper massa eget nibh. Maecenas ac odio pretium lorem tincidunt faucibus. Sed congue. Cras sit amet orci ut ligula cursus congue. Etiam laoreet lacus sit amet tortor. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Vivamus accumsan. Ut gravida urna hendrerit leo. Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
</pre>
</body>
</html>

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

@ -0,0 +1,7 @@
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Cras ac velit sed tellus facilisis euismod. Proin vel nulla vel turpis tristique dignissim. Donec lacus ipsum, eleifend ut, volutpat a, ultrices adipiscing, arcu. Etiam ligula dolor, adipiscing ut, porta vitae, bibendum non, dolor. Mauris ligula. Sed placerat tincidunt elit. Vestibulum non libero. Curabitur cursus tortor id sem. Integer consectetuer auctor lacus. Proin nisl nisi, pulvinar eget, pharetra at, aliquam eu, velit. Morbi fringilla. Quisque faucibus, mauris posuere vulputate interdum, lectus libero sollicitudin tellus, sit amet ultrices enim purus ac mauris. Pellentesque sit amet mauris eu ante aliquet egestas. Mauris dapibus, velit consectetuer tristique luctus, enim augue pulvinar libero, fringilla dictum lectus felis eu ligula. In ac lorem.
Integer laoreet. Ut ultricies arcu nec est. Aenean varius nisl ut odio. Nullam arcu. Vestibulum non pede. Proin vel est. Nam condimentum fermentum dui. Donec at arcu. Donec at libero adipiscing odio mattis dapibus. Suspendisse libero neque, faucibus sed, facilisis et, convallis sit amet, justo. Duis purus tortor, ornare ac, convallis ut, pretium et, tellus. Nam accumsan, ipsum eget accumsan mollis, sapien dolor adipiscing metus, id tincidunt ipsum metus sed nulla. Praesent hendrerit lectus eget tortor. Morbi id lectus et elit ultrices hendrerit. Cras gravida velit sed mauris. Proin lacinia tempus est. Sed sapien tortor, fringilla vel, elementum in, volutpat ac, ante. Vivamus eu tellus. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae;
Mauris in sem ac felis pretium placerat. Donec tempus cursus sem. Aliquam scelerisque porttitor sem. Curabitur consectetuer, pede vitae aliquam aliquet, sapien lacus vehicula neque, ut rhoncus nibh neque sed velit. In rhoncus, nulla eu dignissim egestas, diam nibh hendrerit mauris, condimentum laoreet sapien arcu quis mi. Sed euismod sem. Nulla non ligula sed lacus tempor molestie. Quisque varius. In hac habitasse platea dictumst. Sed felis ipsum, consequat et, blandit vitae, tincidunt id, quam. Nunc nunc. Duis gravida. In massa neque, cursus quis, rutrum sed, semper quis, erat. Donec enim. Suspendisse condimentum eros vel elit. Vestibulum adipiscing erat id lorem. Maecenas enim dui, cursus a, pulvinar ac, rutrum sed, sem. Suspendisse gravida ante vel lectus.
Vestibulum molestie, ante at dignissim venenatis, pede urna dictum arcu, vel ullamcorper ligula eros eget metus. Pellentesque nec nisl. Morbi ut nibh. Aenean mauris. Mauris rutrum justo nec velit. Nunc condimentum tortor id augue. Quisque semper massa eget nibh. Maecenas ac odio pretium lorem tincidunt faucibus. Sed congue. Cras sit amet orci ut ligula cursus congue. Etiam laoreet lacus sit amet tortor. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Vivamus accumsan. Ut gravida urna hendrerit leo. Lorem ipsum dolor sit amet, consectetuer adipiscing elit.

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

@ -181,7 +181,8 @@ nsHTMLDocument::nsHTMLDocument()
mEditingState(EditingState::eOff),
mDisableCookieAccess(false),
mPendingMaybeEditingStateChanged(false),
mHasBeenEditable(false) {
mHasBeenEditable(false),
mIsPlainText(false) {
mType = eHTML;
mDefaultElementType = kNameSpaceID_XHTML;
mCompatMode = eCompatibility_NavQuirks;
@ -492,15 +493,15 @@ nsresult nsHTMLDocument::StartDocumentLoad(const char* aCommand,
bool html = contentType.EqualsLiteral(TEXT_HTML);
bool xhtml = !html && (contentType.EqualsLiteral(APPLICATION_XHTML_XML) ||
contentType.EqualsLiteral(APPLICATION_WAPXHTML_XML));
bool plainText =
mIsPlainText =
!html && !xhtml && nsContentUtils::IsPlainTextType(contentType);
if (!(html || xhtml || plainText || viewSource)) {
if (!(html || xhtml || mIsPlainText || viewSource)) {
MOZ_ASSERT(false, "Channel with bad content type.");
return NS_ERROR_INVALID_ARG;
}
bool forceUtf8 =
plainText && nsContentUtils::IsUtf8OnlyPlainTextType(contentType);
mIsPlainText && nsContentUtils::IsUtf8OnlyPlainTextType(contentType);
bool loadAsHtml5 = true;
@ -549,7 +550,7 @@ nsresult nsHTMLDocument::StartDocumentLoad(const char* aCommand,
bool loadWithPrototype = false;
if (loadAsHtml5) {
mParser = nsHtml5Module::NewHtml5Parser();
if (plainText) {
if (mIsPlainText) {
if (viewSource) {
mParser->MarkAsNotScriptCreated("view-source-plain");
} else {
@ -706,7 +707,7 @@ nsresult nsHTMLDocument::StartDocumentLoad(const char* aCommand,
}
}
if (plainText && !nsContentUtils::IsChildOfSameType(this) &&
if (mIsPlainText && !nsContentUtils::IsChildOfSameType(this) &&
Preferences::GetBool("plain_text.wrap_long_lines")) {
nsCOMPtr<nsIStringBundleService> bundleService =
do_GetService(NS_STRINGBUNDLE_CONTRACTID, &rv);
@ -786,6 +787,16 @@ void nsHTMLDocument::SetCompatibilityMode(nsCompatibility aMode) {
}
}
bool nsHTMLDocument::UseWidthDeviceWidthFallbackViewport() const {
if (mIsPlainText) {
// Plain text documents are simple enough that font inflation doesn't offer
// any appreciable advantage over defaulting to "width=device-width" and
// subsequently turning on word-wrapping.
return true;
}
return Document::UseWidthDeviceWidthFallbackViewport();
}
Element* nsHTMLDocument::GetUnfocusedKeyEventTarget() {
if (nsGenericHTMLElement* body = GetBody()) {
return body;

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

@ -68,6 +68,10 @@ class nsHTMLDocument : public mozilla::dom::Document, public nsIHTMLDocument {
virtual void BeginLoad() override;
virtual void EndLoad() override;
protected:
virtual bool UseWidthDeviceWidthFallbackViewport() const override;
public:
// nsIHTMLDocument
virtual void SetCompatibilityMode(nsCompatibility aMode) override;
@ -343,6 +347,11 @@ class nsHTMLDocument : public mozilla::dom::Document, public nsIHTMLDocument {
// mHasBeenEditable is set to true when mEditingState is firstly set to
// eDesignMode or eContentEditable.
bool mHasBeenEditable;
/**
* Set to true once we know that we are loading plain text content.
*/
bool mIsPlainText;
};
namespace mozilla {

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

@ -117,6 +117,7 @@ nsPNGDecoder::nsPNGDecoder(RasterImage* aImage)
mPass(0),
mFrameIsHidden(false),
mDisablePremultipliedAlpha(false),
mGotInfoCallback(false),
mNumFrames(0) {}
nsPNGDecoder::~nsPNGDecoder() {
@ -537,6 +538,13 @@ void nsPNGDecoder::info_callback(png_structp png_ptr, png_infop info_ptr) {
nsPNGDecoder* decoder =
static_cast<nsPNGDecoder*>(png_get_progressive_ptr(png_ptr));
if (decoder->mGotInfoCallback) {
MOZ_LOG(sPNGLog, LogLevel::Warning, ("libpng called info_callback more than once\n"));
return;
}
decoder->mGotInfoCallback = true;
// Always decode to 24-bit RGB or 32-bit RGBA
png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth, &color_type,
&interlace_type, &compression_type, &filter_type);

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

@ -103,6 +103,7 @@ class nsPNGDecoder : public Decoder {
uint8_t mPass;
bool mFrameIsHidden;
bool mDisablePremultipliedAlpha;
bool mGotInfoCallback;
struct AnimFrameInfo {
AnimFrameInfo();

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

@ -0,0 +1 @@
<img height="64" width="64" src="fuzz-1311.png?0.5592939664601271">

Двоичные данные
image/test/crashtests/1526717-1.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 318 B

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

@ -58,3 +58,5 @@ load truncated-second-frame.png # Bug 863975
# Bug 1509998 - Ensure that we handle empty frame rects in animated images.
load 1509998.gif
load 1526717-1.html

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

@ -380,6 +380,9 @@ pref("browser.ui.zoom.force-user-scalable", false);
// With the typical screen sizes on mobile devices, we want to wrap page sources by default.
pref("view_source.wrap_long_lines", true);
// Ditto for plain text documents.
pref("plain_text.wrap_long_lines", true);
pref("ui.touch.radius.enabled", false);
pref("ui.touch.radius.leftmm", 3);

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 258 KiB

После

Ширина:  |  Высота:  |  Размер: 23 KiB

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

@ -1 +1 @@
NSS_3_43_BETA2
NSS_3_43_BETA3

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

@ -10,4 +10,3 @@
*/
#error "Do not include this header file."

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

@ -111,8 +111,6 @@
'cmd/smimetools/smimetools.gyp:cmsutil',
],
}],
],
'conditions': [
[ 'mozilla_client==0', {
'dependencies': [
'cmd/crlutil/crlutil.gyp:crlutil',