mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-05 23:07:31 +09:00
Merge remote-tracking branch 'origin/tracking' into custom
This commit is contained in:
commit
6414271c91
47 changed files with 3341 additions and 1968 deletions
File diff suppressed because it is too large
Load diff
|
|
@ -133,7 +133,7 @@ extern "C" {
|
||||||
**
|
**
|
||||||
** Since [version 3.6.18] ([dateof:3.6.18]),
|
** Since [version 3.6.18] ([dateof:3.6.18]),
|
||||||
** SQLite source code has been stored in the
|
** SQLite source code has been stored in the
|
||||||
** <a href="http://www.fossil-scm.org/">Fossil configuration management
|
** <a href="http://fossil-scm.org/">Fossil configuration management
|
||||||
** system</a>. ^The SQLITE_SOURCE_ID macro evaluates to
|
** system</a>. ^The SQLITE_SOURCE_ID macro evaluates to
|
||||||
** a string which identifies a particular check-in of SQLite
|
** a string which identifies a particular check-in of SQLite
|
||||||
** within its configuration management system. ^The SQLITE_SOURCE_ID
|
** within its configuration management system. ^The SQLITE_SOURCE_ID
|
||||||
|
|
@ -146,9 +146,9 @@ extern "C" {
|
||||||
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
|
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
|
||||||
** [sqlite_version()] and [sqlite_source_id()].
|
** [sqlite_version()] and [sqlite_source_id()].
|
||||||
*/
|
*/
|
||||||
#define SQLITE_VERSION "3.49.1"
|
#define SQLITE_VERSION "3.50.1"
|
||||||
#define SQLITE_VERSION_NUMBER 3049001
|
#define SQLITE_VERSION_NUMBER 3050001
|
||||||
#define SQLITE_SOURCE_ID "2025-02-18 13:38:58 873d4e274b4988d260ba8354a9718324a1c26187a4ab4c1cc0227c03d0f10e70"
|
#define SQLITE_SOURCE_ID "2025-06-06 14:52:32 b77dc5e0f596d2140d9ac682b2893ff65d3a4140aa86067a3efebe29dc914c95"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** CAPI3REF: Run-Time Library Version Numbers
|
** CAPI3REF: Run-Time Library Version Numbers
|
||||||
|
|
@ -1163,6 +1163,12 @@ struct sqlite3_io_methods {
|
||||||
** the value that M is to be set to. Before returning, the 32-bit signed
|
** the value that M is to be set to. Before returning, the 32-bit signed
|
||||||
** integer is overwritten with the previous value of M.
|
** integer is overwritten with the previous value of M.
|
||||||
**
|
**
|
||||||
|
** <li>[[SQLITE_FCNTL_BLOCK_ON_CONNECT]]
|
||||||
|
** The [SQLITE_FCNTL_BLOCK_ON_CONNECT] opcode is used to configure the
|
||||||
|
** VFS to block when taking a SHARED lock to connect to a wal mode database.
|
||||||
|
** This is used to implement the functionality associated with
|
||||||
|
** SQLITE_SETLK_BLOCK_ON_CONNECT.
|
||||||
|
**
|
||||||
** <li>[[SQLITE_FCNTL_DATA_VERSION]]
|
** <li>[[SQLITE_FCNTL_DATA_VERSION]]
|
||||||
** The [SQLITE_FCNTL_DATA_VERSION] opcode is used to detect changes to
|
** The [SQLITE_FCNTL_DATA_VERSION] opcode is used to detect changes to
|
||||||
** a database file. The argument is a pointer to a 32-bit unsigned integer.
|
** a database file. The argument is a pointer to a 32-bit unsigned integer.
|
||||||
|
|
@ -1259,6 +1265,7 @@ struct sqlite3_io_methods {
|
||||||
#define SQLITE_FCNTL_CKSM_FILE 41
|
#define SQLITE_FCNTL_CKSM_FILE 41
|
||||||
#define SQLITE_FCNTL_RESET_CACHE 42
|
#define SQLITE_FCNTL_RESET_CACHE 42
|
||||||
#define SQLITE_FCNTL_NULL_IO 43
|
#define SQLITE_FCNTL_NULL_IO 43
|
||||||
|
#define SQLITE_FCNTL_BLOCK_ON_CONNECT 44
|
||||||
|
|
||||||
/* deprecated names */
|
/* deprecated names */
|
||||||
#define SQLITE_GET_LOCKPROXYFILE SQLITE_FCNTL_GET_LOCKPROXYFILE
|
#define SQLITE_GET_LOCKPROXYFILE SQLITE_FCNTL_GET_LOCKPROXYFILE
|
||||||
|
|
@ -1989,13 +1996,16 @@ struct sqlite3_mem_methods {
|
||||||
**
|
**
|
||||||
** [[SQLITE_CONFIG_LOOKASIDE]] <dt>SQLITE_CONFIG_LOOKASIDE</dt>
|
** [[SQLITE_CONFIG_LOOKASIDE]] <dt>SQLITE_CONFIG_LOOKASIDE</dt>
|
||||||
** <dd> ^(The SQLITE_CONFIG_LOOKASIDE option takes two arguments that determine
|
** <dd> ^(The SQLITE_CONFIG_LOOKASIDE option takes two arguments that determine
|
||||||
** the default size of lookaside memory on each [database connection].
|
** the default size of [lookaside memory] on each [database connection].
|
||||||
** The first argument is the
|
** The first argument is the
|
||||||
** size of each lookaside buffer slot and the second is the number of
|
** size of each lookaside buffer slot ("sz") and the second is the number of
|
||||||
** slots allocated to each database connection.)^ ^(SQLITE_CONFIG_LOOKASIDE
|
** slots allocated to each database connection ("cnt").)^
|
||||||
** sets the <i>default</i> lookaside size. The [SQLITE_DBCONFIG_LOOKASIDE]
|
** ^(SQLITE_CONFIG_LOOKASIDE sets the <i>default</i> lookaside size.
|
||||||
** option to [sqlite3_db_config()] can be used to change the lookaside
|
** The [SQLITE_DBCONFIG_LOOKASIDE] option to [sqlite3_db_config()] can
|
||||||
** configuration on individual connections.)^ </dd>
|
** be used to change the lookaside configuration on individual connections.)^
|
||||||
|
** The [-DSQLITE_DEFAULT_LOOKASIDE] option can be used to change the
|
||||||
|
** default lookaside configuration at compile-time.
|
||||||
|
** </dd>
|
||||||
**
|
**
|
||||||
** [[SQLITE_CONFIG_PCACHE2]] <dt>SQLITE_CONFIG_PCACHE2</dt>
|
** [[SQLITE_CONFIG_PCACHE2]] <dt>SQLITE_CONFIG_PCACHE2</dt>
|
||||||
** <dd> ^(The SQLITE_CONFIG_PCACHE2 option takes a single argument which is
|
** <dd> ^(The SQLITE_CONFIG_PCACHE2 option takes a single argument which is
|
||||||
|
|
@ -2232,31 +2242,50 @@ struct sqlite3_mem_methods {
|
||||||
** [[SQLITE_DBCONFIG_LOOKASIDE]]
|
** [[SQLITE_DBCONFIG_LOOKASIDE]]
|
||||||
** <dt>SQLITE_DBCONFIG_LOOKASIDE</dt>
|
** <dt>SQLITE_DBCONFIG_LOOKASIDE</dt>
|
||||||
** <dd> The SQLITE_DBCONFIG_LOOKASIDE option is used to adjust the
|
** <dd> The SQLITE_DBCONFIG_LOOKASIDE option is used to adjust the
|
||||||
** configuration of the lookaside memory allocator within a database
|
** configuration of the [lookaside memory allocator] within a database
|
||||||
** connection.
|
** connection.
|
||||||
** The arguments to the SQLITE_DBCONFIG_LOOKASIDE option are <i>not</i>
|
** The arguments to the SQLITE_DBCONFIG_LOOKASIDE option are <i>not</i>
|
||||||
** in the [DBCONFIG arguments|usual format].
|
** in the [DBCONFIG arguments|usual format].
|
||||||
** The SQLITE_DBCONFIG_LOOKASIDE option takes three arguments, not two,
|
** The SQLITE_DBCONFIG_LOOKASIDE option takes three arguments, not two,
|
||||||
** so that a call to [sqlite3_db_config()] that uses SQLITE_DBCONFIG_LOOKASIDE
|
** so that a call to [sqlite3_db_config()] that uses SQLITE_DBCONFIG_LOOKASIDE
|
||||||
** should have a total of five parameters.
|
** should have a total of five parameters.
|
||||||
** ^The first argument (the third parameter to [sqlite3_db_config()] is a
|
** <ol>
|
||||||
|
** <li><p>The first argument ("buf") is a
|
||||||
** pointer to a memory buffer to use for lookaside memory.
|
** pointer to a memory buffer to use for lookaside memory.
|
||||||
** ^The first argument after the SQLITE_DBCONFIG_LOOKASIDE verb
|
** The first argument may be NULL in which case SQLite will allocate the
|
||||||
** may be NULL in which case SQLite will allocate the
|
** lookaside buffer itself using [sqlite3_malloc()].
|
||||||
** lookaside buffer itself using [sqlite3_malloc()]. ^The second argument is the
|
** <li><P>The second argument ("sz") is the
|
||||||
** size of each lookaside buffer slot. ^The third argument is the number of
|
** size of each lookaside buffer slot. Lookaside is disabled if "sz"
|
||||||
** slots. The size of the buffer in the first argument must be greater than
|
** is less than 8. The "sz" argument should be a multiple of 8 less than
|
||||||
** or equal to the product of the second and third arguments. The buffer
|
** 65536. If "sz" does not meet this constraint, it is reduced in size until
|
||||||
** must be aligned to an 8-byte boundary. ^If the second argument to
|
** it does.
|
||||||
** SQLITE_DBCONFIG_LOOKASIDE is not a multiple of 8, it is internally
|
** <li><p>The third argument ("cnt") is the number of slots. Lookaside is disabled
|
||||||
** rounded down to the next smaller multiple of 8. ^(The lookaside memory
|
** if "cnt"is less than 1. The "cnt" value will be reduced, if necessary, so
|
||||||
|
** that the product of "sz" and "cnt" does not exceed 2,147,418,112. The "cnt"
|
||||||
|
** parameter is usually chosen so that the product of "sz" and "cnt" is less
|
||||||
|
** than 1,000,000.
|
||||||
|
** </ol>
|
||||||
|
** <p>If the "buf" argument is not NULL, then it must
|
||||||
|
** point to a memory buffer with a size that is greater than
|
||||||
|
** or equal to the product of "sz" and "cnt".
|
||||||
|
** The buffer must be aligned to an 8-byte boundary.
|
||||||
|
** The lookaside memory
|
||||||
** configuration for a database connection can only be changed when that
|
** configuration for a database connection can only be changed when that
|
||||||
** connection is not currently using lookaside memory, or in other words
|
** connection is not currently using lookaside memory, or in other words
|
||||||
** when the "current value" returned by
|
** when the value returned by [SQLITE_DBSTATUS_LOOKASIDE_USED] is zero.
|
||||||
** [sqlite3_db_status](D,[SQLITE_DBSTATUS_LOOKASIDE_USED],...) is zero.
|
|
||||||
** Any attempt to change the lookaside memory configuration when lookaside
|
** Any attempt to change the lookaside memory configuration when lookaside
|
||||||
** memory is in use leaves the configuration unchanged and returns
|
** memory is in use leaves the configuration unchanged and returns
|
||||||
** [SQLITE_BUSY].)^</dd>
|
** [SQLITE_BUSY].
|
||||||
|
** If the "buf" argument is NULL and an attempt
|
||||||
|
** to allocate memory based on "sz" and "cnt" fails, then
|
||||||
|
** lookaside is silently disabled.
|
||||||
|
** <p>
|
||||||
|
** The [SQLITE_CONFIG_LOOKASIDE] configuration option can be used to set the
|
||||||
|
** default lookaside configuration at initialization. The
|
||||||
|
** [-DSQLITE_DEFAULT_LOOKASIDE] option can be used to set the default lookaside
|
||||||
|
** configuration at compile-time. Typical values for lookaside are 1200 for
|
||||||
|
** "sz" and 40 to 100 for "cnt".
|
||||||
|
** </dd>
|
||||||
**
|
**
|
||||||
** [[SQLITE_DBCONFIG_ENABLE_FKEY]]
|
** [[SQLITE_DBCONFIG_ENABLE_FKEY]]
|
||||||
** <dt>SQLITE_DBCONFIG_ENABLE_FKEY</dt>
|
** <dt>SQLITE_DBCONFIG_ENABLE_FKEY</dt>
|
||||||
|
|
@ -2993,6 +3022,44 @@ SQLITE_API int sqlite3_busy_handler(sqlite3*,int(*)(void*,int),void*);
|
||||||
*/
|
*/
|
||||||
SQLITE_API int sqlite3_busy_timeout(sqlite3*, int ms);
|
SQLITE_API int sqlite3_busy_timeout(sqlite3*, int ms);
|
||||||
|
|
||||||
|
/*
|
||||||
|
** CAPI3REF: Set the Setlk Timeout
|
||||||
|
** METHOD: sqlite3
|
||||||
|
**
|
||||||
|
** This routine is only useful in SQLITE_ENABLE_SETLK_TIMEOUT builds. If
|
||||||
|
** the VFS supports blocking locks, it sets the timeout in ms used by
|
||||||
|
** eligible locks taken on wal mode databases by the specified database
|
||||||
|
** handle. In non-SQLITE_ENABLE_SETLK_TIMEOUT builds, or if the VFS does
|
||||||
|
** not support blocking locks, this function is a no-op.
|
||||||
|
**
|
||||||
|
** Passing 0 to this function disables blocking locks altogether. Passing
|
||||||
|
** -1 to this function requests that the VFS blocks for a long time -
|
||||||
|
** indefinitely if possible. The results of passing any other negative value
|
||||||
|
** are undefined.
|
||||||
|
**
|
||||||
|
** Internally, each SQLite database handle store two timeout values - the
|
||||||
|
** busy-timeout (used for rollback mode databases, or if the VFS does not
|
||||||
|
** support blocking locks) and the setlk-timeout (used for blocking locks
|
||||||
|
** on wal-mode databases). The sqlite3_busy_timeout() method sets both
|
||||||
|
** values, this function sets only the setlk-timeout value. Therefore,
|
||||||
|
** to configure separate busy-timeout and setlk-timeout values for a single
|
||||||
|
** database handle, call sqlite3_busy_timeout() followed by this function.
|
||||||
|
**
|
||||||
|
** Whenever the number of connections to a wal mode database falls from
|
||||||
|
** 1 to 0, the last connection takes an exclusive lock on the database,
|
||||||
|
** then checkpoints and deletes the wal file. While it is doing this, any
|
||||||
|
** new connection that tries to read from the database fails with an
|
||||||
|
** SQLITE_BUSY error. Or, if the SQLITE_SETLK_BLOCK_ON_CONNECT flag is
|
||||||
|
** passed to this API, the new connection blocks until the exclusive lock
|
||||||
|
** has been released.
|
||||||
|
*/
|
||||||
|
SQLITE_API int sqlite3_setlk_timeout(sqlite3*, int ms, int flags);
|
||||||
|
|
||||||
|
/*
|
||||||
|
** CAPI3REF: Flags for sqlite3_setlk_timeout()
|
||||||
|
*/
|
||||||
|
#define SQLITE_SETLK_BLOCK_ON_CONNECT 0x01
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** CAPI3REF: Convenience Routines For Running Queries
|
** CAPI3REF: Convenience Routines For Running Queries
|
||||||
** METHOD: sqlite3
|
** METHOD: sqlite3
|
||||||
|
|
@ -5108,7 +5175,7 @@ SQLITE_API const void *sqlite3_column_decltype16(sqlite3_stmt*,int);
|
||||||
** other than [SQLITE_ROW] before any subsequent invocation of
|
** other than [SQLITE_ROW] before any subsequent invocation of
|
||||||
** sqlite3_step(). Failure to reset the prepared statement using
|
** sqlite3_step(). Failure to reset the prepared statement using
|
||||||
** [sqlite3_reset()] would result in an [SQLITE_MISUSE] return from
|
** [sqlite3_reset()] would result in an [SQLITE_MISUSE] return from
|
||||||
** sqlite3_step(). But after [version 3.6.23.1] ([dateof:3.6.23.1],
|
** sqlite3_step(). But after [version 3.6.23.1] ([dateof:3.6.23.1]),
|
||||||
** sqlite3_step() began
|
** sqlite3_step() began
|
||||||
** calling [sqlite3_reset()] automatically in this circumstance rather
|
** calling [sqlite3_reset()] automatically in this circumstance rather
|
||||||
** than returning [SQLITE_MISUSE]. This is not considered a compatibility
|
** than returning [SQLITE_MISUSE]. This is not considered a compatibility
|
||||||
|
|
@ -7004,6 +7071,8 @@ SQLITE_API int sqlite3_autovacuum_pages(
|
||||||
**
|
**
|
||||||
** ^The second argument is a pointer to the function to invoke when a
|
** ^The second argument is a pointer to the function to invoke when a
|
||||||
** row is updated, inserted or deleted in a rowid table.
|
** row is updated, inserted or deleted in a rowid table.
|
||||||
|
** ^The update hook is disabled by invoking sqlite3_update_hook()
|
||||||
|
** with a NULL pointer as the second parameter.
|
||||||
** ^The first argument to the callback is a copy of the third argument
|
** ^The first argument to the callback is a copy of the third argument
|
||||||
** to sqlite3_update_hook().
|
** to sqlite3_update_hook().
|
||||||
** ^The second callback argument is one of [SQLITE_INSERT], [SQLITE_DELETE],
|
** ^The second callback argument is one of [SQLITE_INSERT], [SQLITE_DELETE],
|
||||||
|
|
@ -11486,9 +11555,10 @@ SQLITE_API void sqlite3session_table_filter(
|
||||||
** is inserted while a session object is enabled, then later deleted while
|
** is inserted while a session object is enabled, then later deleted while
|
||||||
** the same session object is disabled, no INSERT record will appear in the
|
** the same session object is disabled, no INSERT record will appear in the
|
||||||
** changeset, even though the delete took place while the session was disabled.
|
** changeset, even though the delete took place while the session was disabled.
|
||||||
** Or, if one field of a row is updated while a session is disabled, and
|
** Or, if one field of a row is updated while a session is enabled, and
|
||||||
** another field of the same row is updated while the session is enabled, the
|
** then another field of the same row is updated while the session is disabled,
|
||||||
** resulting changeset will contain an UPDATE change that updates both fields.
|
** the resulting changeset will contain an UPDATE change that updates both
|
||||||
|
** fields.
|
||||||
*/
|
*/
|
||||||
SQLITE_API int sqlite3session_changeset(
|
SQLITE_API int sqlite3session_changeset(
|
||||||
sqlite3_session *pSession, /* Session object */
|
sqlite3_session *pSession, /* Session object */
|
||||||
|
|
@ -11560,8 +11630,9 @@ SQLITE_API sqlite3_int64 sqlite3session_changeset_size(sqlite3_session *pSession
|
||||||
** database zFrom the contents of the two compatible tables would be
|
** database zFrom the contents of the two compatible tables would be
|
||||||
** identical.
|
** identical.
|
||||||
**
|
**
|
||||||
** It an error if database zFrom does not exist or does not contain the
|
** Unless the call to this function is a no-op as described above, it is an
|
||||||
** required compatible table.
|
** error if database zFrom does not exist or does not contain the required
|
||||||
|
** compatible table.
|
||||||
**
|
**
|
||||||
** If the operation is successful, SQLITE_OK is returned. Otherwise, an SQLite
|
** If the operation is successful, SQLITE_OK is returned. Otherwise, an SQLite
|
||||||
** error code. In this case, if argument pzErrMsg is not NULL, *pzErrMsg
|
** error code. In this case, if argument pzErrMsg is not NULL, *pzErrMsg
|
||||||
|
|
@ -11696,7 +11767,7 @@ SQLITE_API int sqlite3changeset_start_v2(
|
||||||
** The following flags may passed via the 4th parameter to
|
** The following flags may passed via the 4th parameter to
|
||||||
** [sqlite3changeset_start_v2] and [sqlite3changeset_start_v2_strm]:
|
** [sqlite3changeset_start_v2] and [sqlite3changeset_start_v2_strm]:
|
||||||
**
|
**
|
||||||
** <dt>SQLITE_CHANGESETAPPLY_INVERT <dd>
|
** <dt>SQLITE_CHANGESETSTART_INVERT <dd>
|
||||||
** Invert the changeset while iterating through it. This is equivalent to
|
** Invert the changeset while iterating through it. This is equivalent to
|
||||||
** inverting a changeset using sqlite3changeset_invert() before applying it.
|
** inverting a changeset using sqlite3changeset_invert() before applying it.
|
||||||
** It is an error to specify this flag with a patchset.
|
** It is an error to specify this flag with a patchset.
|
||||||
|
|
@ -12011,19 +12082,6 @@ SQLITE_API int sqlite3changeset_concat(
|
||||||
void **ppOut /* OUT: Buffer containing output changeset */
|
void **ppOut /* OUT: Buffer containing output changeset */
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
** CAPI3REF: Upgrade the Schema of a Changeset/Patchset
|
|
||||||
*/
|
|
||||||
SQLITE_API int sqlite3changeset_upgrade(
|
|
||||||
sqlite3 *db,
|
|
||||||
const char *zDb,
|
|
||||||
int nIn, const void *pIn, /* Input changeset */
|
|
||||||
int *pnOut, void **ppOut /* OUT: Inverse of input */
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** CAPI3REF: Changegroup Handle
|
** CAPI3REF: Changegroup Handle
|
||||||
**
|
**
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@
|
||||||
* Copyright (C) 2008, 2009 Anthony Ricaud <rik@webkit.org>
|
* Copyright (C) 2008, 2009 Anthony Ricaud <rik@webkit.org>
|
||||||
* Copyright (C) 2011 Google Inc. All rights reserved.
|
* Copyright (C) 2011 Google Inc. All rights reserved.
|
||||||
* Copyright (C) 2009 Mozilla Foundation. All rights reserved.
|
* Copyright (C) 2009 Mozilla Foundation. All rights reserved.
|
||||||
* Copyright (C) 2022, 2023 Moonchild Productions. All rights reserved.
|
* Copyright (C) 2022, 2023, 2025 Moonchild Productions. All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions
|
* modification, are permitted provided that the following conditions
|
||||||
|
|
@ -60,17 +60,11 @@ const Curl = {
|
||||||
generateCommand: function (data) {
|
generateCommand: function (data) {
|
||||||
const utils = CurlUtils;
|
const utils = CurlUtils;
|
||||||
|
|
||||||
let command = ["curl"];
|
let commandParts = [];
|
||||||
|
|
||||||
// Make sure to use the following helpers to sanitize arguments before execution.
|
// Make sure to use the following helpers to sanitize arguments before execution.
|
||||||
const addParam = value => {
|
const escapeStringifNeeded = value => {
|
||||||
const safe = /^[a-zA-Z-]+$/.test(value) ? value : escapeString(value);
|
return /^[a-zA-Z-]+$/.test(value) ? value : escapeString(value);
|
||||||
command.push(safe);
|
|
||||||
};
|
|
||||||
|
|
||||||
const addPostData = value => {
|
|
||||||
const safe = /^[a-zA-Z-]+$/.test(value) ? value : escapeString(value);
|
|
||||||
postData.push(safe);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
let ignoredHeaders = new Set();
|
let ignoredHeaders = new Set();
|
||||||
|
|
@ -81,7 +75,13 @@ const Curl = {
|
||||||
utils.escapeStringWin : utils.escapeStringPosix;
|
utils.escapeStringWin : utils.escapeStringPosix;
|
||||||
|
|
||||||
// Add URL.
|
// Add URL.
|
||||||
addParam(data.url);
|
commandParts.push(data.url);
|
||||||
|
|
||||||
|
// Disable globbing if the URL contains brackets.
|
||||||
|
// cURL also globs braces but they are already percent-encoded.
|
||||||
|
if (data.url.includes("[") || data.url.includes("]")) {
|
||||||
|
commandParts.push("--globoff");
|
||||||
|
}
|
||||||
|
|
||||||
let postDataText = null;
|
let postDataText = null;
|
||||||
let multipartRequest = utils.isMultipartRequest(data);
|
let multipartRequest = utils.isMultipartRequest(data);
|
||||||
|
|
@ -91,15 +91,16 @@ const Curl = {
|
||||||
if (utils.isUrlEncodedRequest(data) ||
|
if (utils.isUrlEncodedRequest(data) ||
|
||||||
["PUT", "POST", "PATCH"].includes(data.method)) {
|
["PUT", "POST", "PATCH"].includes(data.method)) {
|
||||||
postDataText = data.postDataText;
|
postDataText = data.postDataText;
|
||||||
addPostData("--data-raw");
|
postData.push("--data-raw");
|
||||||
addPostData(utils.writePostDataTextParams(postDataText));
|
let text =utils.writePostDataTextParams(postDataText);
|
||||||
|
postData.push(escapeStringifNeeded(text));
|
||||||
ignoredHeaders.add("content-length");
|
ignoredHeaders.add("content-length");
|
||||||
} else if (multipartRequest) {
|
} else if (multipartRequest) {
|
||||||
postDataText = data.postDataText;
|
postDataText = data.postDataText;
|
||||||
addPostData("--data-binary");
|
postData.push("--data-binary");
|
||||||
let boundary = utils.getMultipartBoundary(data);
|
let boundary = utils.getMultipartBoundary(data);
|
||||||
let text = utils.removeBinaryDataFromMultipartText(postDataText, boundary);
|
let text = utils.removeBinaryDataFromMultipartText(postDataText, boundary);
|
||||||
addPostData(text);
|
postData.push(escapeStringifNeeded(text));
|
||||||
ignoredHeaders.add("content-length");
|
ignoredHeaders.add("content-length");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -107,15 +108,15 @@ const Curl = {
|
||||||
// For GET and POST requests this is not necessary as GET is the
|
// For GET and POST requests this is not necessary as GET is the
|
||||||
// default. If --data or --binary is added POST is the default.
|
// default. If --data or --binary is added POST is the default.
|
||||||
if (!(data.method == "GET" || data.method == "POST")) {
|
if (!(data.method == "GET" || data.method == "POST")) {
|
||||||
addParam("-X");
|
commandParts.push("-X");
|
||||||
addParam(data.method);
|
commandParts.push(data.method);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add -I (HEAD)
|
// Add -I (HEAD)
|
||||||
// For servers that supports HEAD.
|
// For servers that supports HEAD.
|
||||||
// This will fetch the header of a document only.
|
// This will fetch the header of a document only.
|
||||||
if (data.method == "HEAD") {
|
if (data.method == "HEAD") {
|
||||||
addParam("-I");
|
commandParts.push("-I");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add http version.
|
// Add http version.
|
||||||
|
|
@ -126,7 +127,7 @@ const Curl = {
|
||||||
// data.httpVersion are HTTP/1.0, HTTP/1.1 and HTTP/2.0
|
// data.httpVersion are HTTP/1.0, HTTP/1.1 and HTTP/2.0
|
||||||
// So in case of HTTP/2.0 (which should ideally be HTTP/2) we are using
|
// So in case of HTTP/2.0 (which should ideally be HTTP/2) we are using
|
||||||
// only major version, and full version in other cases
|
// only major version, and full version in other cases
|
||||||
addParam("--http" + (version == "2.0" ? version.split(".")[0] : version));
|
commandParts.push("--http" + (version == "2.0" ? version.split(".")[0] : version));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add request headers.
|
// Add request headers.
|
||||||
|
|
@ -145,14 +146,26 @@ const Curl = {
|
||||||
if (ignoredHeaders.has(header.name.toLowerCase())) {
|
if (ignoredHeaders.has(header.name.toLowerCase())) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
addParam("-H");
|
commandParts.push("-H");
|
||||||
addParam(header.name + ": " + header.value);
|
let text = header.name + ": " + header.value;
|
||||||
|
commandParts.push(escapeStringifNeeded(text));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add post data.
|
// Add post data.
|
||||||
command = command.concat(postData);
|
commandParts = commandParts.concat(postData);
|
||||||
|
|
||||||
return command.join(" ");
|
// Format with line breaks if the command has more than 2 parts
|
||||||
|
// e.g
|
||||||
|
// Command with 2 parts - curl https://foo.com
|
||||||
|
// Commands with more than 2 parts -
|
||||||
|
// curl https://foo.com
|
||||||
|
// -X POST
|
||||||
|
// -H "Accept : */*"
|
||||||
|
// -H "accept-language: en-US"
|
||||||
|
const joinStr = Services.appinfo.OS == "WINNT" ? " ^\n " : " \\\n ";
|
||||||
|
return (
|
||||||
|
"curl " + commandParts.join(commandParts.length >= 3 ? joinStr : " ")
|
||||||
|
);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -382,6 +395,9 @@ const CurlUtils = {
|
||||||
return "\\u" + ("0000" + code).substr(code.length, 4);
|
return "\\u" + ("0000" + code).substr(code.length, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Escape & and |, which are special characters on Windows.
|
||||||
|
const winSpecialCharsRegEx = /([&\|])/g;
|
||||||
|
|
||||||
if (/[^\x20-\x7E]|\'/.test(str)) {
|
if (/[^\x20-\x7E]|\'/.test(str)) {
|
||||||
// Use ANSI-C quoting syntax.
|
// Use ANSI-C quoting syntax.
|
||||||
return "$\'" + str.replace(/\\/g, "\\\\")
|
return "$\'" + str.replace(/\\/g, "\\\\")
|
||||||
|
|
@ -389,12 +405,12 @@ const CurlUtils = {
|
||||||
.replace(/\n/g, "\\n")
|
.replace(/\n/g, "\\n")
|
||||||
.replace(/\r/g, "\\r")
|
.replace(/\r/g, "\\r")
|
||||||
.replace(/!/g, "\\041")
|
.replace(/!/g, "\\041")
|
||||||
.replace(/([&\|])/g, "^$1")
|
.replace(winSpecialCharsRegEx, "^$1")
|
||||||
.replace(/[^\x20-\x7E]/g, escapeCharacter) + "'";
|
.replace(/[^\x20-\x7E]/g, escapeCharacter) + "'";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Use single quote syntax.
|
// Use single quote syntax.
|
||||||
return "'" + str + "'";
|
return "'" + str.replace(winSpecialCharsRegEx, "^$1") + "'";
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -409,9 +425,7 @@ const CurlUtils = {
|
||||||
1. Replace \ with \\ first, because it is an escape character for
|
1. Replace \ with \\ first, because it is an escape character for
|
||||||
certain conditions in both parsers.
|
certain conditions in both parsers.
|
||||||
|
|
||||||
2. Replace double quote chars with two double quotes (not by escaping
|
2. Escape double quotes with double backslashes.
|
||||||
with \") because it is recognized by both the cmd.exe and MS Crt
|
|
||||||
arguments parsers.
|
|
||||||
|
|
||||||
3. Escape ` and $ so commands do not get executed, e.g $(calc.exe) or
|
3. Escape ` and $ so commands do not get executed, e.g $(calc.exe) or
|
||||||
`\$(calc.exe)
|
`\$(calc.exe)
|
||||||
|
|
@ -428,25 +442,20 @@ const CurlUtils = {
|
||||||
This ensures we do not try and double-escape another ^ if it was placed
|
This ensures we do not try and double-escape another ^ if it was placed
|
||||||
by the previous replace.
|
by the previous replace.
|
||||||
|
|
||||||
6. We replace \r and \r\n with \n; this allows us to consistently
|
6. Lastly, we replace new lines with ^ and TWO new lines, because the
|
||||||
escape all new lines in the next replace.
|
|
||||||
|
|
||||||
7. Lastly, we replace new lines with ^ and TWO new lines, because the
|
|
||||||
first new line is there to enact the escape command, and the second is
|
first new line is there to enact the escape command, and the second is
|
||||||
the character to escape (in this case new line).
|
the character to escape (in this case new line).
|
||||||
The extra " enables escaping new lines with ^ within quotes in cmd.exe.
|
|
||||||
*/
|
*/
|
||||||
const encapsChars = '"';
|
const encapsChars = '^"';
|
||||||
return (
|
return (
|
||||||
encapsChars +
|
encapsChars +
|
||||||
str
|
str
|
||||||
.replace(/\\/g, "\\\\")
|
.replace(/\\/g, "\\\\")
|
||||||
.replace(/"/g, '""')
|
.replace(/"/g, '\\"')
|
||||||
.replace(/[`$]/g, "\\$&")
|
.replace(/[`$]/g, "\\$&")
|
||||||
.replace(/[^a-zA-Z0-9\s_\-:=+~\/.',?;()*\$&\\{}\"`]/g, "^$&")
|
.replace(/[^a-zA-Z0-9\s_\-:=+~\/.',?;()*\$&\\{}\"`]/g, "^$&")
|
||||||
.replace(/%(?=[a-zA-Z0-9_])/g, "%^")
|
.replace(/%(?=[a-zA-Z0-9_])/g, "%^")
|
||||||
.replace(/\r\n?/g, "\n")
|
.replace(/\r?\n/g, "^\n\n")
|
||||||
.replace(/\n/g, '"^\r\n\r\n"')
|
|
||||||
+ encapsChars);
|
+ encapsChars);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,6 @@ XPIDL_MODULE = 'docshell'
|
||||||
|
|
||||||
EXPORTS += [
|
EXPORTS += [
|
||||||
'nsDocShellLoadTypes.h',
|
'nsDocShellLoadTypes.h',
|
||||||
'nsILinkHandler.h',
|
|
||||||
'nsIScrollObserver.h',
|
'nsIScrollObserver.h',
|
||||||
'nsIWebShellServices.h',
|
'nsIWebShellServices.h',
|
||||||
'SerializedLoadContext.h',
|
'SerializedLoadContext.h',
|
||||||
|
|
|
||||||
|
|
@ -956,7 +956,6 @@ NS_INTERFACE_MAP_BEGIN(nsDocShell)
|
||||||
NS_INTERFACE_MAP_ENTRY(nsIAuthPromptProvider)
|
NS_INTERFACE_MAP_ENTRY(nsIAuthPromptProvider)
|
||||||
NS_INTERFACE_MAP_ENTRY(nsILoadContext)
|
NS_INTERFACE_MAP_ENTRY(nsILoadContext)
|
||||||
NS_INTERFACE_MAP_ENTRY(nsIWebShellServices)
|
NS_INTERFACE_MAP_ENTRY(nsIWebShellServices)
|
||||||
NS_INTERFACE_MAP_ENTRY(nsILinkHandler)
|
|
||||||
NS_INTERFACE_MAP_ENTRY(nsIClipboardCommands)
|
NS_INTERFACE_MAP_ENTRY(nsIClipboardCommands)
|
||||||
NS_INTERFACE_MAP_ENTRY(nsIDOMStorageManager)
|
NS_INTERFACE_MAP_ENTRY(nsIDOMStorageManager)
|
||||||
NS_INTERFACE_MAP_ENTRY(nsINetworkInterceptController)
|
NS_INTERFACE_MAP_ENTRY(nsINetworkInterceptController)
|
||||||
|
|
@ -14058,7 +14057,7 @@ OnLinkClickEvent::OnLinkClickEvent(nsDocShell* aHandler,
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
nsresult
|
||||||
nsDocShell::OnLinkClick(nsIContent* aContent,
|
nsDocShell::OnLinkClick(nsIContent* aContent,
|
||||||
nsIURI* aURI,
|
nsIURI* aURI,
|
||||||
const char16_t* aTargetSpec,
|
const char16_t* aTargetSpec,
|
||||||
|
|
@ -14110,7 +14109,7 @@ nsDocShell::OnLinkClick(nsIContent* aContent,
|
||||||
return NS_DispatchToCurrentThread(ev);
|
return NS_DispatchToCurrentThread(ev);
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
nsresult
|
||||||
nsDocShell::OnLinkClickSync(nsIContent* aContent,
|
nsDocShell::OnLinkClickSync(nsIContent* aContent,
|
||||||
nsIURI* aURI,
|
nsIURI* aURI,
|
||||||
const char16_t* aTargetSpec,
|
const char16_t* aTargetSpec,
|
||||||
|
|
@ -14276,7 +14275,7 @@ nsDocShell::OnLinkClickSync(nsIContent* aContent,
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
nsresult
|
||||||
nsDocShell::OnOverLink(nsIContent* aContent,
|
nsDocShell::OnOverLink(nsIContent* aContent,
|
||||||
nsIURI* aURI,
|
nsIURI* aURI,
|
||||||
const char16_t* aTargetSpec)
|
const char16_t* aTargetSpec)
|
||||||
|
|
@ -14329,7 +14328,7 @@ nsDocShell::OnOverLink(nsIContent* aContent,
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
nsresult
|
||||||
nsDocShell::OnLeaveLink()
|
nsDocShell::OnLeaveLink()
|
||||||
{
|
{
|
||||||
nsCOMPtr<nsIWebBrowserChrome> browserChrome(do_GetInterface(mTreeOwner));
|
nsCOMPtr<nsIWebBrowserChrome> browserChrome(do_GetInterface(mTreeOwner));
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,6 @@
|
||||||
#include "nsIAuthPromptProvider.h"
|
#include "nsIAuthPromptProvider.h"
|
||||||
#include "nsILoadContext.h"
|
#include "nsILoadContext.h"
|
||||||
#include "nsIWebShellServices.h"
|
#include "nsIWebShellServices.h"
|
||||||
#include "nsILinkHandler.h"
|
|
||||||
#include "nsIClipboardCommands.h"
|
#include "nsIClipboardCommands.h"
|
||||||
#include "nsITabParent.h"
|
#include "nsITabParent.h"
|
||||||
#include "nsCRT.h"
|
#include "nsCRT.h"
|
||||||
|
|
@ -143,7 +142,6 @@ class nsDocShell final
|
||||||
, public nsIAuthPromptProvider
|
, public nsIAuthPromptProvider
|
||||||
, public nsILoadContext
|
, public nsILoadContext
|
||||||
, public nsIWebShellServices
|
, public nsIWebShellServices
|
||||||
, public nsILinkHandler
|
|
||||||
, public nsIClipboardCommands
|
, public nsIClipboardCommands
|
||||||
, public nsIDOMStorageManager
|
, public nsIDOMStorageManager
|
||||||
, public nsINetworkInterceptController
|
, public nsINetworkInterceptController
|
||||||
|
|
@ -193,28 +191,70 @@ public:
|
||||||
// nsIWebProgressListener has methods with identical names...
|
// nsIWebProgressListener has methods with identical names...
|
||||||
NS_FORWARD_NSISECURITYEVENTSINK(nsDocLoader::)
|
NS_FORWARD_NSISECURITYEVENTSINK(nsDocLoader::)
|
||||||
|
|
||||||
// nsILinkHandler
|
/**
|
||||||
NS_IMETHOD OnLinkClick(nsIContent* aContent,
|
* Process a click on a link.
|
||||||
nsIURI* aURI,
|
*
|
||||||
const char16_t* aTargetSpec,
|
* @param aContent the content for the frame that generated the trigger
|
||||||
const nsAString& aFileName,
|
* @param aURI a URI object that defines the destination for the link
|
||||||
nsIInputStream* aPostDataStream,
|
* @param aTargetSpec indicates where the link is targeted (may be an empty
|
||||||
nsIInputStream* aHeadersDataStream,
|
* string)
|
||||||
bool aIsTrusted,
|
* @param aFileName non-null when the link should be downloaded as the given file
|
||||||
nsIPrincipal* aTriggeringPrincipal) override;
|
* @param aPostDataStream the POST data to send
|
||||||
NS_IMETHOD OnLinkClickSync(nsIContent* aContent,
|
* @param aHeadersDataStream ??? (only used for plugins)
|
||||||
nsIURI* aURI,
|
* @param aIsTrusted false if the triggerer is an untrusted DOM event.
|
||||||
const char16_t* aTargetSpec,
|
* @param aTriggeringPrincipal, if not passed explicitly we fall back to
|
||||||
const nsAString& aFileName,
|
* the document's principal.
|
||||||
nsIInputStream* aPostDataStream = 0,
|
*/
|
||||||
nsIInputStream* aHeadersDataStream = 0,
|
nsresult OnLinkClick(nsIContent* aContent,
|
||||||
nsIDocShell** aDocShell = 0,
|
nsIURI* aURI,
|
||||||
nsIRequest** aRequest = 0,
|
const char16_t* aTargetSpec,
|
||||||
nsIPrincipal* aTriggeringPrincipal = nullptr) override;
|
const nsAString& aFileName,
|
||||||
NS_IMETHOD OnOverLink(nsIContent* aContent,
|
nsIInputStream* aPostDataStream,
|
||||||
nsIURI* aURI,
|
nsIInputStream* aHeadersDataStream,
|
||||||
const char16_t* aTargetSpec) override;
|
bool aIsTrusted,
|
||||||
NS_IMETHOD OnLeaveLink() override;
|
nsIPrincipal* aTriggeringPrincipal);
|
||||||
|
/**
|
||||||
|
* Process a click on a link.
|
||||||
|
*
|
||||||
|
* Works the same as OnLinkClick() except it happens immediately rather than
|
||||||
|
* through an event.
|
||||||
|
*
|
||||||
|
* @param aContent the content for the frame that generated the trigger
|
||||||
|
* @param aURI a URI obect that defines the destination for the link
|
||||||
|
* @param aTargetSpec indicates where the link is targeted (may be an empty
|
||||||
|
* string)
|
||||||
|
* @param aFileName non-null when the link should be downloaded as the given file
|
||||||
|
* @param aPostDataStream the POST data to send
|
||||||
|
* @param aHeadersDataStream ??? (only used for plugins)
|
||||||
|
* @param aDocShell (out-param) the DocShell that the request was opened on
|
||||||
|
* @param aRequest the request that was opened
|
||||||
|
* @param aTriggeringPrincipal, if not passed explicitly we fall back to
|
||||||
|
* the document's principal.
|
||||||
|
*/
|
||||||
|
nsresult OnLinkClickSync(nsIContent* aContent,
|
||||||
|
nsIURI* aURI,
|
||||||
|
const char16_t* aTargetSpec,
|
||||||
|
const nsAString& aFileName,
|
||||||
|
nsIInputStream* aPostDataStream = nullptr,
|
||||||
|
nsIInputStream* aHeadersDataStream = nullptr,
|
||||||
|
nsIDocShell** aDocShell = nullptr,
|
||||||
|
nsIRequest** aRequest = nullptr,
|
||||||
|
nsIPrincipal* aTriggeringPrincipal = nullptr);
|
||||||
|
/**
|
||||||
|
* Process a mouse-over a link.
|
||||||
|
*
|
||||||
|
* @param aContent the linked content.
|
||||||
|
* @param aURI an URI object that defines the destination for the link
|
||||||
|
* @param aTargetSpec indicates where the link is targeted (it may be an empty
|
||||||
|
* string)
|
||||||
|
*/
|
||||||
|
nsresult OnOverLink(nsIContent* aContent,
|
||||||
|
nsIURI* aURI,
|
||||||
|
const char16_t* aTargetSpec);
|
||||||
|
/**
|
||||||
|
* Process the mouse leaving a link.
|
||||||
|
*/
|
||||||
|
nsresult OnLeaveLink();
|
||||||
|
|
||||||
nsDocShellInfoLoadType ConvertLoadTypeToDocShellLoadInfo(uint32_t aLoadType);
|
nsDocShellInfoLoadType ConvertLoadTypeToDocShellLoadInfo(uint32_t aLoadType);
|
||||||
uint32_t ConvertDocShellLoadInfoToLoadType(
|
uint32_t ConvertDocShellLoadInfoToLoadType(
|
||||||
|
|
|
||||||
|
|
@ -1,99 +0,0 @@
|
||||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
||||||
/* 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 nsILinkHandler_h___
|
|
||||||
#define nsILinkHandler_h___
|
|
||||||
|
|
||||||
#include "nsISupports.h"
|
|
||||||
#include "mozilla/EventForwards.h"
|
|
||||||
|
|
||||||
class nsIContent;
|
|
||||||
class nsIDocShell;
|
|
||||||
class nsIInputStream;
|
|
||||||
class nsIRequest;
|
|
||||||
|
|
||||||
#define NS_ILINKHANDLER_IID \
|
|
||||||
{ 0xceb9aade, 0x43da, 0x4f1a, \
|
|
||||||
{ 0xac, 0x8a, 0xc7, 0x09, 0xfb, 0x22, 0x46, 0x64 } }
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Interface used for handling clicks on links
|
|
||||||
*/
|
|
||||||
class nsILinkHandler : public nsISupports
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
NS_DECLARE_STATIC_IID_ACCESSOR(NS_ILINKHANDLER_IID)
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Process a click on a link.
|
|
||||||
*
|
|
||||||
* @param aContent the content for the frame that generated the trigger
|
|
||||||
* @param aURI a URI object that defines the destination for the link
|
|
||||||
* @param aTargetSpec indicates where the link is targeted (may be an empty
|
|
||||||
* string)
|
|
||||||
* @param aPostDataStream the POST data to send
|
|
||||||
* @param aFileName non-null when the link should be downloaded as the given file
|
|
||||||
* @param aHeadersDataStream ???
|
|
||||||
* @param aIsTrusted false if the triggerer is an untrusted DOM event.
|
|
||||||
* @param aTriggeringPrincipal, if not passed explicitly we fall back to
|
|
||||||
* the document's principal.
|
|
||||||
*/
|
|
||||||
NS_IMETHOD OnLinkClick(nsIContent* aContent,
|
|
||||||
nsIURI* aURI,
|
|
||||||
const char16_t* aTargetSpec,
|
|
||||||
const nsAString& aFileName,
|
|
||||||
nsIInputStream* aPostDataStream,
|
|
||||||
nsIInputStream* aHeadersDataStream,
|
|
||||||
bool aIsTrusted,
|
|
||||||
nsIPrincipal* aTriggeringPrincipal) = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Process a click on a link.
|
|
||||||
*
|
|
||||||
* Works the same as OnLinkClick() except it happens immediately rather than
|
|
||||||
* through an event.
|
|
||||||
*
|
|
||||||
* @param aContent the content for the frame that generated the trigger
|
|
||||||
* @param aURI a URI obect that defines the destination for the link
|
|
||||||
* @param aTargetSpec indicates where the link is targeted (may be an empty
|
|
||||||
* string)
|
|
||||||
* @param aFileName non-null when the link should be downloaded as the given file
|
|
||||||
* @param aPostDataStream the POST data to send
|
|
||||||
* @param aHeadersDataStream ???
|
|
||||||
* @param aDocShell (out-param) the DocShell that the request was opened on
|
|
||||||
* @param aRequest the request that was opened
|
|
||||||
* @param aTriggeringPrincipal, if not passed explicitly we fall back to
|
|
||||||
* the document's principal.
|
|
||||||
*/
|
|
||||||
NS_IMETHOD OnLinkClickSync(nsIContent* aContent,
|
|
||||||
nsIURI* aURI,
|
|
||||||
const char16_t* aTargetSpec,
|
|
||||||
const nsAString& aFileName,
|
|
||||||
nsIInputStream* aPostDataStream = 0,
|
|
||||||
nsIInputStream* aHeadersDataStream = 0,
|
|
||||||
nsIDocShell** aDocShell = 0,
|
|
||||||
nsIRequest** aRequest = 0,
|
|
||||||
nsIPrincipal* aTriggeringPrincipal = nullptr) = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Process a mouse-over a link.
|
|
||||||
*
|
|
||||||
* @param aContent the linked content.
|
|
||||||
* @param aURI an URI object that defines the destination for the link
|
|
||||||
* @param aTargetSpec indicates where the link is targeted (it may be an empty
|
|
||||||
* string)
|
|
||||||
*/
|
|
||||||
NS_IMETHOD OnOverLink(nsIContent* aContent,
|
|
||||||
nsIURI* aURLSpec,
|
|
||||||
const char16_t* aTargetSpec) = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Process the mouse leaving a link.
|
|
||||||
*/
|
|
||||||
NS_IMETHOD OnLeaveLink() = 0;
|
|
||||||
};
|
|
||||||
|
|
||||||
NS_DEFINE_STATIC_IID_ACCESSOR(nsILinkHandler, NS_ILINKHANDLER_IID)
|
|
||||||
|
|
||||||
#endif /* nsILinkHandler_h___ */
|
|
||||||
|
|
@ -320,12 +320,11 @@ DOMMatrixReadOnly::ScaleNonUniform(double aScaleX,
|
||||||
}
|
}
|
||||||
|
|
||||||
already_AddRefed<DOMMatrix>
|
already_AddRefed<DOMMatrix>
|
||||||
DOMMatrixReadOnly::Rotate(double aAngle,
|
DOMMatrixReadOnly::Rotate(double aRotX,
|
||||||
double aOriginX ,
|
const Optional<double>& aRotY,
|
||||||
double aOriginY) const
|
const Optional<double>& aRotZ) const {
|
||||||
{
|
|
||||||
RefPtr<DOMMatrix> retval = new DOMMatrix(mParent, *this);
|
RefPtr<DOMMatrix> retval = new DOMMatrix(mParent, *this);
|
||||||
retval->RotateSelf(aAngle, aOriginX, aOriginY);
|
retval->RotateSelf(aRotX, aRotY, aRotZ);
|
||||||
|
|
||||||
return retval.forget();
|
return retval.forget();
|
||||||
}
|
}
|
||||||
|
|
@ -893,28 +892,52 @@ DOMMatrix::RotateFromVectorSelf(double aX, double aY)
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
RotateSelf(atan2(aY, aX) / radPerDegree);
|
const double angle = atan2(aY, aX);
|
||||||
|
|
||||||
|
if (fmod(angle, 2 * M_PI) == 0) {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mMatrix3D) {
|
||||||
|
RotateAxisAngleSelf(0, 0, 1, angle / radPerDegree);
|
||||||
|
} else {
|
||||||
|
*mMatrix2D = mMatrix2D->PreRotate(angle);
|
||||||
|
}
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
DOMMatrix*
|
DOMMatrix* DOMMatrix::RotateSelf(double aRotX, const Optional<double>& aRotY,
|
||||||
DOMMatrix::RotateSelf(double aAngle, double aOriginX, double aOriginY)
|
const Optional<double>& aRotZ) {
|
||||||
{
|
double rotY;
|
||||||
if (fmod(aAngle, 360) == 0) {
|
double rotZ;
|
||||||
return this;
|
if (!aRotY.WasPassed() && !aRotZ.WasPassed()) {
|
||||||
|
rotZ = aRotX;
|
||||||
|
aRotX = 0;
|
||||||
|
rotY = 0;
|
||||||
|
} else {
|
||||||
|
rotY = aRotY.WasPassed() ? aRotY.Value() : 0;
|
||||||
|
rotZ = aRotZ.WasPassed() ? aRotZ.Value() : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
TranslateSelf(aOriginX, aOriginY);
|
if (aRotX != 0 || rotY != 0) {
|
||||||
|
Ensure3DMatrix();
|
||||||
|
}
|
||||||
|
|
||||||
if (mMatrix3D) {
|
if (mMatrix3D) {
|
||||||
RotateAxisAngleSelf(0, 0, 1, aAngle);
|
if (fmod(rotZ, 360) != 0) {
|
||||||
} else {
|
mMatrix3D->RotateZ(rotZ * radPerDegree);
|
||||||
*mMatrix2D = mMatrix2D->PreRotate(aAngle * radPerDegree);
|
}
|
||||||
|
if (fmod(rotY, 360) != 0) {
|
||||||
|
mMatrix3D->RotateY(rotY * radPerDegree);
|
||||||
|
}
|
||||||
|
if (fmod(aRotX, 360) != 0) {
|
||||||
|
mMatrix3D->RotateX(aRotX * radPerDegree);
|
||||||
|
}
|
||||||
|
} else if (fmod(rotZ, 360) != 0) {
|
||||||
|
*mMatrix2D = mMatrix2D->PreRotate(rotZ * radPerDegree);
|
||||||
}
|
}
|
||||||
|
|
||||||
TranslateSelf(-aOriginX, -aOriginY);
|
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -191,9 +191,9 @@ public:
|
||||||
double aOriginX = 0,
|
double aOriginX = 0,
|
||||||
double aOriginY = 0,
|
double aOriginY = 0,
|
||||||
double aOriginZ = 0) const;
|
double aOriginZ = 0) const;
|
||||||
already_AddRefed<DOMMatrix> Rotate(double aAngle,
|
already_AddRefed<DOMMatrix> Rotate(double aRotX,
|
||||||
double aOriginX = 0,
|
const Optional<double>& aRotY,
|
||||||
double aOriginY = 0) const;
|
const Optional<double>& aRotZ) const;
|
||||||
already_AddRefed<DOMMatrix> RotateFromVector(double aX,
|
already_AddRefed<DOMMatrix> RotateFromVector(double aX,
|
||||||
double aY) const;
|
double aY) const;
|
||||||
already_AddRefed<DOMMatrix> RotateAxisAngle(double aX,
|
already_AddRefed<DOMMatrix> RotateAxisAngle(double aX,
|
||||||
|
|
@ -324,9 +324,9 @@ public:
|
||||||
double aOriginX = 0,
|
double aOriginX = 0,
|
||||||
double aOriginY = 0,
|
double aOriginY = 0,
|
||||||
double aOriginZ = 0);
|
double aOriginZ = 0);
|
||||||
DOMMatrix* RotateSelf(double aAngle,
|
DOMMatrix* RotateSelf(double aRotX,
|
||||||
double aOriginX = 0,
|
const Optional<double>& aRotY,
|
||||||
double aOriginY = 0);
|
const Optional<double>& aRotZ);
|
||||||
DOMMatrix* RotateFromVectorSelf(double aX,
|
DOMMatrix* RotateFromVectorSelf(double aX,
|
||||||
double aY);
|
double aY);
|
||||||
DOMMatrix* RotateAxisAngleSelf(double aX,
|
DOMMatrix* RotateAxisAngleSelf(double aX,
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,6 @@
|
||||||
#include "nsIContentIterator.h"
|
#include "nsIContentIterator.h"
|
||||||
#include "nsFocusManager.h"
|
#include "nsFocusManager.h"
|
||||||
#include "nsFrameManager.h"
|
#include "nsFrameManager.h"
|
||||||
#include "nsILinkHandler.h"
|
|
||||||
#include "nsIScriptGlobalObject.h"
|
#include "nsIScriptGlobalObject.h"
|
||||||
#include "nsIURL.h"
|
#include "nsIURL.h"
|
||||||
#include "nsContainerFrame.h"
|
#include "nsContainerFrame.h"
|
||||||
|
|
@ -149,6 +148,8 @@
|
||||||
#include "nsDOMStringMap.h"
|
#include "nsDOMStringMap.h"
|
||||||
#include "DOMIntersectionObserver.h"
|
#include "DOMIntersectionObserver.h"
|
||||||
|
|
||||||
|
#include "nsDocShell.h" // for ::Cast
|
||||||
|
|
||||||
using namespace mozilla;
|
using namespace mozilla;
|
||||||
using namespace mozilla::dom;
|
using namespace mozilla::dom;
|
||||||
|
|
||||||
|
|
@ -2259,12 +2260,15 @@ Element::GetPrimaryFrame(mozFlushType aType)
|
||||||
nsresult
|
nsresult
|
||||||
Element::LeaveLink(nsPresContext* aPresContext)
|
Element::LeaveLink(nsPresContext* aPresContext)
|
||||||
{
|
{
|
||||||
nsILinkHandler *handler = aPresContext->GetLinkHandler();
|
if (!aPresContext || !aPresContext->Document()->LinkHandlingEnabled()) {
|
||||||
if (!handler) {
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
return handler->OnLeaveLink();
|
nsIDocShell* shell = aPresContext->Document()->GetDocShell();
|
||||||
|
if (!shell) {
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
return nsDocShell::Cast(shell)->OnLeaveLink();
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
|
|
@ -3175,7 +3179,6 @@ Element::CheckHandleEventForLinksPrecondition(EventChainVisitor& aVisitor,
|
||||||
(aVisitor.mEvent->mMessage != eMouseClick) &&
|
(aVisitor.mEvent->mMessage != eMouseClick) &&
|
||||||
(aVisitor.mEvent->mMessage != eKeyPress) &&
|
(aVisitor.mEvent->mMessage != eKeyPress) &&
|
||||||
(aVisitor.mEvent->mMessage != eLegacyDOMActivate)) ||
|
(aVisitor.mEvent->mMessage != eLegacyDOMActivate)) ||
|
||||||
!aVisitor.mPresContext ||
|
|
||||||
aVisitor.mEvent->mFlags.mMultipleActionsPrevented) {
|
aVisitor.mEvent->mFlags.mMultipleActionsPrevented) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -3220,7 +3223,7 @@ Element::GetEventTargetParentForLinks(EventChainPreVisitor& aVisitor)
|
||||||
if (!focusEvent || !focusEvent->mIsRefocus) {
|
if (!focusEvent || !focusEvent->mIsRefocus) {
|
||||||
nsAutoString target;
|
nsAutoString target;
|
||||||
GetLinkTarget(target);
|
GetLinkTarget(target);
|
||||||
nsContentUtils::TriggerLink(this, aVisitor.mPresContext, absURI, target,
|
nsContentUtils::TriggerLink(this, absURI, target,
|
||||||
false, true, true);
|
false, true, true);
|
||||||
// Make sure any ancestor links don't also TriggerLink
|
// Make sure any ancestor links don't also TriggerLink
|
||||||
aVisitor.mEvent->mFlags.mMultipleActionsPrevented = true;
|
aVisitor.mEvent->mFlags.mMultipleActionsPrevented = true;
|
||||||
|
|
@ -3272,20 +3275,20 @@ Element::PostHandleEventForLinks(EventChainPostVisitor& aVisitor)
|
||||||
switch (aVisitor.mEvent->mMessage) {
|
switch (aVisitor.mEvent->mMessage) {
|
||||||
case eMouseDown:
|
case eMouseDown:
|
||||||
{
|
{
|
||||||
if (aVisitor.mEvent->AsMouseEvent()->button ==
|
if (aVisitor.mEvent->AsMouseEvent()->button == WidgetMouseEvent::eLeftButton &&
|
||||||
WidgetMouseEvent::eLeftButton) {
|
OwnerDoc()->LinkHandlingEnabled()) {
|
||||||
// don't make the link grab the focus if there is no link handler
|
aVisitor.mEvent->mFlags.mMultipleActionsPrevented = true;
|
||||||
nsILinkHandler *handler = aVisitor.mPresContext->GetLinkHandler();
|
|
||||||
nsIDocument *document = GetComposedDoc();
|
if (IsInComposedDoc()) {
|
||||||
if (handler && document) {
|
|
||||||
nsIFocusManager* fm = nsFocusManager::GetFocusManager();
|
nsIFocusManager* fm = nsFocusManager::GetFocusManager();
|
||||||
if (fm) {
|
if (fm) {
|
||||||
aVisitor.mEvent->mFlags.mMultipleActionsPrevented = true;
|
|
||||||
nsCOMPtr<nsIDOMElement> elem = do_QueryInterface(this);
|
nsCOMPtr<nsIDOMElement> elem = do_QueryInterface(this);
|
||||||
fm->SetFocus(elem, nsIFocusManager::FLAG_BYMOUSE |
|
fm->SetFocus(elem, nsIFocusManager::FLAG_BYMOUSE |
|
||||||
nsIFocusManager::FLAG_NOSCROLL);
|
nsIFocusManager::FLAG_NOSCROLL);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (aVisitor.mPresContext) {
|
||||||
EventStateManager::SetActiveManager(
|
EventStateManager::SetActiveManager(
|
||||||
aVisitor.mPresContext->EventStateManager(), this);
|
aVisitor.mPresContext->EventStateManager(), this);
|
||||||
}
|
}
|
||||||
|
|
@ -3302,19 +3305,18 @@ Element::PostHandleEventForLinks(EventChainPostVisitor& aVisitor)
|
||||||
}
|
}
|
||||||
|
|
||||||
// The default action is simply to dispatch DOMActivate
|
// The default action is simply to dispatch DOMActivate
|
||||||
nsCOMPtr<nsIPresShell> shell = aVisitor.mPresContext->GetPresShell();
|
nsEventStatus status = nsEventStatus_eIgnore;
|
||||||
if (shell) {
|
// The DOMActive event should be trusted since the activation has actually
|
||||||
// single-click
|
// occurred even if the cause is an untrusted click event.
|
||||||
nsEventStatus status = nsEventStatus_eIgnore;
|
// This is a hack to allow click events to happen on anchors outside document
|
||||||
// DOMActive event should be trusted since the activation is actually
|
// contexts (where there is no presShell)... Thanks, Google, for another ugly one.
|
||||||
// occurred even if the cause is an untrusted click event.
|
InternalUIEvent actEvent(true, eLegacyDOMActivate, mouseEvent);
|
||||||
InternalUIEvent actEvent(true, eLegacyDOMActivate, mouseEvent);
|
actEvent.mDetail = 1;
|
||||||
actEvent.mDetail = 1;
|
|
||||||
|
|
||||||
rv = shell->HandleDOMEventWithTarget(this, &actEvent, &status);
|
rv = EventDispatcher::Dispatch(this, aVisitor.mPresContext, &actEvent,
|
||||||
if (NS_SUCCEEDED(rv)) {
|
nullptr, &status);
|
||||||
aVisitor.mEventStatus = nsEventStatus_eConsumeNoDefault;
|
if (NS_SUCCEEDED(rv)) {
|
||||||
}
|
aVisitor.mEventStatus = nsEventStatus_eConsumeNoDefault;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
@ -3326,7 +3328,7 @@ Element::PostHandleEventForLinks(EventChainPostVisitor& aVisitor)
|
||||||
GetLinkTarget(target);
|
GetLinkTarget(target);
|
||||||
const InternalUIEvent* activeEvent = aVisitor.mEvent->AsUIEvent();
|
const InternalUIEvent* activeEvent = aVisitor.mEvent->AsUIEvent();
|
||||||
MOZ_ASSERT(activeEvent);
|
MOZ_ASSERT(activeEvent);
|
||||||
nsContentUtils::TriggerLink(this, aVisitor.mPresContext, absURI, target,
|
nsContentUtils::TriggerLink(this, absURI, target,
|
||||||
true, true, activeEvent->IsTrustable());
|
true, true, activeEvent->IsTrustable());
|
||||||
aVisitor.mEventStatus = nsEventStatus_eConsumeNoDefault;
|
aVisitor.mEventStatus = nsEventStatus_eConsumeNoDefault;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,6 @@
|
||||||
#include "mozilla/EventStates.h" // for member
|
#include "mozilla/EventStates.h" // for member
|
||||||
#include "mozilla/dom/DirectionalityUtils.h"
|
#include "mozilla/dom/DirectionalityUtils.h"
|
||||||
#include "nsIDOMElement.h"
|
#include "nsIDOMElement.h"
|
||||||
#include "nsILinkHandler.h"
|
|
||||||
#include "nsINodeList.h"
|
#include "nsINodeList.h"
|
||||||
#include "nsNodeUtils.h"
|
#include "nsNodeUtils.h"
|
||||||
#include "nsAttrAndChildArray.h"
|
#include "nsAttrAndChildArray.h"
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,6 @@
|
||||||
#include "nsIDOMNodeList.h"
|
#include "nsIDOMNodeList.h"
|
||||||
#include "nsIContentIterator.h"
|
#include "nsIContentIterator.h"
|
||||||
#include "nsFocusManager.h"
|
#include "nsFocusManager.h"
|
||||||
#include "nsILinkHandler.h"
|
|
||||||
#include "nsIScriptGlobalObject.h"
|
#include "nsIScriptGlobalObject.h"
|
||||||
#include "nsIURL.h"
|
#include "nsIURL.h"
|
||||||
#include "nsNetUtil.h"
|
#include "nsNetUtil.h"
|
||||||
|
|
|
||||||
|
|
@ -89,6 +89,7 @@
|
||||||
#include "nsCycleCollectionParticipant.h"
|
#include "nsCycleCollectionParticipant.h"
|
||||||
#include "nsCycleCollector.h"
|
#include "nsCycleCollector.h"
|
||||||
#include "nsDataHashtable.h"
|
#include "nsDataHashtable.h"
|
||||||
|
#include "nsDocShell.h"
|
||||||
#include "nsDocShellCID.h"
|
#include "nsDocShellCID.h"
|
||||||
#include "nsDocument.h"
|
#include "nsDocument.h"
|
||||||
#include "nsDOMCID.h"
|
#include "nsDOMCID.h"
|
||||||
|
|
@ -5336,25 +5337,24 @@ nsContentUtils::CombineResourcePrincipals(nsCOMPtr<nsIPrincipal>* aResourcePrinc
|
||||||
|
|
||||||
/* static */
|
/* static */
|
||||||
void
|
void
|
||||||
nsContentUtils::TriggerLink(nsIContent *aContent, nsPresContext *aPresContext,
|
nsContentUtils::TriggerLink(nsIContent *aContent,
|
||||||
nsIURI *aLinkURI, const nsString &aTargetSpec,
|
nsIURI *aLinkURI, const nsString &aTargetSpec,
|
||||||
bool aClick, bool aIsUserTriggered,
|
bool aClick, bool aIsUserTriggered,
|
||||||
bool aIsTrusted)
|
bool aIsTrusted)
|
||||||
{
|
{
|
||||||
NS_ASSERTION(aPresContext, "Need a nsPresContext");
|
|
||||||
NS_PRECONDITION(aLinkURI, "No link URI");
|
NS_PRECONDITION(aLinkURI, "No link URI");
|
||||||
|
|
||||||
if (aContent->IsEditable()) {
|
if (aContent->IsEditable() || !aContent->OwnerDoc()->LinkHandlingEnabled()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsILinkHandler *handler = aPresContext->GetLinkHandler();
|
nsCOMPtr<nsIDocShell> docShell = aContent->OwnerDoc()->GetDocShell();
|
||||||
if (!handler) {
|
if (!docShell) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!aClick) {
|
if (!aClick) {
|
||||||
handler->OnOverLink(aContent, aLinkURI, aTargetSpec.get());
|
nsDocShell::Cast(docShell)->OnOverLink(aContent, aLinkURI, aTargetSpec.get());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -5397,9 +5397,9 @@ nsContentUtils::TriggerLink(nsIContent *aContent, nsPresContext *aPresContext,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
handler->OnLinkClick(aContent, aLinkURI,
|
nsDocShell::Cast(docShell)->OnLinkClick(aContent, aLinkURI,
|
||||||
fileName.IsVoid() ? aTargetSpec.get() : EmptyString().get(),
|
fileName.IsVoid() ? aTargetSpec.get() : EmptyString().get(),
|
||||||
fileName, nullptr, nullptr, aIsTrusted, aContent->NodePrincipal());
|
fileName, nullptr, nullptr, aIsTrusted, aContent->NodePrincipal());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1711,7 +1711,6 @@ public:
|
||||||
* security check using aContent's principal.
|
* security check using aContent's principal.
|
||||||
*
|
*
|
||||||
* @param aContent the node on which a link was triggered.
|
* @param aContent the node on which a link was triggered.
|
||||||
* @param aPresContext the pres context, must be non-null.
|
|
||||||
* @param aLinkURI the URI of the link, must be non-null.
|
* @param aLinkURI the URI of the link, must be non-null.
|
||||||
* @param aTargetSpec the target (like target=, may be empty).
|
* @param aTargetSpec the target (like target=, may be empty).
|
||||||
* @param aClick whether this was a click or not (if false, this method
|
* @param aClick whether this was a click or not (if false, this method
|
||||||
|
|
@ -1722,7 +1721,7 @@ public:
|
||||||
* @param aIsTrusted If false, JS Context will be pushed to stack
|
* @param aIsTrusted If false, JS Context will be pushed to stack
|
||||||
* when the link is triggered.
|
* when the link is triggered.
|
||||||
*/
|
*/
|
||||||
static void TriggerLink(nsIContent *aContent, nsPresContext *aPresContext,
|
static void TriggerLink(nsIContent *aContent,
|
||||||
nsIURI *aLinkURI, const nsString& aTargetSpec,
|
nsIURI *aLinkURI, const nsString& aTargetSpec,
|
||||||
bool aClick, bool aIsUserTriggered,
|
bool aClick, bool aIsUserTriggered,
|
||||||
bool aIsTrusted);
|
bool aIsTrusted);
|
||||||
|
|
|
||||||
|
|
@ -1288,6 +1288,7 @@ nsIDocument::nsIDocument()
|
||||||
|
|
||||||
nsDocument::nsDocument(const char* aContentType)
|
nsDocument::nsDocument(const char* aContentType)
|
||||||
: nsIDocument()
|
: nsIDocument()
|
||||||
|
, mLinksEnabled(true)
|
||||||
, mViewportType(Unknown)
|
, mViewportType(Unknown)
|
||||||
{
|
{
|
||||||
SetContentTypeInternal(nsDependentCString(aContentType));
|
SetContentTypeInternal(nsDependentCString(aContentType));
|
||||||
|
|
|
||||||
|
|
@ -412,6 +412,14 @@ public:
|
||||||
virtual void RemoveIDTargetObserver(nsIAtom* aID, IDTargetObserver aObserver,
|
virtual void RemoveIDTargetObserver(nsIAtom* aID, IDTargetObserver aObserver,
|
||||||
void* aData, bool aForImage) override;
|
void* aData, bool aForImage) override;
|
||||||
|
|
||||||
|
virtual void SetLinkHandlingEnabled(bool aValue) override {
|
||||||
|
mLinksEnabled = aValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual bool LinkHandlingEnabled() override {
|
||||||
|
return mLinksEnabled;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Access HTTP header data (this may also get set from other sources, like
|
* Access HTTP header data (this may also get set from other sources, like
|
||||||
* HTML META tags).
|
* HTML META tags).
|
||||||
|
|
@ -1223,6 +1231,10 @@ public:
|
||||||
// Recorded time of change to 'loading' state.
|
// Recorded time of change to 'loading' state.
|
||||||
mozilla::TimeStamp mLoadingTimeStamp;
|
mozilla::TimeStamp mLoadingTimeStamp;
|
||||||
|
|
||||||
|
// False if we've disabled link handling for elements inside this document,
|
||||||
|
// true otherwise.
|
||||||
|
bool mLinksEnabled : 1;
|
||||||
|
|
||||||
// True if the document has been detached from its content viewer.
|
// True if the document has been detached from its content viewer.
|
||||||
bool mIsGoingAway:1;
|
bool mIsGoingAway:1;
|
||||||
// True if the document is being destroyed.
|
// True if the document is being destroyed.
|
||||||
|
|
|
||||||
|
|
@ -767,6 +767,9 @@ public:
|
||||||
mSandboxFlags = sandboxFlags;
|
mSandboxFlags = sandboxFlags;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virtual void SetLinkHandlingEnabled(bool aValue) = 0;
|
||||||
|
virtual bool LinkHandlingEnabled() = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Access HTTP header data (this may also get set from other
|
* Access HTTP header data (this may also get set from other
|
||||||
* sources, like HTML META tags).
|
* sources, like HTML META tags).
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,6 @@
|
||||||
#include "nsIDOMNodeList.h"
|
#include "nsIDOMNodeList.h"
|
||||||
#include "nsIEditor.h"
|
#include "nsIEditor.h"
|
||||||
#include "nsIEditorIMESupport.h"
|
#include "nsIEditorIMESupport.h"
|
||||||
#include "nsILinkHandler.h"
|
|
||||||
#include "mozilla/dom/NodeInfo.h"
|
#include "mozilla/dom/NodeInfo.h"
|
||||||
#include "mozilla/dom/NodeInfoInlines.h"
|
#include "mozilla/dom/NodeInfoInlines.h"
|
||||||
#include "nsIPresShell.h"
|
#include "nsIPresShell.h"
|
||||||
|
|
|
||||||
|
|
@ -199,16 +199,9 @@ HTMLAnchorElement::IsHTMLFocusable(bool aWithMouse,
|
||||||
}
|
}
|
||||||
|
|
||||||
// cannot focus links if there is no link handler
|
// cannot focus links if there is no link handler
|
||||||
nsIDocument* doc = GetComposedDoc();
|
if (!OwnerDoc()->LinkHandlingEnabled()) {
|
||||||
if (doc) {
|
*aIsFocusable = false;
|
||||||
nsIPresShell* presShell = doc->GetShell();
|
return false;
|
||||||
if (presShell) {
|
|
||||||
nsPresContext* presContext = presShell->GetPresContext();
|
|
||||||
if (presContext && !presContext->GetLinkHandler()) {
|
|
||||||
*aIsFocusable = false;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Links that are in an editable region should never be focusable, even if
|
// Links that are in an editable region should never be focusable, even if
|
||||||
|
|
|
||||||
|
|
@ -49,6 +49,7 @@
|
||||||
#include "nsIInterfaceRequestorUtils.h"
|
#include "nsIInterfaceRequestorUtils.h"
|
||||||
#include "nsIWebProgress.h"
|
#include "nsIWebProgress.h"
|
||||||
#include "nsIDocShell.h"
|
#include "nsIDocShell.h"
|
||||||
|
#include "nsDocShell.h" // for ::Cast
|
||||||
#include "nsIPrompt.h"
|
#include "nsIPrompt.h"
|
||||||
#include "nsIStringBundle.h"
|
#include "nsIStringBundle.h"
|
||||||
|
|
||||||
|
|
@ -776,9 +777,8 @@ HTMLFormElement::SubmitSubmission(HTMLFormSubmission* aFormSubmission)
|
||||||
|
|
||||||
// If there is no link handler, then we won't actually be able to submit.
|
// If there is no link handler, then we won't actually be able to submit.
|
||||||
nsIDocument* doc = GetComposedDoc();
|
nsIDocument* doc = GetComposedDoc();
|
||||||
nsCOMPtr<nsISupports> container = doc ? doc->GetContainer() : nullptr;
|
nsCOMPtr<nsIDocShell> container = doc ? doc->GetDocShell() : nullptr;
|
||||||
nsCOMPtr<nsILinkHandler> linkHandler(do_QueryInterface(container));
|
if (!container || IsEditable()) {
|
||||||
if (!linkHandler || IsEditable()) {
|
|
||||||
mIsSubmitting = false;
|
mIsSubmitting = false;
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
@ -857,12 +857,12 @@ HTMLFormElement::SubmitSubmission(HTMLFormSubmission* aFormSubmission)
|
||||||
getter_AddRefs(postDataStream));
|
getter_AddRefs(postDataStream));
|
||||||
NS_ENSURE_SUBMIT_SUCCESS(rv);
|
NS_ENSURE_SUBMIT_SUCCESS(rv);
|
||||||
|
|
||||||
rv = linkHandler->OnLinkClickSync(this, actionURI,
|
rv = nsDocShell::Cast(container)->OnLinkClickSync(this, actionURI,
|
||||||
target.get(),
|
target.get(),
|
||||||
NullString(),
|
NullString(),
|
||||||
postDataStream, nullptr,
|
postDataStream, nullptr,
|
||||||
getter_AddRefs(docShell),
|
getter_AddRefs(docShell),
|
||||||
getter_AddRefs(mSubmittingRequest));
|
getter_AddRefs(mSubmittingRequest));
|
||||||
NS_ENSURE_SUBMIT_SUCCESS(rv);
|
NS_ENSURE_SUBMIT_SUCCESS(rv);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,6 @@
|
||||||
|
|
||||||
#include "nsCOMPtr.h"
|
#include "nsCOMPtr.h"
|
||||||
#include "nsIForm.h"
|
#include "nsIForm.h"
|
||||||
#include "nsILinkHandler.h"
|
|
||||||
#include "nsIDocument.h"
|
#include "nsIDocument.h"
|
||||||
#include "nsGkAtoms.h"
|
#include "nsGkAtoms.h"
|
||||||
#include "nsIFormControl.h"
|
#include "nsIFormControl.h"
|
||||||
|
|
|
||||||
|
|
@ -581,27 +581,14 @@ nsGenericHTMLElement::FindAncestorForm(HTMLFormElement* aCurrentForm)
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
nsGenericHTMLElement::CheckHandleEventForAnchorsPreconditions(
|
nsGenericHTMLElement::CheckHandleEventForAnchorsPreconditions(EventChainVisitor& aVisitor)
|
||||||
EventChainVisitor& aVisitor)
|
|
||||||
{
|
{
|
||||||
NS_PRECONDITION(nsCOMPtr<Link>(do_QueryObject(this)),
|
NS_PRECONDITION(nsCOMPtr<Link>(do_QueryObject(this)),
|
||||||
"should be called only when |this| implements |Link|");
|
"should be called only when |this| implements |Link|");
|
||||||
|
// When not in the composed document DOM, only <a> should navigate away per
|
||||||
if (!aVisitor.mPresContext) {
|
// the exception in https://html.spec.whatwg.org/#cannot-navigate
|
||||||
// We need a pres context to do link stuff. Some events (e.g. mutation
|
// Thanks, Google, for another ugly one. :|
|
||||||
// events) don't have one.
|
return IsInComposedDoc() || IsHTMLElement(nsGkAtoms::a);
|
||||||
// XXX: ideally, shouldn't we be able to do what we need without one?
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
//Need to check if we hit an imagemap area and if so see if we're handling
|
|
||||||
//the event on that map or on a link farther up the tree. If we're on a
|
|
||||||
//link farther up, do nothing.
|
|
||||||
nsCOMPtr<nsIContent> target = aVisitor.mPresContext->EventStateManager()->
|
|
||||||
GetEventTargetContent(aVisitor.mEvent);
|
|
||||||
|
|
||||||
return !target || !target->IsHTMLElement(nsGkAtoms::area) ||
|
|
||||||
IsHTMLElement(nsGkAtoms::area);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
|
|
|
||||||
|
|
@ -79,6 +79,7 @@ else:
|
||||||
]
|
]
|
||||||
|
|
||||||
LOCAL_INCLUDES += [
|
LOCAL_INCLUDES += [
|
||||||
|
'/docshell/base',
|
||||||
'/dom/base',
|
'/dom/base',
|
||||||
'/dom/plugins/ipc',
|
'/dom/plugins/ipc',
|
||||||
'/layout/generic',
|
'/layout/generic',
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,6 @@ using mozilla::DefaultXDisplay;
|
||||||
#include "nsIStringStream.h"
|
#include "nsIStringStream.h"
|
||||||
#include "nsNetUtil.h"
|
#include "nsNetUtil.h"
|
||||||
#include "mozilla/Preferences.h"
|
#include "mozilla/Preferences.h"
|
||||||
#include "nsILinkHandler.h"
|
|
||||||
#include "nsIDocShellTreeItem.h"
|
#include "nsIDocShellTreeItem.h"
|
||||||
#include "nsIWebBrowserChrome.h"
|
#include "nsIWebBrowserChrome.h"
|
||||||
#include "nsLayoutUtils.h"
|
#include "nsLayoutUtils.h"
|
||||||
|
|
@ -46,6 +45,7 @@ using mozilla::DefaultXDisplay;
|
||||||
#include "nsIScriptSecurityManager.h"
|
#include "nsIScriptSecurityManager.h"
|
||||||
#include "nsIScrollableFrame.h"
|
#include "nsIScrollableFrame.h"
|
||||||
#include "nsIDocShell.h"
|
#include "nsIDocShell.h"
|
||||||
|
#include "nsDocShell.h" // for ::Cast
|
||||||
#include "ImageContainer.h"
|
#include "ImageContainer.h"
|
||||||
#include "nsIDOMHTMLCollection.h"
|
#include "nsIDOMHTMLCollection.h"
|
||||||
#include "GLContext.h"
|
#include "GLContext.h"
|
||||||
|
|
@ -440,10 +440,8 @@ NS_IMETHODIMP nsPluginInstanceOwner::GetURL(const char *aURL,
|
||||||
}
|
}
|
||||||
|
|
||||||
// the container of the pres context will give us the link handler
|
// the container of the pres context will give us the link handler
|
||||||
nsCOMPtr<nsISupports> container = presContext->GetContainerWeak();
|
nsCOMPtr<nsIDocShell> container = presContext->GetDocShell();
|
||||||
NS_ENSURE_TRUE(container,NS_ERROR_FAILURE);
|
NS_ENSURE_TRUE(container,NS_ERROR_FAILURE);
|
||||||
nsCOMPtr<nsILinkHandler> lh = do_QueryInterface(container);
|
|
||||||
NS_ENSURE_TRUE(lh, NS_ERROR_FAILURE);
|
|
||||||
|
|
||||||
nsAutoString unitarget;
|
nsAutoString unitarget;
|
||||||
if ((0 == PL_strcmp(aTarget, "newwindow")) ||
|
if ((0 == PL_strcmp(aTarget, "newwindow")) ||
|
||||||
|
|
@ -495,8 +493,14 @@ NS_IMETHODIMP nsPluginInstanceOwner::GetURL(const char *aURL,
|
||||||
triggeringPrincipal = BasePrincipal::CreateCodebasePrincipal(uri, attrs);
|
triggeringPrincipal = BasePrincipal::CreateCodebasePrincipal(uri, attrs);
|
||||||
}
|
}
|
||||||
|
|
||||||
rv = lh->OnLinkClick(content, uri, unitarget.get(), NullString(),
|
rv = nsDocShell::Cast(container)->OnLinkClick(content,
|
||||||
aPostStream, headersDataStream, true, triggeringPrincipal);
|
uri,
|
||||||
|
unitarget.get(),
|
||||||
|
NullString(),
|
||||||
|
aPostStream,
|
||||||
|
headersDataStream,
|
||||||
|
true,
|
||||||
|
triggeringPrincipal);
|
||||||
|
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -642,6 +642,11 @@ nsCSPParser::nonceSource()
|
||||||
if (dashIndex < 0) {
|
if (dashIndex < 0) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!isValidBase64Value(expr.BeginReading() + dashIndex + 1, expr.EndReading())) {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
// cache if encountering hash or nonce to invalidate unsafe-inline
|
// cache if encountering hash or nonce to invalidate unsafe-inline
|
||||||
mHasHashOrNonce = true;
|
mHasHashOrNonce = true;
|
||||||
return new nsCSPNonceSrc(Substring(expr,
|
return new nsCSPNonceSrc(Substring(expr,
|
||||||
|
|
@ -671,6 +676,10 @@ nsCSPParser::hashSource()
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!isValidBase64Value(expr.BeginReading() + dashIndex + 1, expr.EndReading())) {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
nsAutoString algo(Substring(expr, 0, dashIndex));
|
nsAutoString algo(Substring(expr, 0, dashIndex));
|
||||||
nsAutoString hash(Substring(expr, dashIndex + 1, expr.Length() - dashIndex + 1));
|
nsAutoString hash(Substring(expr, dashIndex + 1, expr.Length() - dashIndex + 1));
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -61,6 +61,33 @@ isValidHexDig(char16_t aHexDig)
|
||||||
(aHexDig >= 'a' && aHexDig <= 'f'));
|
(aHexDig >= 'a' && aHexDig <= 'f'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Checks grammar for valid base-64 strings. Does not verify decodability.
|
||||||
|
static bool
|
||||||
|
isValidBase64Value(const char16_t* cur, const char16_t* end)
|
||||||
|
{
|
||||||
|
// Using grammar at https://w3c.github.io/webappsec-csp/#grammardef-nonce-source
|
||||||
|
|
||||||
|
// May end with one or two =
|
||||||
|
if (end > cur && *(end-1) == EQUALS) end--;
|
||||||
|
if (end > cur && *(end-1) == EQUALS) end--;
|
||||||
|
|
||||||
|
// Must have at least one character aside from any =
|
||||||
|
if (end == cur) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Rest must all be A-Za-z0-9+/-_
|
||||||
|
for (; cur < end; ++cur) {
|
||||||
|
if (!(isCharacterToken(*cur) || isNumberToken(*cur) ||
|
||||||
|
*cur == PLUS || *cur == SLASH ||
|
||||||
|
*cur == DASH || *cur == UNDERLINE)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
// ============================================
|
// ============================================
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
|
|
|
||||||
|
|
@ -227,6 +227,10 @@ TEST(CSPParser, Directives)
|
||||||
"report-uri http://www.example.com/" },
|
"report-uri http://www.example.com/" },
|
||||||
{ "script-src 'nonce-correctscriptnonce'",
|
{ "script-src 'nonce-correctscriptnonce'",
|
||||||
"script-src 'nonce-correctscriptnonce'" },
|
"script-src 'nonce-correctscriptnonce'" },
|
||||||
|
{ "script-src 'nonce-a'",
|
||||||
|
"script-src 'nonce-a'" },
|
||||||
|
{ "script-src 'sha256-a'",
|
||||||
|
"script-src 'sha256-a'" },
|
||||||
{ "script-src 'sha256-siVR8vAcqP06h2ppeNwqgjr0yZ6yned4X2VF84j4GmI='",
|
{ "script-src 'sha256-siVR8vAcqP06h2ppeNwqgjr0yZ6yned4X2VF84j4GmI='",
|
||||||
"script-src 'sha256-siVR8vAcqP06h2ppeNwqgjr0yZ6yned4X2VF84j4GmI='" },
|
"script-src 'sha256-siVR8vAcqP06h2ppeNwqgjr0yZ6yned4X2VF84j4GmI='" },
|
||||||
{ "require-sri-for script style",
|
{ "require-sri-for script style",
|
||||||
|
|
@ -543,6 +547,34 @@ TEST(CSPParser, PoliciesWithInvalidSrc)
|
||||||
"script-src 'none'" },
|
"script-src 'none'" },
|
||||||
{ "script-src http://www.example.com:*.",
|
{ "script-src http://www.example.com:*.",
|
||||||
"script-src 'none'" },
|
"script-src 'none'" },
|
||||||
|
{ "script-src 'nonce-{invalid}'",
|
||||||
|
"script-src 'none'" },
|
||||||
|
{ "script-src 'sha256-{invalid}'",
|
||||||
|
"script-src 'none'" },
|
||||||
|
{ "script-src 'nonce-in$valid'",
|
||||||
|
"script-src 'none'" },
|
||||||
|
{ "script-src 'sha256-in$valid'",
|
||||||
|
"script-src 'none'" },
|
||||||
|
{ "script-src 'nonce-invalid==='",
|
||||||
|
"script-src 'none'" },
|
||||||
|
{ "script-src 'sha256-invalid==='",
|
||||||
|
"script-src 'none'" },
|
||||||
|
{ "script-src 'nonce-==='",
|
||||||
|
"script-src 'none'" },
|
||||||
|
{ "script-src 'sha256-==='",
|
||||||
|
"script-src 'none'" },
|
||||||
|
{ "script-src 'nonce-=='",
|
||||||
|
"script-src 'none'" },
|
||||||
|
{ "script-src 'sha256-=='",
|
||||||
|
"script-src 'none'" },
|
||||||
|
{ "script-src 'nonce-='",
|
||||||
|
"script-src 'none'" },
|
||||||
|
{ "script-src 'sha256-='",
|
||||||
|
"script-src 'none'" },
|
||||||
|
{ "script-src 'nonce-'",
|
||||||
|
"script-src 'none'" },
|
||||||
|
{ "script-src 'sha256-'",
|
||||||
|
"script-src 'none'" },
|
||||||
{ "connect-src http://www.example.com/foo%zz;",
|
{ "connect-src http://www.example.com/foo%zz;",
|
||||||
"connect-src 'none'" },
|
"connect-src 'none'" },
|
||||||
{ "script-src https://foo.com/%$",
|
{ "script-src https://foo.com/%$",
|
||||||
|
|
|
||||||
|
|
@ -59,15 +59,15 @@ interface DOMMatrixReadOnly {
|
||||||
optional unrestricted double originX = 0,
|
optional unrestricted double originX = 0,
|
||||||
optional unrestricted double originY = 0,
|
optional unrestricted double originY = 0,
|
||||||
optional unrestricted double originZ = 0);
|
optional unrestricted double originZ = 0);
|
||||||
DOMMatrix rotate(unrestricted double angle,
|
[NewObject] DOMMatrix rotate(optional unrestricted double rotX = 0,
|
||||||
optional unrestricted double originX = 0,
|
optional unrestricted double rotY,
|
||||||
optional unrestricted double originY = 0);
|
optional unrestricted double rotZ);
|
||||||
DOMMatrix rotateFromVector(unrestricted double x,
|
[NewObject] DOMMatrix rotateFromVector(optional unrestricted double x = 0,
|
||||||
unrestricted double y);
|
optional unrestricted double y = 0);
|
||||||
DOMMatrix rotateAxisAngle(unrestricted double x,
|
[NewObject] DOMMatrix rotateAxisAngle(optional unrestricted double x = 0,
|
||||||
unrestricted double y,
|
optional unrestricted double y = 0,
|
||||||
unrestricted double z,
|
optional unrestricted double z = 0,
|
||||||
unrestricted double angle);
|
optional unrestricted double angle = 0);
|
||||||
DOMMatrix skewX(unrestricted double sx);
|
DOMMatrix skewX(unrestricted double sx);
|
||||||
DOMMatrix skewY(unrestricted double sy);
|
DOMMatrix skewY(unrestricted double sy);
|
||||||
[NewObject, Throws] DOMMatrix multiply(optional DOMMatrixInit other);
|
[NewObject, Throws] DOMMatrix multiply(optional DOMMatrixInit other);
|
||||||
|
|
@ -141,15 +141,15 @@ interface DOMMatrix : DOMMatrixReadOnly {
|
||||||
optional unrestricted double originX = 0,
|
optional unrestricted double originX = 0,
|
||||||
optional unrestricted double originY = 0,
|
optional unrestricted double originY = 0,
|
||||||
optional unrestricted double originZ = 0);
|
optional unrestricted double originZ = 0);
|
||||||
DOMMatrix rotateSelf(unrestricted double angle,
|
DOMMatrix rotateSelf(optional unrestricted double rotX = 0,
|
||||||
optional unrestricted double originX = 0,
|
optional unrestricted double rotY,
|
||||||
optional unrestricted double originY = 0);
|
optional unrestricted double rotZ);
|
||||||
DOMMatrix rotateFromVectorSelf(unrestricted double x,
|
DOMMatrix rotateFromVectorSelf(optional unrestricted double x = 0,
|
||||||
unrestricted double y);
|
optional unrestricted double y = 0);
|
||||||
DOMMatrix rotateAxisAngleSelf(unrestricted double x,
|
DOMMatrix rotateAxisAngleSelf(optional unrestricted double x = 0,
|
||||||
unrestricted double y,
|
optional unrestricted double y = 0,
|
||||||
unrestricted double z,
|
optional unrestricted double z = 0,
|
||||||
unrestricted double angle);
|
optional unrestricted double angle = 0);
|
||||||
DOMMatrix skewXSelf(unrestricted double sx);
|
DOMMatrix skewXSelf(unrestricted double sx);
|
||||||
DOMMatrix skewYSelf(unrestricted double sy);
|
DOMMatrix skewYSelf(unrestricted double sy);
|
||||||
DOMMatrix invertSelf();
|
DOMMatrix invertSelf();
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,6 @@
|
||||||
#include "nsIDOMHTMLAnchorElement.h"
|
#include "nsIDOMHTMLAnchorElement.h"
|
||||||
#include "nsISelectionController.h"
|
#include "nsISelectionController.h"
|
||||||
#include "nsIDOMHTMLDocument.h"
|
#include "nsIDOMHTMLDocument.h"
|
||||||
#include "nsILinkHandler.h"
|
|
||||||
#include "nsIInlineSpellChecker.h"
|
#include "nsIInlineSpellChecker.h"
|
||||||
|
|
||||||
#include "mozilla/css/Loader.h"
|
#include "mozilla/css/Loader.h"
|
||||||
|
|
@ -165,11 +164,10 @@ HTMLEditor::~HTMLEditor()
|
||||||
// free any default style propItems
|
// free any default style propItems
|
||||||
RemoveAllDefaultProperties();
|
RemoveAllDefaultProperties();
|
||||||
|
|
||||||
if (mLinkHandler && IsInitialized()) {
|
if (mDisabledLinkHandling) {
|
||||||
nsCOMPtr<nsIPresShell> ps = GetPresShell();
|
nsCOMPtr<nsIDocument> doc = GetDocument();
|
||||||
|
if (doc) {
|
||||||
if (ps && ps->GetPresContext()) {
|
doc->SetLinkHandlingEnabled(mOldLinkHandlingEnabled);
|
||||||
ps->GetPresContext()->SetLinkHandler(mLinkHandler);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -290,13 +288,14 @@ HTMLEditor::Init(nsIDOMDocument* aDoc,
|
||||||
mCSSEditUtils = MakeUnique<CSSEditUtils>(this);
|
mCSSEditUtils = MakeUnique<CSSEditUtils>(this);
|
||||||
|
|
||||||
// disable links
|
// disable links
|
||||||
nsCOMPtr<nsIPresShell> presShell = GetPresShell();
|
nsCOMPtr<nsIDocument> doc = GetDocument();
|
||||||
NS_ENSURE_TRUE(presShell, NS_ERROR_FAILURE);
|
if (NS_WARN_IF(!doc)) {
|
||||||
nsPresContext *context = presShell->GetPresContext();
|
return NS_ERROR_FAILURE;
|
||||||
NS_ENSURE_TRUE(context, NS_ERROR_NULL_POINTER);
|
}
|
||||||
if (!IsPlaintextEditor() && !IsInteractionAllowed()) {
|
if (!IsPlaintextEditor() && !IsInteractionAllowed()) {
|
||||||
mLinkHandler = context->GetLinkHandler();
|
mDisabledLinkHandling = true;
|
||||||
context->SetLinkHandler(nullptr);
|
mOldLinkHandlingEnabled = doc->LinkHandlingEnabled();
|
||||||
|
doc->SetLinkHandlingEnabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// init the type-in state
|
// init the type-in state
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,6 @@ class nsDocumentFragment;
|
||||||
class nsIDOMKeyEvent;
|
class nsIDOMKeyEvent;
|
||||||
class nsITransferable;
|
class nsITransferable;
|
||||||
class nsIClipboard;
|
class nsIClipboard;
|
||||||
class nsILinkHandler;
|
|
||||||
class nsTableWrapperFrame;
|
class nsTableWrapperFrame;
|
||||||
class nsIDOMRange;
|
class nsIDOMRange;
|
||||||
class nsRange;
|
class nsRange;
|
||||||
|
|
@ -1079,7 +1078,8 @@ protected:
|
||||||
void AddMouseClickListener(nsIDOMElement* aElement);
|
void AddMouseClickListener(nsIDOMElement* aElement);
|
||||||
void RemoveMouseClickListener(nsIDOMElement* aElement);
|
void RemoveMouseClickListener(nsIDOMElement* aElement);
|
||||||
|
|
||||||
nsCOMPtr<nsILinkHandler> mLinkHandler;
|
bool mDisabledLinkHandling = false;
|
||||||
|
bool mOldLinkHandlingEnabled = false;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
friend class HTMLEditorEventListener;
|
friend class HTMLEditorEventListener;
|
||||||
|
|
|
||||||
|
|
@ -73,8 +73,11 @@ struct SkScalerContextRec {
|
||||||
return SkIntToScalar(fContrast) / ((1 << 8) - 1);
|
return SkIntToScalar(fContrast) / ((1 << 8) - 1);
|
||||||
}
|
}
|
||||||
void setContrast(SkScalar c) {
|
void setContrast(SkScalar c) {
|
||||||
SkASSERT(0 <= c && c <= SK_Scalar1);
|
if (0 <= c && c <= SK_Scalar1) {
|
||||||
fContrast = SkScalarRoundToInt(c * ((1 << 8) - 1));
|
fContrast = SkScalarRoundToInt(c * ((1 << 8) - 1));
|
||||||
|
} else {
|
||||||
|
fContrast = SkScalarRoundToInt(0.5f * ((1 << 8) - 1));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,6 @@
|
||||||
#include "nsIWritablePropertyBag2.h"
|
#include "nsIWritablePropertyBag2.h"
|
||||||
#include "nsSubDocumentFrame.h"
|
#include "nsSubDocumentFrame.h"
|
||||||
|
|
||||||
#include "nsILinkHandler.h"
|
|
||||||
#include "nsIDOMDocument.h"
|
#include "nsIDOMDocument.h"
|
||||||
#include "nsISelectionListener.h"
|
#include "nsISelectionListener.h"
|
||||||
#include "mozilla/dom/Selection.h"
|
#include "mozilla/dom/Selection.h"
|
||||||
|
|
@ -910,12 +909,7 @@ nsDocumentViewer::InitInternal(nsIWidget* aParentWidget,
|
||||||
nsCOMPtr<nsIInterfaceRequestor> requestor(mContainer);
|
nsCOMPtr<nsIInterfaceRequestor> requestor(mContainer);
|
||||||
if (requestor) {
|
if (requestor) {
|
||||||
if (mPresContext) {
|
if (mPresContext) {
|
||||||
nsCOMPtr<nsILinkHandler> linkHandler;
|
|
||||||
requestor->GetInterface(NS_GET_IID(nsILinkHandler),
|
|
||||||
getter_AddRefs(linkHandler));
|
|
||||||
|
|
||||||
mPresContext->SetContainer(mContainer);
|
mPresContext->SetContainer(mContainer);
|
||||||
mPresContext->SetLinkHandler(linkHandler);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set script-context-owner in the document
|
// Set script-context-owner in the document
|
||||||
|
|
@ -1421,8 +1415,6 @@ AttachContainerRecurse(nsIDocShell* aShell)
|
||||||
viewer->GetPresContext(getter_AddRefs(pc));
|
viewer->GetPresContext(getter_AddRefs(pc));
|
||||||
if (pc) {
|
if (pc) {
|
||||||
pc->SetContainer(static_cast<nsDocShell*>(aShell));
|
pc->SetContainer(static_cast<nsDocShell*>(aShell));
|
||||||
nsCOMPtr<nsILinkHandler> handler = do_QueryInterface(aShell);
|
|
||||||
pc->SetLinkHandler(handler);
|
|
||||||
}
|
}
|
||||||
nsCOMPtr<nsIPresShell> presShell;
|
nsCOMPtr<nsIPresShell> presShell;
|
||||||
viewer->GetPresShell(getter_AddRefs(presShell));
|
viewer->GetPresShell(getter_AddRefs(presShell));
|
||||||
|
|
@ -2146,12 +2138,6 @@ nsDocumentViewer::Show(void)
|
||||||
return rv;
|
return rv;
|
||||||
|
|
||||||
if (mPresContext && base_win) {
|
if (mPresContext && base_win) {
|
||||||
nsCOMPtr<nsILinkHandler> linkHandler(do_GetInterface(base_win));
|
|
||||||
|
|
||||||
if (linkHandler) {
|
|
||||||
mPresContext->SetLinkHandler(linkHandler);
|
|
||||||
}
|
|
||||||
|
|
||||||
mPresContext->SetContainer(mContainer);
|
mPresContext->SetContainer(mContainer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1504,7 +1504,6 @@ nsPresContext::GetDocShell() const
|
||||||
nsPresContext::Detach()
|
nsPresContext::Detach()
|
||||||
{
|
{
|
||||||
SetContainer(nullptr);
|
SetContainer(nullptr);
|
||||||
SetLinkHandler(nullptr);
|
|
||||||
if (mShell) {
|
if (mShell) {
|
||||||
mShell->CancelInvalidatePresShellIfHidden();
|
mShell->CancelInvalidatePresShellIfHidden();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,6 @@ class nsITheme;
|
||||||
class nsIContent;
|
class nsIContent;
|
||||||
class nsIFrame;
|
class nsIFrame;
|
||||||
class nsFrameManager;
|
class nsFrameManager;
|
||||||
class nsILinkHandler;
|
|
||||||
class nsIAtom;
|
class nsIAtom;
|
||||||
class nsIRunnable;
|
class nsIRunnable;
|
||||||
class gfxUserFontEntry;
|
class gfxUserFontEntry;
|
||||||
|
|
@ -457,13 +456,9 @@ public:
|
||||||
|
|
||||||
nsIDocShell* GetDocShell() const;
|
nsIDocShell* GetDocShell() const;
|
||||||
|
|
||||||
// XXX this are going to be replaced with set/get container
|
|
||||||
void SetLinkHandler(nsILinkHandler* aHandler) { mLinkHandler = aHandler; }
|
|
||||||
nsILinkHandler* GetLinkHandler() { return mLinkHandler; }
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Detach this pres context - i.e. cancel relevant timers,
|
* Detach this pres context - i.e. cancel relevant timers,
|
||||||
* SetLinkHandler(null), SetContainer(null) etc.
|
* SetContainer(null) etc.
|
||||||
* Only to be used by the DocumentViewer.
|
* Only to be used by the DocumentViewer.
|
||||||
*/
|
*/
|
||||||
virtual void Detach();
|
virtual void Detach();
|
||||||
|
|
@ -1245,10 +1240,6 @@ protected:
|
||||||
nsIAtom* MOZ_UNSAFE_REF("always a static atom") mMedium; // initialized by subclass ctors
|
nsIAtom* MOZ_UNSAFE_REF("always a static atom") mMedium; // initialized by subclass ctors
|
||||||
nsCOMPtr<nsIAtom> mMediaEmulated;
|
nsCOMPtr<nsIAtom> mMediaEmulated;
|
||||||
|
|
||||||
// This pointer is nulled out through SetLinkHandler() in the destructors of
|
|
||||||
// the classes which set it. (using SetLinkHandler() again).
|
|
||||||
nsILinkHandler* MOZ_NON_OWNING_REF mLinkHandler;
|
|
||||||
|
|
||||||
// Formerly mLangGroup; moving from charset-oriented langGroup to
|
// Formerly mLangGroup; moving from charset-oriented langGroup to
|
||||||
// maintaining actual language settings everywhere (see bug 524107).
|
// maintaining actual language settings everywhere (see bug 524107).
|
||||||
// This may in fact hold a langGroup such as x-western rather than
|
// This may in fact hold a langGroup such as x-western rather than
|
||||||
|
|
|
||||||
|
|
@ -1309,9 +1309,6 @@ PresShell::Destroy()
|
||||||
// to us. To avoid the pres context having a dangling reference, set its
|
// to us. To avoid the pres context having a dangling reference, set its
|
||||||
// pres shell to nullptr
|
// pres shell to nullptr
|
||||||
mPresContext->DetachShell();
|
mPresContext->DetachShell();
|
||||||
|
|
||||||
// Clear the link handler (weak reference) as well
|
|
||||||
mPresContext->SetLinkHandler(nullptr);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mHaveShutDown = true;
|
mHaveShutDown = true;
|
||||||
|
|
|
||||||
|
|
@ -2046,7 +2046,7 @@ nsImageFrame::HandleEvent(nsPresContext* aPresContext,
|
||||||
*aEventStatus = nsEventStatus_eConsumeDoDefault;
|
*aEventStatus = nsEventStatus_eConsumeDoDefault;
|
||||||
clicked = true;
|
clicked = true;
|
||||||
}
|
}
|
||||||
nsContentUtils::TriggerLink(anchorNode, aPresContext, uri, target,
|
nsContentUtils::TriggerLink(anchorNode, uri, target,
|
||||||
clicked, true, true);
|
clicked, true, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2675,8 +2675,10 @@ StyleAnimationValue::AddWeighted(nsCSSPropertyID aProperty,
|
||||||
switch (aProperty) {
|
switch (aProperty) {
|
||||||
case eCSSProperty_font_stretch: {
|
case eCSSProperty_font_stretch: {
|
||||||
// Animate just like eUnit_Integer.
|
// Animate just like eUnit_Integer.
|
||||||
int32_t result = floor(aCoeff1 * double(aValue1.GetIntValue()) +
|
// https://drafts.csswg.org/css-fonts-3/#font-stretch-animation
|
||||||
aCoeff2 * double(aValue2.GetIntValue()));
|
double interpolatedValue = aCoeff1 * double(aValue1.GetIntValue()) +
|
||||||
|
aCoeff2 * double(aValue2.GetIntValue());
|
||||||
|
int32_t result = floor(interpolatedValue + 0.5); // Fast round.
|
||||||
if (result < NS_STYLE_FONT_STRETCH_ULTRA_CONDENSED) {
|
if (result < NS_STYLE_FONT_STRETCH_ULTRA_CONDENSED) {
|
||||||
result = NS_STYLE_FONT_STRETCH_ULTRA_CONDENSED;
|
result = NS_STYLE_FONT_STRETCH_ULTRA_CONDENSED;
|
||||||
} else if (result > NS_STYLE_FONT_STRETCH_ULTRA_EXPANDED) {
|
} else if (result > NS_STYLE_FONT_STRETCH_ULTRA_EXPANDED) {
|
||||||
|
|
@ -2708,10 +2710,11 @@ StyleAnimationValue::AddWeighted(nsCSSPropertyID aProperty,
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
case eUnit_Integer: {
|
case eUnit_Integer: {
|
||||||
// http://dev.w3.org/csswg/css3-transitions/#animation-of-property-types-
|
// https://drafts.csswg.org/css-transitions/#animtype-integer
|
||||||
// says we should use floor
|
// Spec says animation of properties should use rounding.
|
||||||
int32_t result = floor(aCoeff1 * double(aValue1.GetIntValue()) +
|
double interpolatedValue = aCoeff1 * double(aValue1.GetIntValue()) +
|
||||||
aCoeff2 * double(aValue2.GetIntValue()));
|
aCoeff2 * double(aValue2.GetIntValue());
|
||||||
|
int32_t result = floor(interpolatedValue + 0.5);
|
||||||
if (aProperty == eCSSProperty_font_weight) {
|
if (aProperty == eCSSProperty_font_weight) {
|
||||||
if (result < 100) {
|
if (result < 100) {
|
||||||
result = 100;
|
result = 100;
|
||||||
|
|
|
||||||
|
|
@ -1809,7 +1809,7 @@ function test_integer_transition(prop) {
|
||||||
"integer-valued property " + prop + ": computed value before transition");
|
"integer-valued property " + prop + ": computed value before transition");
|
||||||
div.style.setProperty("transition-property", prop, "");
|
div.style.setProperty("transition-property", prop, "");
|
||||||
div.style.setProperty(prop, "-14", "");
|
div.style.setProperty(prop, "-14", "");
|
||||||
is(cs.getPropertyValue(prop), "-1",
|
is(cs.getPropertyValue(prop), "0",
|
||||||
"integer-valued property " + prop + ": interpolation of integers");
|
"integer-valued property " + prop + ": interpolation of integers");
|
||||||
check_distance(prop, "6", "1", "-14");
|
check_distance(prop, "6", "1", "-14");
|
||||||
|
|
||||||
|
|
@ -1853,7 +1853,7 @@ function test_font_stretch(prop) {
|
||||||
"font-stretch property " + prop + ": computed value before transition");
|
"font-stretch property " + prop + ": computed value before transition");
|
||||||
div.style.setProperty("transition-property", prop, "");
|
div.style.setProperty("transition-property", prop, "");
|
||||||
div.style.setProperty(prop, "extra-condensed", "");
|
div.style.setProperty(prop, "extra-condensed", "");
|
||||||
is(cs.getPropertyValue(prop), "normal",
|
is(cs.getPropertyValue(prop), "semi-expanded",
|
||||||
"font-stretch property " + prop + ": interpolation of font-stretches");
|
"font-stretch property " + prop + ": interpolation of font-stretches");
|
||||||
check_distance(prop, "expanded", "semi-expanded", "condensed");
|
check_distance(prop, "expanded", "semi-expanded", "condensed");
|
||||||
|
|
||||||
|
|
@ -1934,7 +1934,7 @@ function test_pos_integer_or_auto_transition(prop) {
|
||||||
"integer-valued property " + prop + ": computed value before transition");
|
"integer-valued property " + prop + ": computed value before transition");
|
||||||
div.style.setProperty("transition-property", prop, "");
|
div.style.setProperty("transition-property", prop, "");
|
||||||
div.style.setProperty(prop, "11", "");
|
div.style.setProperty(prop, "11", "");
|
||||||
is(cs.getPropertyValue(prop), "5",
|
is(cs.getPropertyValue(prop), "6",
|
||||||
"integer-valued property " + prop + ": interpolation of integers");
|
"integer-valued property " + prop + ": interpolation of integers");
|
||||||
check_distance(prop, "4", "6", "12");
|
check_distance(prop, "4", "6", "12");
|
||||||
div.style.setProperty(prop, "auto", "");
|
div.style.setProperty(prop, "auto", "");
|
||||||
|
|
|
||||||
|
|
@ -3,13 +3,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/. */
|
||||||
|
|
||||||
//
|
|
||||||
// Eric Vaughan
|
|
||||||
// Netscape Communications
|
|
||||||
//
|
|
||||||
// See documentation in associated header file
|
|
||||||
//
|
|
||||||
|
|
||||||
#include "nsImageBoxFrame.h"
|
#include "nsImageBoxFrame.h"
|
||||||
#include "nsGkAtoms.h"
|
#include "nsGkAtoms.h"
|
||||||
#include "nsRenderingContext.h"
|
#include "nsRenderingContext.h"
|
||||||
|
|
@ -26,7 +19,6 @@
|
||||||
#include "nsIPresShell.h"
|
#include "nsIPresShell.h"
|
||||||
#include "nsIDocument.h"
|
#include "nsIDocument.h"
|
||||||
#include "nsImageMap.h"
|
#include "nsImageMap.h"
|
||||||
#include "nsILinkHandler.h"
|
|
||||||
#include "nsIURL.h"
|
#include "nsIURL.h"
|
||||||
#include "nsILoadGroup.h"
|
#include "nsILoadGroup.h"
|
||||||
#include "nsContainerFrame.h"
|
#include "nsContainerFrame.h"
|
||||||
|
|
|
||||||
|
|
@ -94,8 +94,6 @@
|
||||||
#include "nsIMIMEService.h"
|
#include "nsIMIMEService.h"
|
||||||
#include "nsITransfer.h"
|
#include "nsITransfer.h"
|
||||||
|
|
||||||
#include "nsILinkHandler.h"
|
|
||||||
|
|
||||||
static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID);
|
static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID);
|
||||||
|
|
||||||
#define MESSENGER_SAVE_DIR_PREF_NAME "messenger.save.dir"
|
#define MESSENGER_SAVE_DIR_PREF_NAME "messenger.save.dir"
|
||||||
|
|
|
||||||
|
|
@ -13,8 +13,6 @@ pref("security.ssl.treat_unsafe_negotiation_as_broken", false);
|
||||||
pref("security.ssl.require_safe_negotiation", false);
|
pref("security.ssl.require_safe_negotiation", false);
|
||||||
pref("security.ssl.enable_ocsp_stapling", true);
|
pref("security.ssl.enable_ocsp_stapling", true);
|
||||||
pref("security.ssl.enable_false_start", true);
|
pref("security.ssl.enable_false_start", true);
|
||||||
pref("security.ssl.false_start.require-npn", false);
|
|
||||||
pref("security.ssl.enable_npn", true);
|
|
||||||
pref("security.ssl.enable_alpn", true);
|
pref("security.ssl.enable_alpn", true);
|
||||||
|
|
||||||
// TLS 1.3 cipher suites
|
// TLS 1.3 cipher suites
|
||||||
|
|
|
||||||
|
|
@ -68,7 +68,7 @@ GNOMEUI_VERSION=2.2.0
|
||||||
GCONF_VERSION=1.2.1
|
GCONF_VERSION=1.2.1
|
||||||
STARTUP_NOTIFICATION_VERSION=0.8
|
STARTUP_NOTIFICATION_VERSION=0.8
|
||||||
DBUS_VERSION=0.60
|
DBUS_VERSION=0.60
|
||||||
SQLITE_VERSION=3.49.1
|
SQLITE_VERSION=3.50.1
|
||||||
|
|
||||||
dnl Set various checks
|
dnl Set various checks
|
||||||
dnl ========================================================
|
dnl ========================================================
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,6 @@ namespace {
|
||||||
|
|
||||||
// These bits are numbered so that the least subtle issues have higher values.
|
// These bits are numbered so that the least subtle issues have higher values.
|
||||||
// This should make it easier for us to interpret the results.
|
// This should make it easier for us to interpret the results.
|
||||||
const uint32_t NPN_NOT_NEGOTIATED = 64;
|
|
||||||
const uint32_t POSSIBLE_VERSION_DOWNGRADE = 4;
|
const uint32_t POSSIBLE_VERSION_DOWNGRADE = 4;
|
||||||
const uint32_t POSSIBLE_CIPHER_SUITE_DOWNGRADE = 2;
|
const uint32_t POSSIBLE_CIPHER_SUITE_DOWNGRADE = 2;
|
||||||
const uint32_t KEA_NOT_SUPPORTED = 1;
|
const uint32_t KEA_NOT_SUPPORTED = 1;
|
||||||
|
|
@ -1012,8 +1011,6 @@ CanFalseStartCallback(PRFileDesc* fd, void* client_data, PRBool *canFalseStart)
|
||||||
return SECSuccess;
|
return SECSuccess;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsSSLIOLayerHelpers& helpers = infoObject->SharedState().IOLayerHelpers();
|
|
||||||
|
|
||||||
// Prevent version downgrade attacks from TLS 1.2, and avoid False Start for
|
// Prevent version downgrade attacks from TLS 1.2, and avoid False Start for
|
||||||
// TLS 1.3 and later. See Bug 861310 for all the details as to why.
|
// TLS 1.3 and later. See Bug 861310 for all the details as to why.
|
||||||
if (channelInfo.protocolVersion != SSL_LIBRARY_VERSION_TLS_1_2) {
|
if (channelInfo.protocolVersion != SSL_LIBRARY_VERSION_TLS_1_2) {
|
||||||
|
|
@ -1043,23 +1040,11 @@ CanFalseStartCallback(PRFileDesc* fd, void* client_data, PRBool *canFalseStart)
|
||||||
}
|
}
|
||||||
|
|
||||||
// XXX: An attacker can choose which protocols are advertised in the
|
// XXX: An attacker can choose which protocols are advertised in the
|
||||||
// NPN extension. TODO(Bug 861311): We should restrict the ability
|
// ALPN extension. TODO(Bug 861311): We should restrict the ability
|
||||||
// of an attacker leverage this capability by restricting false start
|
// of an attacker leverage this capability by restricting false start
|
||||||
// to the same protocol we previously saw for the server, after the
|
// to the same protocol we previously saw for the server, after the
|
||||||
// first successful connection to the server.
|
// first successful connection to the server.
|
||||||
|
|
||||||
// Enforce NPN to do false start if policy requires it. Do this as an
|
|
||||||
// indicator if server compatibility.
|
|
||||||
if (helpers.mFalseStartRequireNPN) {
|
|
||||||
nsAutoCString negotiatedNPN;
|
|
||||||
if (NS_FAILED(infoObject->GetNegotiatedNPN(negotiatedNPN)) ||
|
|
||||||
!negotiatedNPN.Length()) {
|
|
||||||
MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("CanFalseStartCallback [%p] failed - "
|
|
||||||
"NPN cannot be verified\n", fd));
|
|
||||||
reasonsForNotFalseStarting |= NPN_NOT_NEGOTIATED;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (reasonsForNotFalseStarting == 0) {
|
if (reasonsForNotFalseStarting == 0) {
|
||||||
*canFalseStart = PR_TRUE;
|
*canFalseStart = PR_TRUE;
|
||||||
infoObject->SetFalseStarted();
|
infoObject->SetFalseStarted();
|
||||||
|
|
|
||||||
|
|
@ -1440,8 +1440,7 @@ nsNSSComponent::FillTLSVersionRange(SSLVersionRange& rangeOut,
|
||||||
static const int32_t OCSP_ENABLED_DEFAULT = 1;
|
static const int32_t OCSP_ENABLED_DEFAULT = 1;
|
||||||
static const bool REQUIRE_SAFE_NEGOTIATION_DEFAULT = false;
|
static const bool REQUIRE_SAFE_NEGOTIATION_DEFAULT = false;
|
||||||
static const bool FALSE_START_ENABLED_DEFAULT = true;
|
static const bool FALSE_START_ENABLED_DEFAULT = true;
|
||||||
static const bool NPN_ENABLED_DEFAULT = true;
|
static const bool ALPN_ENABLED_DEFAULT = true;
|
||||||
static const bool ALPN_ENABLED_DEFAULT = false;
|
|
||||||
static const bool ENABLED_0RTT_DATA_DEFAULT = false;
|
static const bool ENABLED_0RTT_DATA_DEFAULT = false;
|
||||||
static const bool TLS13_COMPAT_MODE_DEFAULT = false;
|
static const bool TLS13_COMPAT_MODE_DEFAULT = false;
|
||||||
static const bool HELLO_DOWNGRADE_CHECK_DEFAULT = true;
|
static const bool HELLO_DOWNGRADE_CHECK_DEFAULT = true;
|
||||||
|
|
@ -1869,13 +1868,10 @@ nsNSSComponent::InitializeNSS()
|
||||||
Preferences::GetBool("security.ssl.enable_false_start",
|
Preferences::GetBool("security.ssl.enable_false_start",
|
||||||
FALSE_START_ENABLED_DEFAULT));
|
FALSE_START_ENABLED_DEFAULT));
|
||||||
|
|
||||||
// SSL_ENABLE_NPN and SSL_ENABLE_ALPN also require calling
|
// SSL_ENABLE_ALPN also requires calling SSL_SetNextProtoNego in order for
|
||||||
// SSL_SetNextProtoNego in order for the extensions to be negotiated.
|
// the extensions to be negotiated.
|
||||||
// WebRTC does not do that so it will not use NPN or ALPN even when these
|
// WebRTC does not do that so it will not use ALPN even when this preference
|
||||||
// preferences are true.
|
// is true.
|
||||||
SSL_OptionSetDefault(SSL_ENABLE_NPN,
|
|
||||||
Preferences::GetBool("security.ssl.enable_npn",
|
|
||||||
NPN_ENABLED_DEFAULT));
|
|
||||||
SSL_OptionSetDefault(SSL_ENABLE_ALPN,
|
SSL_OptionSetDefault(SSL_ENABLE_ALPN,
|
||||||
Preferences::GetBool("security.ssl.enable_alpn",
|
Preferences::GetBool("security.ssl.enable_alpn",
|
||||||
ALPN_ENABLED_DEFAULT));
|
ALPN_ENABLED_DEFAULT));
|
||||||
|
|
@ -2066,10 +2062,6 @@ nsNSSComponent::Observe(nsISupports* aSubject, const char* aTopic,
|
||||||
SSL_OptionSetDefault(SSL_ENABLE_FALSE_START,
|
SSL_OptionSetDefault(SSL_ENABLE_FALSE_START,
|
||||||
Preferences::GetBool("security.ssl.enable_false_start",
|
Preferences::GetBool("security.ssl.enable_false_start",
|
||||||
FALSE_START_ENABLED_DEFAULT));
|
FALSE_START_ENABLED_DEFAULT));
|
||||||
} else if (prefName.EqualsLiteral("security.ssl.enable_npn")) {
|
|
||||||
SSL_OptionSetDefault(SSL_ENABLE_NPN,
|
|
||||||
Preferences::GetBool("security.ssl.enable_npn",
|
|
||||||
NPN_ENABLED_DEFAULT));
|
|
||||||
} else if (prefName.EqualsLiteral("security.ssl.enable_alpn")) {
|
} else if (prefName.EqualsLiteral("security.ssl.enable_alpn")) {
|
||||||
SSL_OptionSetDefault(SSL_ENABLE_ALPN,
|
SSL_OptionSetDefault(SSL_ENABLE_ALPN,
|
||||||
Preferences::GetBool("security.ssl.enable_alpn",
|
Preferences::GetBool("security.ssl.enable_alpn",
|
||||||
|
|
|
||||||
|
|
@ -69,13 +69,6 @@ getSiteKey(const nsACString& hostName, uint16_t port,
|
||||||
key.AppendInt(port);
|
key.AppendInt(port);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Historically, we have required that the server negotiate ALPN or NPN in
|
|
||||||
// order to false start, as a compatibility hack to work around
|
|
||||||
// implementations that just stop responding during false start. However, now
|
|
||||||
// false start is resricted to modern crypto (TLS 1.2 and AEAD cipher suites)
|
|
||||||
// so it is less likely that requring NPN or ALPN is still necessary.
|
|
||||||
static const bool FALSE_START_REQUIRE_NPN_DEFAULT = false;
|
|
||||||
|
|
||||||
} // unnamed namespace
|
} // unnamed namespace
|
||||||
|
|
||||||
extern LazyLogModule gPIPNSSLog;
|
extern LazyLogModule gPIPNSSLog;
|
||||||
|
|
@ -1260,7 +1253,6 @@ nsSSLIOLayerPoll(PRFileDesc* fd, int16_t in_flags, int16_t* out_flags)
|
||||||
nsSSLIOLayerHelpers::nsSSLIOLayerHelpers()
|
nsSSLIOLayerHelpers::nsSSLIOLayerHelpers()
|
||||||
: mTreatUnsafeNegotiationAsBroken(false)
|
: mTreatUnsafeNegotiationAsBroken(false)
|
||||||
, mTLSIntoleranceInfo()
|
, mTLSIntoleranceInfo()
|
||||||
, mFalseStartRequireNPN(false)
|
|
||||||
, mUnrestrictedRC4Fallback(false)
|
, mUnrestrictedRC4Fallback(false)
|
||||||
, mVersionFallbackLimit(SSL_LIBRARY_VERSION_TLS_1_0)
|
, mVersionFallbackLimit(SSL_LIBRARY_VERSION_TLS_1_0)
|
||||||
, mutex("nsSSLIOLayerHelpers.mutex")
|
, mutex("nsSSLIOLayerHelpers.mutex")
|
||||||
|
|
@ -1471,10 +1463,6 @@ PrefObserver::Observe(nsISupports* aSubject, const char* aTopic,
|
||||||
bool enabled;
|
bool enabled;
|
||||||
Preferences::GetBool("security.ssl.treat_unsafe_negotiation_as_broken", &enabled);
|
Preferences::GetBool("security.ssl.treat_unsafe_negotiation_as_broken", &enabled);
|
||||||
mOwner->setTreatUnsafeNegotiationAsBroken(enabled);
|
mOwner->setTreatUnsafeNegotiationAsBroken(enabled);
|
||||||
} else if (prefName.EqualsLiteral("security.ssl.false_start.require-npn")) {
|
|
||||||
mOwner->mFalseStartRequireNPN =
|
|
||||||
Preferences::GetBool("security.ssl.false_start.require-npn",
|
|
||||||
FALSE_START_REQUIRE_NPN_DEFAULT);
|
|
||||||
} else if (prefName.EqualsLiteral("security.tls.version.fallback-limit")) {
|
} else if (prefName.EqualsLiteral("security.tls.version.fallback-limit")) {
|
||||||
mOwner->loadVersionFallbackLimit();
|
mOwner->loadVersionFallbackLimit();
|
||||||
} else if (prefName.EqualsLiteral("security.tls.insecure_fallback_hosts")) {
|
} else if (prefName.EqualsLiteral("security.tls.insecure_fallback_hosts")) {
|
||||||
|
|
@ -1516,8 +1504,6 @@ nsSSLIOLayerHelpers::~nsSSLIOLayerHelpers()
|
||||||
if (mPrefObserver) {
|
if (mPrefObserver) {
|
||||||
Preferences::RemoveObserver(mPrefObserver,
|
Preferences::RemoveObserver(mPrefObserver,
|
||||||
"security.ssl.treat_unsafe_negotiation_as_broken");
|
"security.ssl.treat_unsafe_negotiation_as_broken");
|
||||||
Preferences::RemoveObserver(mPrefObserver,
|
|
||||||
"security.ssl.false_start.require-npn");
|
|
||||||
Preferences::RemoveObserver(mPrefObserver,
|
Preferences::RemoveObserver(mPrefObserver,
|
||||||
"security.tls.version.fallback-limit");
|
"security.tls.version.fallback-limit");
|
||||||
Preferences::RemoveObserver(mPrefObserver,
|
Preferences::RemoveObserver(mPrefObserver,
|
||||||
|
|
@ -1576,9 +1562,6 @@ nsSSLIOLayerHelpers::Init()
|
||||||
Preferences::GetBool("security.ssl.treat_unsafe_negotiation_as_broken", &enabled);
|
Preferences::GetBool("security.ssl.treat_unsafe_negotiation_as_broken", &enabled);
|
||||||
setTreatUnsafeNegotiationAsBroken(enabled);
|
setTreatUnsafeNegotiationAsBroken(enabled);
|
||||||
|
|
||||||
mFalseStartRequireNPN =
|
|
||||||
Preferences::GetBool("security.ssl.false_start.require-npn",
|
|
||||||
FALSE_START_REQUIRE_NPN_DEFAULT);
|
|
||||||
loadVersionFallbackLimit();
|
loadVersionFallbackLimit();
|
||||||
initInsecureFallbackSites();
|
initInsecureFallbackSites();
|
||||||
mUnrestrictedRC4Fallback =
|
mUnrestrictedRC4Fallback =
|
||||||
|
|
@ -1587,8 +1570,6 @@ nsSSLIOLayerHelpers::Init()
|
||||||
mPrefObserver = new PrefObserver(this);
|
mPrefObserver = new PrefObserver(this);
|
||||||
Preferences::AddStrongObserver(mPrefObserver,
|
Preferences::AddStrongObserver(mPrefObserver,
|
||||||
"security.ssl.treat_unsafe_negotiation_as_broken");
|
"security.ssl.treat_unsafe_negotiation_as_broken");
|
||||||
Preferences::AddStrongObserver(mPrefObserver,
|
|
||||||
"security.ssl.false_start.require-npn");
|
|
||||||
Preferences::AddStrongObserver(mPrefObserver,
|
Preferences::AddStrongObserver(mPrefObserver,
|
||||||
"security.tls.version.fallback-limit");
|
"security.tls.version.fallback-limit");
|
||||||
Preferences::AddStrongObserver(mPrefObserver,
|
Preferences::AddStrongObserver(mPrefObserver,
|
||||||
|
|
|
||||||
|
|
@ -229,7 +229,6 @@ public:
|
||||||
void removeInsecureFallbackSite(const nsACString& hostname, uint16_t port);
|
void removeInsecureFallbackSite(const nsACString& hostname, uint16_t port);
|
||||||
bool isInsecureFallbackSite(const nsACString& hostname);
|
bool isInsecureFallbackSite(const nsACString& hostname);
|
||||||
|
|
||||||
bool mFalseStartRequireNPN;
|
|
||||||
bool mUnrestrictedRC4Fallback;
|
bool mUnrestrictedRC4Fallback;
|
||||||
uint16_t mVersionFallbackLimit;
|
uint16_t mVersionFallbackLimit;
|
||||||
private:
|
private:
|
||||||
|
|
|
||||||
|
|
@ -1498,7 +1498,7 @@
|
||||||
|
|
||||||
var tree = this.parentNode.parentNode;
|
var tree = this.parentNode.parentNode;
|
||||||
if (tree.columns)
|
if (tree.columns)
|
||||||
for (var currCol = tree.columns.getFirstColumn(); currCol = currCol.getNext(); ) {
|
for (var currCol = tree.columns.getFirstColumn(); currCol; currCol = currCol.getNext()) {
|
||||||
// Construct an entry for each column in the row, unless
|
// Construct an entry for each column in the row, unless
|
||||||
// it is not being shown.
|
// it is not being shown.
|
||||||
var currElement = currCol.element;
|
var currElement = currCol.element;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue