зеркало из https://github.com/mozilla/gecko-dev.git
Merge mozilla-central to mozilla-inbound
This commit is contained in:
Коммит
4f44c026f2
|
@ -758,8 +758,7 @@ this.Presentation = { // jshint ignore:line
|
|||
aModifiedText) {
|
||||
let context;
|
||||
if (!aModifiedText) {
|
||||
context = new PivotContext(aAccessible, null, -1, -1, true,
|
||||
aIsHide ? true : false);
|
||||
context = new PivotContext(aAccessible, null, -1, -1, true, !!aIsHide);
|
||||
}
|
||||
return this.presenters.map(p => p.liveRegion(context, aIsPolite, aIsHide,
|
||||
aModifiedText));
|
||||
|
|
|
@ -67,7 +67,6 @@ module.exports = {
|
|||
"no-throw-literal": "error",
|
||||
"no-underscore-dangle": "off",
|
||||
"no-undefined": "off",
|
||||
"no-unneeded-ternary": "error",
|
||||
"no-unused-vars": ["error", {"vars": "all", "args": "none"}],
|
||||
"no-use-before-define": "off",
|
||||
"no-var": "off",
|
||||
|
|
|
@ -313,9 +313,8 @@ function getAccessible(aAccOrElmOrID, aInterfaces, aElmObj, aDoNotFailIf)
|
|||
*/
|
||||
function isAccessible(aAccOrElmOrID, aInterfaces)
|
||||
{
|
||||
return getAccessible(aAccOrElmOrID, aInterfaces, null,
|
||||
DONOTFAIL_IF_NO_ACC | DONOTFAIL_IF_NO_INTERFACE) ?
|
||||
true : false;
|
||||
return !!getAccessible(aAccOrElmOrID, aInterfaces, null,
|
||||
DONOTFAIL_IF_NO_ACC | DONOTFAIL_IF_NO_INTERFACE);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -584,7 +583,7 @@ function testAccessibleTree(aAccOrElmOrID, aAccTree, aFlags)
|
|||
function isAccessibleInCache(aNodeOrId)
|
||||
{
|
||||
var node = getNode(aNodeOrId);
|
||||
return gAccService.getAccessibleFromCache(node) ? true : false;
|
||||
return !!gAccService.getAccessibleFromCache(node);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -282,7 +282,7 @@ function setVCTextInvoker(aDocAcc, aPivotMoveMethod, aBoundary, aTextOffsets,
|
|||
VCChangedChecker.storePreviousPosAndOffset(aDocAcc.virtualCursor);
|
||||
SimpleTest.info(aDocAcc.virtualCursor.position);
|
||||
var moved = aDocAcc.virtualCursor[aPivotMoveMethod](aBoundary,
|
||||
aIsFromUserInput === undefined ? true : false);
|
||||
aIsFromUserInput === undefined);
|
||||
SimpleTest.is(!!moved, !!expectMove,
|
||||
"moved pivot by text with " + aPivotMoveMethod +
|
||||
" to " + aIdOrNameOrAcc);
|
||||
|
|
|
@ -109,8 +109,7 @@
|
|||
|
||||
var accessibleTable = getAccessible(id, [nsIAccessibleTable], null,
|
||||
DONOTFAIL_IF_NO_INTERFACE);
|
||||
ok(accessibleTable ? true : false,
|
||||
"landmarked table should have nsIAccessibleTable");
|
||||
ok(!!accessibleTable, "landmarked table should have nsIAccessibleTable");
|
||||
|
||||
if (accessibleTable)
|
||||
is(accessibleTable.getCellAt(0,0).firstChild.name, "hi", "no cell");
|
||||
|
|
|
@ -7344,7 +7344,7 @@ var gIdentityHandler = {
|
|||
this._identityIconLabel.crop = icon_country_label ? "end" : "center";
|
||||
this._identityIconLabel.parentNode.style.direction = icon_labels_dir;
|
||||
// Hide completely if the organization label is empty
|
||||
this._identityIconLabel.parentNode.collapsed = icon_label ? false : true;
|
||||
this._identityIconLabel.parentNode.collapsed = !icon_label;
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
|
@ -17,7 +17,6 @@ module.exports = {
|
|||
"no-sequences": "error",
|
||||
"no-shadow": "error",
|
||||
"no-throw-literal": "error",
|
||||
"no-unneeded-ternary": "error",
|
||||
"no-unused-vars": ["error", { "varsIgnorePattern": "^C[ciur]$" }],
|
||||
"padded-blocks": ["error", "never"],
|
||||
"semi": ["error", "always", {"omitLastInOneLineBlock": true }],
|
||||
|
|
|
@ -949,7 +949,7 @@ this.PlacesUIUtils = {
|
|||
return;
|
||||
}
|
||||
|
||||
var loadInBackground = where == "tabshifted" ? true : false;
|
||||
var loadInBackground = where == "tabshifted";
|
||||
// For consistency, we want all the bookmarks to open in new tabs, instead
|
||||
// of having one of them replace the currently focused tab. Hence we call
|
||||
// loadTabs with aReplace set to false.
|
||||
|
|
|
@ -128,7 +128,7 @@ TabListComponent.prototype = {
|
|||
this._window.openDialog(this._window.getBrowserURL(), "_blank",
|
||||
"chrome,dialog=no,all", urls.join("|"));
|
||||
} else {
|
||||
let loadInBackground = where == "tabshifted" ? true : false;
|
||||
let loadInBackground = where == "tabshifted";
|
||||
this._getChromeWindow(this._window).gBrowser.loadTabs(urls, {
|
||||
inBackground: loadInBackground,
|
||||
replace: false,
|
||||
|
|
|
@ -16,9 +16,9 @@
|
|||
"unpack": true
|
||||
},
|
||||
{
|
||||
"version": "rustc 1.17.0 (56124baa9 2017-04-24) repack with cargo 0.19.0-beta.1 (03efb7fc8 2017-04-23)",
|
||||
"size": 121925324,
|
||||
"digest": "218ec1fd0a00b50fc3f0ce497d2bb9eb2230c1998a1c22cfe8f61ac44d9b57a081e12e8cd946e9d960a1683ed50d625d62f35f2db6fa6aab82454f96f32cd7b2",
|
||||
"version": "rustc 1.18.0 (03fc9d622 2017-06-06) repack",
|
||||
"size": 146886764,
|
||||
"digest": "e03eeebd4acc593369d5635a059f55a6beed2d2fb839a8c196ccc735a246620d3285a15c17ab34fa8bcf9dd57dd25f735d4ef3eb2fc3be672bbde62342823f1e",
|
||||
"algorithm": "sha512",
|
||||
"filename": "rustc.tar.xz",
|
||||
"unpack": true
|
||||
|
|
|
@ -16,9 +16,9 @@
|
|||
"unpack": true
|
||||
},
|
||||
{
|
||||
"version": "rustc 1.17.0 (56124baa9 2017-04-24) repack with cargo 0.19.0-beta.1 (03efb7fc8 2017-04-23)",
|
||||
"size": 121925324,
|
||||
"digest": "218ec1fd0a00b50fc3f0ce497d2bb9eb2230c1998a1c22cfe8f61ac44d9b57a081e12e8cd946e9d960a1683ed50d625d62f35f2db6fa6aab82454f96f32cd7b2",
|
||||
"version": "rustc 1.18.0 (03fc9d622 2017-06-06) repack",
|
||||
"size": 146886764,
|
||||
"digest": "e03eeebd4acc593369d5635a059f55a6beed2d2fb839a8c196ccc735a246620d3285a15c17ab34fa8bcf9dd57dd25f735d4ef3eb2fc3be672bbde62342823f1e",
|
||||
"algorithm": "sha512",
|
||||
"filename": "rustc.tar.xz",
|
||||
"unpack": true
|
||||
|
|
|
@ -16,9 +16,9 @@
|
|||
"unpack": true
|
||||
},
|
||||
{
|
||||
"version": "rustc 1.17.0 (56124baa9 2017-04-24) repack with cargo 0.19.0-beta.1 (03efb7fc8 2017-04-23)",
|
||||
"size": 121925324,
|
||||
"digest": "218ec1fd0a00b50fc3f0ce497d2bb9eb2230c1998a1c22cfe8f61ac44d9b57a081e12e8cd946e9d960a1683ed50d625d62f35f2db6fa6aab82454f96f32cd7b2",
|
||||
"version": "rustc 1.18.0 (03fc9d622 2017-06-06) repack",
|
||||
"size": 146886764,
|
||||
"digest": "e03eeebd4acc593369d5635a059f55a6beed2d2fb839a8c196ccc735a246620d3285a15c17ab34fa8bcf9dd57dd25f735d4ef3eb2fc3be672bbde62342823f1e",
|
||||
"algorithm": "sha512",
|
||||
"filename": "rustc.tar.xz",
|
||||
"unpack": true
|
||||
|
|
|
@ -16,9 +16,9 @@
|
|||
"unpack": true
|
||||
},
|
||||
{
|
||||
"version": "rustc 1.17.0 (56124baa9 2017-04-24) repack with cargo 0.19.0-beta.1 (03efb7fc8 2017-04-23)",
|
||||
"size": 121925324,
|
||||
"digest": "218ec1fd0a00b50fc3f0ce497d2bb9eb2230c1998a1c22cfe8f61ac44d9b57a081e12e8cd946e9d960a1683ed50d625d62f35f2db6fa6aab82454f96f32cd7b2",
|
||||
"version": "rustc 1.18.0 (03fc9d622 2017-06-06) repack",
|
||||
"size": 146886764,
|
||||
"digest": "e03eeebd4acc593369d5635a059f55a6beed2d2fb839a8c196ccc735a246620d3285a15c17ab34fa8bcf9dd57dd25f735d4ef3eb2fc3be672bbde62342823f1e",
|
||||
"algorithm": "sha512",
|
||||
"filename": "rustc.tar.xz",
|
||||
"unpack": true
|
||||
|
|
|
@ -24,9 +24,9 @@
|
|||
"size": 12072532
|
||||
},
|
||||
{
|
||||
"version": "rustc 1.17.0 (56124baa9 2017-04-24) repack with cargo 0.19.0-beta.1 (03efb7fc8 2017-04-23)",
|
||||
"size": 121925324,
|
||||
"digest": "218ec1fd0a00b50fc3f0ce497d2bb9eb2230c1998a1c22cfe8f61ac44d9b57a081e12e8cd946e9d960a1683ed50d625d62f35f2db6fa6aab82454f96f32cd7b2",
|
||||
"version": "rustc 1.18.0 (03fc9d622 2017-06-06) repack",
|
||||
"size": 146886764,
|
||||
"digest": "e03eeebd4acc593369d5635a059f55a6beed2d2fb839a8c196ccc735a246620d3285a15c17ab34fa8bcf9dd57dd25f735d4ef3eb2fc3be672bbde62342823f1e",
|
||||
"algorithm": "sha512",
|
||||
"filename": "rustc.tar.xz",
|
||||
"unpack": true
|
||||
|
|
|
@ -16,9 +16,9 @@
|
|||
"unpack": true
|
||||
},
|
||||
{
|
||||
"version": "rustc 1.17.0 (56124baa9 2017-04-24) repack with cargo 0.19.0-beta.1 (03efb7fc8 2017-04-23)",
|
||||
"size": 121925324,
|
||||
"digest": "218ec1fd0a00b50fc3f0ce497d2bb9eb2230c1998a1c22cfe8f61ac44d9b57a081e12e8cd946e9d960a1683ed50d625d62f35f2db6fa6aab82454f96f32cd7b2",
|
||||
"version": "rustc 1.18.0 (03fc9d622 2017-06-06) repack",
|
||||
"size": 146886764,
|
||||
"digest": "e03eeebd4acc593369d5635a059f55a6beed2d2fb839a8c196ccc735a246620d3285a15c17ab34fa8bcf9dd57dd25f735d4ef3eb2fc3be672bbde62342823f1e",
|
||||
"algorithm": "sha512",
|
||||
"filename": "rustc.tar.xz",
|
||||
"unpack": true
|
||||
|
|
|
@ -16,9 +16,9 @@
|
|||
"unpack": true
|
||||
},
|
||||
{
|
||||
"version": "rustc 1.17.0 (56124baa9 2017-04-24) repack with cargo 0.19.0-beta.1 (03efb7fc8 2017-04-23)",
|
||||
"size": 121925324,
|
||||
"digest": "218ec1fd0a00b50fc3f0ce497d2bb9eb2230c1998a1c22cfe8f61ac44d9b57a081e12e8cd946e9d960a1683ed50d625d62f35f2db6fa6aab82454f96f32cd7b2",
|
||||
"version": "rustc 1.18.0 (03fc9d622 2017-06-06) repack",
|
||||
"size": 146886764,
|
||||
"digest": "e03eeebd4acc593369d5635a059f55a6beed2d2fb839a8c196ccc735a246620d3285a15c17ab34fa8bcf9dd57dd25f735d4ef3eb2fc3be672bbde62342823f1e",
|
||||
"algorithm": "sha512",
|
||||
"filename": "rustc.tar.xz",
|
||||
"unpack": true
|
||||
|
|
|
@ -8,9 +8,9 @@
|
|||
"unpack": true
|
||||
},
|
||||
{
|
||||
"version": "rustc 1.17.0 (56124baa9 2017-04-24) repack with cargo 0.19.0-beta.1 (03efb7fc8 2017-04-23)",
|
||||
"size": 81913425,
|
||||
"digest": "41a9dc3f1c0df56f125a4f16cac3635bd3cc2af7167388f54eb4346a599cd8be875475a87a8dd1720d52281ecd361a1050d9523f052f424bce686ba061af6d6c",
|
||||
"version": "rustc 1.18.0 (03fc9d622 2017-06-06) repack",
|
||||
"size": 97110232,
|
||||
"digest": "7df456b9f86a0f11b81700b6bbb9451137beb5a4035fe2330dc507c804fe8230573636720dba60308eee5305b7c04bc041c025ca0ca98bef54f98f98b48dd8d7",
|
||||
"algorithm": "sha512",
|
||||
"filename": "rustc.tar.bz2",
|
||||
"unpack": true
|
||||
|
|
|
@ -42,9 +42,9 @@
|
|||
"filename": "dmg.tar.xz"
|
||||
},
|
||||
{
|
||||
"version": "rustc 1.17.0 (56124baa9 2017-04-24) repack with cargo 0.19.0-beta.1 (03efb7fc8 2017-04-23)",
|
||||
"size": 116855168,
|
||||
"digest": "89e414870a398369c745e38e5ce757b98c8f0bbde0ea92ca9fa0a8a72d970e8575fe5493128c1b6b1134ed336c1a7265b1d1ea77fe3673e73a87d0b774f10fac",
|
||||
"version": "rustc 1.18.0 (03fc9d622 2017-06-06) repack",
|
||||
"size": 141005088,
|
||||
"digest": "8c915059da3df885c4b26efa25431719a41a108adbc900f49ca51419fee30480e32ac99aeb398954722c10b72dea6d1d39fc122846c86194b12063c9b85da47d",
|
||||
"algorithm": "sha512",
|
||||
"filename": "rustc.tar.xz",
|
||||
"unpack": true
|
||||
|
|
|
@ -8,9 +8,9 @@
|
|||
"unpack": true
|
||||
},
|
||||
{
|
||||
"version": "rustc 1.17.0 (56124baa9 2017-04-24) repack with cargo 0.19.0-beta.1 (03efb7fc8 2017-04-23)",
|
||||
"size": 81913425,
|
||||
"digest": "41a9dc3f1c0df56f125a4f16cac3635bd3cc2af7167388f54eb4346a599cd8be875475a87a8dd1720d52281ecd361a1050d9523f052f424bce686ba061af6d6c",
|
||||
"version": "rustc 1.18.0 (03fc9d622 2017-06-06) repack",
|
||||
"size": 97110232,
|
||||
"digest": "7df456b9f86a0f11b81700b6bbb9451137beb5a4035fe2330dc507c804fe8230573636720dba60308eee5305b7c04bc041c025ca0ca98bef54f98f98b48dd8d7",
|
||||
"algorithm": "sha512",
|
||||
"filename": "rustc.tar.bz2",
|
||||
"unpack": true
|
||||
|
|
|
@ -6,9 +6,9 @@
|
|||
"filename": "mozmake.exe"
|
||||
},
|
||||
{
|
||||
"version": "rustc 1.17.0 (56124baa9 2017-04-24) repack with cargo 0.19.0-beta.1 (03efb7fc8 2017-04-23)",
|
||||
"size": 76516077,
|
||||
"digest": "6ed02db3ae678fa222ee3680172dc0bc0f0cec735fbc17e67926d4960cb0f6693416d7da8dd2e91d84ba862d7add4ac36e37d7891270e10ed0540fca8b446b68",
|
||||
"version": "rustc 1.18.0 (03fc9d622 2017-06-06) repack",
|
||||
"size": 90954208,
|
||||
"digest": "6ee6ab72521c1f476fd15a3f2787f3046a1648f34cbc43380c2ba3915c2207b29c942fefe4b56426f5bafe47937c6a8074201d61a79d02ad366dace41d5cb717",
|
||||
"algorithm": "sha512",
|
||||
"filename": "rustc.tar.bz2",
|
||||
"unpack": true
|
||||
|
|
|
@ -6,9 +6,9 @@
|
|||
"filename": "mozmake.exe"
|
||||
},
|
||||
{
|
||||
"version": "rustc 1.17.0 (56124baa9 2017-04-24) repack with cargo 0.19.0-beta.1 (03efb7fc8 2017-04-23)",
|
||||
"size": 76516077,
|
||||
"digest": "6ed02db3ae678fa222ee3680172dc0bc0f0cec735fbc17e67926d4960cb0f6693416d7da8dd2e91d84ba862d7add4ac36e37d7891270e10ed0540fca8b446b68",
|
||||
"version": "rustc 1.18.0 (03fc9d622 2017-06-06) repack",
|
||||
"size": 90954208,
|
||||
"digest": "6ee6ab72521c1f476fd15a3f2787f3046a1648f34cbc43380c2ba3915c2207b29c942fefe4b56426f5bafe47937c6a8074201d61a79d02ad366dace41d5cb717",
|
||||
"algorithm": "sha512",
|
||||
"filename": "rustc.tar.bz2",
|
||||
"unpack": true
|
||||
|
|
|
@ -6,9 +6,9 @@
|
|||
"filename": "mozmake.exe"
|
||||
},
|
||||
{
|
||||
"version": "rustc 1.17.0 (56124baa9 2017-04-24) repack with cargo 0.19.0-beta.1 (03efb7fc8 2017-04-23)",
|
||||
"size": 76516077,
|
||||
"digest": "6ed02db3ae678fa222ee3680172dc0bc0f0cec735fbc17e67926d4960cb0f6693416d7da8dd2e91d84ba862d7add4ac36e37d7891270e10ed0540fca8b446b68",
|
||||
"version": "rustc 1.18.0 (03fc9d622 2017-06-06) repack",
|
||||
"size": 90954208,
|
||||
"digest": "6ee6ab72521c1f476fd15a3f2787f3046a1648f34cbc43380c2ba3915c2207b29c942fefe4b56426f5bafe47937c6a8074201d61a79d02ad366dace41d5cb717",
|
||||
"algorithm": "sha512",
|
||||
"filename": "rustc.tar.bz2",
|
||||
"unpack": true
|
||||
|
|
|
@ -110,9 +110,6 @@ module.exports = {
|
|||
// throw new Error("error")).
|
||||
"no-throw-literal": "error",
|
||||
|
||||
// Disallow the use of Boolean literals in conditional expressions.
|
||||
"no-unneeded-ternary": "error",
|
||||
|
||||
// Disallow padding within blocks.
|
||||
"padded-blocks": ["warn", "never"],
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
#define mozilla_dom_ElementInlines_h
|
||||
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "mozilla/ServoBindings.h"
|
||||
#include "mozilla/ServoBindingTypes.h"
|
||||
#include "nsIContentInlines.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIPresShell.h"
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
#include "nsMappedAttributeElement.h"
|
||||
#include "nsIStyleRule.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/ServoBindings.h"
|
||||
#include "mozilla/ServoBindingTypes.h"
|
||||
#include "mozilla/MemoryReporting.h"
|
||||
|
||||
class nsIAtom;
|
||||
|
|
|
@ -99,8 +99,7 @@ function* testSteps()
|
|||
is(index.name, indexData[i].name, "Correct name");
|
||||
is(index.objectStore.name, objectStore.name, "Correct store name");
|
||||
is(index.keyPath, indexData[i].keyPath, "Correct keyPath");
|
||||
is(index.unique, indexData[i].options.unique ? true : false,
|
||||
"Correct unique value");
|
||||
is(index.unique, !!indexData[i].options.unique, "Correct unique value");
|
||||
}
|
||||
|
||||
request = objectStore.index("name").getKey("Bob");
|
||||
|
|
|
@ -95,8 +95,7 @@ function* testSteps()
|
|||
is(index.name, indexData[i].name, "Correct name");
|
||||
is(index.objectStore.name, objectStore.name, "Correct store name");
|
||||
is(index.keyPath, indexData[i].keyPath, "Correct keyPath");
|
||||
is(index.unique, indexData[i].options.unique ? true : false,
|
||||
"Correct unique value");
|
||||
is(index.unique, !!indexData[i].options.unique, "Correct unique value");
|
||||
}
|
||||
|
||||
ok(true, "Test group 1");
|
||||
|
|
|
@ -99,8 +99,7 @@ function* testSteps()
|
|||
is(index.name, indexData[i].name, "Correct name");
|
||||
is(index.objectStore.name, objectStore.name, "Correct store name");
|
||||
is(index.keyPath, indexData[i].keyPath, "Correct keyPath");
|
||||
is(index.unique, indexData[i].options.unique ? true : false,
|
||||
"Correct unique value");
|
||||
is(index.unique, !!indexData[i].options.unique, "Correct unique value");
|
||||
if (indexData[i].options.locale == "auto") {
|
||||
is(index.isAutoLocale, true, "Correct isAutoLocale value");
|
||||
is(index.locale, "en_US", "Correct locale value");
|
||||
|
|
|
@ -90,6 +90,29 @@ IsEligibleForHSTSPriming(nsIURI* aContentLocation) {
|
|||
return (PR_StringToNetAddr(hostname.get(), &hostAddr) != PR_SUCCESS);
|
||||
}
|
||||
|
||||
enum MixedContentHSTSState {
|
||||
MCB_HSTS_PASSIVE_NO_HSTS = 0,
|
||||
MCB_HSTS_PASSIVE_WITH_HSTS = 1,
|
||||
MCB_HSTS_ACTIVE_NO_HSTS = 2,
|
||||
MCB_HSTS_ACTIVE_WITH_HSTS = 3
|
||||
};
|
||||
|
||||
// Similar to the existing mixed-content HSTS, except MCB_HSTS_*_NO_HSTS is
|
||||
// broken into two distinct states, indicating whether we plan to send a priming
|
||||
// request or not. If we decided not go send a priming request, it could be
|
||||
// because it is a type we do not support, or because we cached a previous
|
||||
// negative response.
|
||||
enum MixedContentHSTSPrimingState {
|
||||
eMCB_HSTS_PASSIVE_WITH_HSTS = 0,
|
||||
eMCB_HSTS_ACTIVE_WITH_HSTS = 1,
|
||||
eMCB_HSTS_PASSIVE_NO_PRIMING = 2,
|
||||
eMCB_HSTS_PASSIVE_DO_PRIMING = 3,
|
||||
eMCB_HSTS_ACTIVE_NO_PRIMING = 4,
|
||||
eMCB_HSTS_ACTIVE_DO_PRIMING = 5,
|
||||
eMCB_HSTS_PASSIVE_UPGRADE = 6,
|
||||
eMCB_HSTS_ACTIVE_UPGRADE = 7,
|
||||
};
|
||||
|
||||
// Fired at the document that attempted to load mixed content. The UI could
|
||||
// handle this event, for example, by displaying an info bar that offers the
|
||||
// choice to reload the page with mixed content permitted.
|
||||
|
@ -892,6 +915,7 @@ nsMixedContentBlocker::ShouldLoad(bool aHadInsecureImageRedirect,
|
|||
originAttributes = aRequestPrincipal->OriginAttributesRef();
|
||||
}
|
||||
|
||||
bool active = (classification == eMixedScript);
|
||||
bool doHSTSPriming = false;
|
||||
if (IsEligibleForHSTSPriming(aContentLocation)) {
|
||||
bool hsts = false;
|
||||
|
@ -905,6 +929,9 @@ nsMixedContentBlocker::ShouldLoad(bool aHadInsecureImageRedirect,
|
|||
|
||||
if (hsts && sUseHSTS) {
|
||||
// assume we will be upgraded later
|
||||
Telemetry::Accumulate(Telemetry::MIXED_CONTENT_HSTS_PRIMING_2,
|
||||
(active) ? MixedContentHSTSPrimingState::eMCB_HSTS_ACTIVE_UPGRADE
|
||||
: MixedContentHSTSPrimingState::eMCB_HSTS_PASSIVE_UPGRADE);
|
||||
*aDecision = ACCEPT;
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -932,7 +959,6 @@ nsMixedContentBlocker::ShouldLoad(bool aHadInsecureImageRedirect,
|
|||
//
|
||||
// We do not count requests aHadInsecureImageRedirect=true, since these are
|
||||
// just an artifact of the image caching system.
|
||||
bool active = (classification == eMixedScript);
|
||||
if (!aHadInsecureImageRedirect) {
|
||||
if (XRE_IsParentProcess()) {
|
||||
AccumulateMixedContentHSTS(innerContentLocation, active, doHSTSPriming,
|
||||
|
@ -1103,27 +1129,6 @@ nsMixedContentBlocker::ShouldProcess(uint32_t aContentType,
|
|||
aDecision);
|
||||
}
|
||||
|
||||
enum MixedContentHSTSState {
|
||||
MCB_HSTS_PASSIVE_NO_HSTS = 0,
|
||||
MCB_HSTS_PASSIVE_WITH_HSTS = 1,
|
||||
MCB_HSTS_ACTIVE_NO_HSTS = 2,
|
||||
MCB_HSTS_ACTIVE_WITH_HSTS = 3
|
||||
};
|
||||
|
||||
// Similar to the existing mixed-content HSTS, except MCB_HSTS_*_NO_HSTS is
|
||||
// broken into two distinct states, indicating whether we plan to send a priming
|
||||
// request or not. If we decided not go send a priming request, it could be
|
||||
// because it is a type we do not support, or because we cached a previous
|
||||
// negative response.
|
||||
enum MixedContentHSTSPrimingState {
|
||||
eMCB_HSTS_PASSIVE_WITH_HSTS = 0,
|
||||
eMCB_HSTS_ACTIVE_WITH_HSTS = 1,
|
||||
eMCB_HSTS_PASSIVE_NO_PRIMING = 2,
|
||||
eMCB_HSTS_PASSIVE_DO_PRIMING = 3,
|
||||
eMCB_HSTS_ACTIVE_NO_PRIMING = 4,
|
||||
eMCB_HSTS_ACTIVE_DO_PRIMING = 5
|
||||
};
|
||||
|
||||
// Record information on when HSTS would have made mixed content not mixed
|
||||
// content (regardless of whether it was actually blocked)
|
||||
void
|
||||
|
@ -1158,17 +1163,17 @@ nsMixedContentBlocker::AccumulateMixedContentHSTS(
|
|||
Telemetry::Accumulate(Telemetry::MIXED_CONTENT_HSTS,
|
||||
MCB_HSTS_PASSIVE_NO_HSTS);
|
||||
if (aHasHSTSPriming) {
|
||||
Telemetry::Accumulate(Telemetry::MIXED_CONTENT_HSTS_PRIMING,
|
||||
Telemetry::Accumulate(Telemetry::MIXED_CONTENT_HSTS_PRIMING_2,
|
||||
eMCB_HSTS_PASSIVE_DO_PRIMING);
|
||||
} else {
|
||||
Telemetry::Accumulate(Telemetry::MIXED_CONTENT_HSTS_PRIMING,
|
||||
Telemetry::Accumulate(Telemetry::MIXED_CONTENT_HSTS_PRIMING_2,
|
||||
eMCB_HSTS_PASSIVE_NO_PRIMING);
|
||||
}
|
||||
}
|
||||
else {
|
||||
Telemetry::Accumulate(Telemetry::MIXED_CONTENT_HSTS,
|
||||
MCB_HSTS_PASSIVE_WITH_HSTS);
|
||||
Telemetry::Accumulate(Telemetry::MIXED_CONTENT_HSTS_PRIMING,
|
||||
Telemetry::Accumulate(Telemetry::MIXED_CONTENT_HSTS_PRIMING_2,
|
||||
eMCB_HSTS_PASSIVE_WITH_HSTS);
|
||||
}
|
||||
} else {
|
||||
|
@ -1176,17 +1181,17 @@ nsMixedContentBlocker::AccumulateMixedContentHSTS(
|
|||
Telemetry::Accumulate(Telemetry::MIXED_CONTENT_HSTS,
|
||||
MCB_HSTS_ACTIVE_NO_HSTS);
|
||||
if (aHasHSTSPriming) {
|
||||
Telemetry::Accumulate(Telemetry::MIXED_CONTENT_HSTS_PRIMING,
|
||||
Telemetry::Accumulate(Telemetry::MIXED_CONTENT_HSTS_PRIMING_2,
|
||||
eMCB_HSTS_ACTIVE_DO_PRIMING);
|
||||
} else {
|
||||
Telemetry::Accumulate(Telemetry::MIXED_CONTENT_HSTS_PRIMING,
|
||||
Telemetry::Accumulate(Telemetry::MIXED_CONTENT_HSTS_PRIMING_2,
|
||||
eMCB_HSTS_ACTIVE_NO_PRIMING);
|
||||
}
|
||||
}
|
||||
else {
|
||||
Telemetry::Accumulate(Telemetry::MIXED_CONTENT_HSTS,
|
||||
MCB_HSTS_ACTIVE_WITH_HSTS);
|
||||
Telemetry::Accumulate(Telemetry::MIXED_CONTENT_HSTS_PRIMING,
|
||||
Telemetry::Accumulate(Telemetry::MIXED_CONTENT_HSTS_PRIMING_2,
|
||||
eMCB_HSTS_ACTIVE_WITH_HSTS);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,6 +5,19 @@
|
|||
*/
|
||||
'use strict';
|
||||
|
||||
var expected_telemetry = {
|
||||
"histograms": {
|
||||
"MIXED_CONTENT_HSTS_PRIMING_RESULT": 3,
|
||||
"MIXED_CONTENT_HSTS_PRIMING_REQUESTS": 6,
|
||||
},
|
||||
"keyed-histograms": {
|
||||
"HSTS_PRIMING_REQUEST_DURATION": {
|
||||
"success": 1,
|
||||
"failure": 2,
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
//jscs:disable
|
||||
add_task(function*() {
|
||||
//jscs:enable
|
||||
|
@ -15,10 +28,13 @@ add_task(function*() {
|
|||
let which = "allow_active";
|
||||
|
||||
SetupPrefTestEnvironment(which);
|
||||
clear_hists(expected_telemetry);
|
||||
|
||||
for (let server of Object.keys(test_servers)) {
|
||||
yield execute_test(server, test_settings[which].mimetype);
|
||||
}
|
||||
|
||||
test_telemetry(expected_telemetry);
|
||||
|
||||
SpecialPowers.popPrefEnv();
|
||||
});
|
||||
|
|
|
@ -5,6 +5,19 @@
|
|||
*/
|
||||
'use strict';
|
||||
|
||||
var expected_telemetry = {
|
||||
"histograms": {
|
||||
"MIXED_CONTENT_HSTS_PRIMING_RESULT": 3,
|
||||
"MIXED_CONTENT_HSTS_PRIMING_REQUESTS": 6,
|
||||
},
|
||||
"keyed-histograms": {
|
||||
"HSTS_PRIMING_REQUEST_DURATION": {
|
||||
"success": 1,
|
||||
"failure": 2,
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
//jscs:disable
|
||||
add_task(function*() {
|
||||
//jscs:enable
|
||||
|
@ -15,10 +28,13 @@ add_task(function*() {
|
|||
let which = "allow_display";
|
||||
|
||||
SetupPrefTestEnvironment(which);
|
||||
clear_hists(expected_telemetry);
|
||||
|
||||
for (let server of Object.keys(test_servers)) {
|
||||
yield execute_test(server, test_settings[which].mimetype);
|
||||
}
|
||||
|
||||
test_telemetry(expected_telemetry);
|
||||
|
||||
SpecialPowers.popPrefEnv();
|
||||
});
|
||||
|
|
|
@ -5,6 +5,19 @@
|
|||
*/
|
||||
'use strict';
|
||||
|
||||
var expected_telemetry = {
|
||||
"histograms": {
|
||||
"MIXED_CONTENT_HSTS_PRIMING_RESULT": 3,
|
||||
"MIXED_CONTENT_HSTS_PRIMING_REQUESTS": 6,
|
||||
},
|
||||
"keyed-histograms": {
|
||||
"HSTS_PRIMING_REQUEST_DURATION": {
|
||||
"success": 1,
|
||||
"failure": 2,
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
//jscs:disable
|
||||
add_task(function*() {
|
||||
//jscs:enable
|
||||
|
@ -15,10 +28,13 @@ add_task(function*() {
|
|||
let which = "block_active";
|
||||
|
||||
SetupPrefTestEnvironment(which);
|
||||
clear_hists(expected_telemetry);
|
||||
|
||||
for (let server of Object.keys(test_servers)) {
|
||||
yield execute_test(server, test_settings[which].mimetype);
|
||||
}
|
||||
|
||||
test_telemetry(expected_telemetry);
|
||||
|
||||
SpecialPowers.popPrefEnv();
|
||||
});
|
||||
|
|
|
@ -5,6 +5,19 @@
|
|||
*/
|
||||
'use strict';
|
||||
|
||||
var expected_telemetry = {
|
||||
"histograms": {
|
||||
"MIXED_CONTENT_HSTS_PRIMING_RESULT": 3,
|
||||
"MIXED_CONTENT_HSTS_PRIMING_REQUESTS": 6,
|
||||
},
|
||||
"keyed-histograms": {
|
||||
"HSTS_PRIMING_REQUEST_DURATION": {
|
||||
"success": 1,
|
||||
"failure": 2,
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
//jscs:disable
|
||||
add_task(function*() {
|
||||
//jscs:enable
|
||||
|
@ -15,10 +28,13 @@ add_task(function*() {
|
|||
let which = "block_active_css";
|
||||
|
||||
SetupPrefTestEnvironment(which);
|
||||
clear_hists(expected_telemetry);
|
||||
|
||||
for (let server of Object.keys(test_servers)) {
|
||||
yield execute_test(server, test_settings[which].mimetype);
|
||||
}
|
||||
|
||||
test_telemetry(expected_telemetry);
|
||||
|
||||
SpecialPowers.popPrefEnv();
|
||||
});
|
||||
|
|
|
@ -5,6 +5,19 @@
|
|||
*/
|
||||
'use strict';
|
||||
|
||||
var expected_telemetry = {
|
||||
"histograms": {
|
||||
"MIXED_CONTENT_HSTS_PRIMING_RESULT": 3,
|
||||
"MIXED_CONTENT_HSTS_PRIMING_REQUESTS": 6,
|
||||
},
|
||||
"keyed-histograms": {
|
||||
"HSTS_PRIMING_REQUEST_DURATION": {
|
||||
"success": 1,
|
||||
"failure": 2,
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
//jscs:disable
|
||||
add_task(function*() {
|
||||
//jscs:enable
|
||||
|
@ -15,10 +28,13 @@ add_task(function*() {
|
|||
let which = "block_active_with_redir_same";
|
||||
|
||||
SetupPrefTestEnvironment(which);
|
||||
clear_hists(expected_telemetry);
|
||||
|
||||
for (let server of Object.keys(test_servers)) {
|
||||
yield execute_test(server, test_settings[which].mimetype);
|
||||
}
|
||||
|
||||
test_telemetry(expected_telemetry);
|
||||
|
||||
SpecialPowers.popPrefEnv();
|
||||
});
|
||||
|
|
|
@ -5,6 +5,19 @@
|
|||
*/
|
||||
'use strict';
|
||||
|
||||
var expected_telemetry = {
|
||||
"histograms": {
|
||||
"MIXED_CONTENT_HSTS_PRIMING_RESULT": 3,
|
||||
"MIXED_CONTENT_HSTS_PRIMING_REQUESTS": 6,
|
||||
},
|
||||
"keyed-histograms": {
|
||||
"HSTS_PRIMING_REQUEST_DURATION": {
|
||||
"success": 1,
|
||||
"failure": 2,
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
//jscs:disable
|
||||
add_task(function*() {
|
||||
//jscs:enable
|
||||
|
@ -15,10 +28,13 @@ add_task(function*() {
|
|||
let which = "block_display";
|
||||
|
||||
SetupPrefTestEnvironment(which);
|
||||
clear_hists(expected_telemetry);
|
||||
|
||||
for (let server of Object.keys(test_servers)) {
|
||||
yield execute_test(server, test_settings[which].mimetype);
|
||||
}
|
||||
|
||||
test_telemetry(expected_telemetry);
|
||||
|
||||
SpecialPowers.popPrefEnv();
|
||||
});
|
||||
|
|
|
@ -5,6 +5,18 @@
|
|||
*/
|
||||
'use strict';
|
||||
|
||||
var expected_telemetry = {
|
||||
"histograms": {
|
||||
"MIXED_CONTENT_HSTS_PRIMING_RESULT": 2,
|
||||
"MIXED_CONTENT_HSTS_PRIMING_REQUESTS": 4,
|
||||
},
|
||||
"keyed-histograms": {
|
||||
"HSTS_PRIMING_REQUEST_DURATION": {
|
||||
"failure": 2,
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
//jscs:disable
|
||||
add_task(function*() {
|
||||
//jscs:enable
|
||||
|
@ -14,6 +26,7 @@ add_task(function*() {
|
|||
let which = "block_display";
|
||||
|
||||
SetupPrefTestEnvironment(which, [["security.mixed_content.hsts_priming_cache_timeout", 1]]);
|
||||
clear_hists(expected_telemetry);
|
||||
|
||||
yield execute_test("no-ssl", test_settings[which].mimetype);
|
||||
|
||||
|
@ -32,5 +45,7 @@ add_task(function*() {
|
|||
is(test_settings[which].priming["no-ssl"], true,
|
||||
"Correctly send a priming request after expiration.");
|
||||
|
||||
test_telemetry(expected_telemetry);
|
||||
|
||||
SpecialPowers.popPrefEnv();
|
||||
});
|
||||
|
|
|
@ -5,6 +5,19 @@
|
|||
*/
|
||||
'use strict';
|
||||
|
||||
var expected_telemetry = {
|
||||
"histograms": {
|
||||
"MIXED_CONTENT_HSTS_PRIMING_RESULT": 3,
|
||||
"MIXED_CONTENT_HSTS_PRIMING_REQUESTS": 6,
|
||||
},
|
||||
"keyed-histograms": {
|
||||
"HSTS_PRIMING_REQUEST_DURATION": {
|
||||
"success": 1,
|
||||
"failure": 2,
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
//jscs:disable
|
||||
add_task(function*() {
|
||||
//jscs:enable
|
||||
|
@ -15,10 +28,13 @@ add_task(function*() {
|
|||
let which = "hsts_after_mixed";
|
||||
|
||||
SetupPrefTestEnvironment(which);
|
||||
clear_hists(expected_telemetry);
|
||||
|
||||
for (let server of Object.keys(test_servers)) {
|
||||
yield execute_test(server, test_settings[which].mimetype);
|
||||
}
|
||||
|
||||
test_telemetry(expected_telemetry);
|
||||
|
||||
SpecialPowers.popPrefEnv();
|
||||
});
|
||||
|
|
|
@ -10,6 +10,18 @@
|
|||
*/
|
||||
'use strict';
|
||||
|
||||
var expected_telemetry = {
|
||||
"histograms": {
|
||||
"MIXED_CONTENT_HSTS_PRIMING_RESULT": 2,
|
||||
"MIXED_CONTENT_HSTS_PRIMING_REQUESTS": 4,
|
||||
},
|
||||
"keyed-histograms": {
|
||||
"HSTS_PRIMING_REQUEST_DURATION": {
|
||||
"success": 2,
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
//jscs:disable
|
||||
add_task(function*() {
|
||||
//jscs:enable
|
||||
|
@ -27,6 +39,7 @@ add_task(function*() {
|
|||
let which = "block_active";
|
||||
|
||||
SetupPrefTestEnvironment(which);
|
||||
clear_hists(expected_telemetry);
|
||||
|
||||
yield execute_test("top-level", test_settings[which].mimetype);
|
||||
|
||||
|
@ -35,5 +48,7 @@ add_task(function*() {
|
|||
ok("prime-hsts" in test_settings[which].priming,
|
||||
"HSTS priming on a subdomain when top-level does not includeSubDomains");
|
||||
|
||||
test_telemetry(expected_telemetry);
|
||||
|
||||
SpecialPowers.popPrefEnv();
|
||||
});
|
||||
|
|
|
@ -5,6 +5,19 @@
|
|||
*/
|
||||
'use strict';
|
||||
|
||||
var expected_telemetry = {
|
||||
"histograms": {
|
||||
"MIXED_CONTENT_HSTS_PRIMING_RESULT": 3,
|
||||
"MIXED_CONTENT_HSTS_PRIMING_REQUESTS": 8,
|
||||
},
|
||||
"keyed-histograms": {
|
||||
"HSTS_PRIMING_REQUEST_DURATION": {
|
||||
"success": 1,
|
||||
"failure": 2,
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
//jscs:disable
|
||||
add_task(function*() {
|
||||
//jscs:enable
|
||||
|
@ -14,6 +27,7 @@ add_task(function*() {
|
|||
let which = "block_display";
|
||||
|
||||
SetupPrefTestEnvironment(which);
|
||||
clear_hists(expected_telemetry);
|
||||
|
||||
for (let server of Object.keys(test_servers)) {
|
||||
yield execute_test(server, test_settings[which].mimetype);
|
||||
|
@ -24,5 +38,7 @@ add_task(function*() {
|
|||
yield execute_test(server, test_settings[which].mimetype);
|
||||
}
|
||||
|
||||
test_telemetry(expected_telemetry);
|
||||
|
||||
SpecialPowers.popPrefEnv();
|
||||
});
|
||||
|
|
|
@ -6,6 +6,15 @@
|
|||
*/
|
||||
'use strict';
|
||||
|
||||
var expected_telemetry = {
|
||||
"histograms": {
|
||||
"MIXED_CONTENT_HSTS_PRIMING_RESULT": 0,
|
||||
"MIXED_CONTENT_HSTS_PRIMING_REQUESTS": 1,
|
||||
},
|
||||
"keyed-histograms": {
|
||||
}
|
||||
};
|
||||
|
||||
//jscs:disable
|
||||
add_task(function*() {
|
||||
//jscs:enable
|
||||
|
@ -23,8 +32,11 @@ add_task(function*() {
|
|||
let which = "block_active";
|
||||
|
||||
SetupPrefTestEnvironment(which);
|
||||
clear_hists(expected_telemetry);
|
||||
|
||||
yield execute_test("localhost-ip", test_settings[which].mimetype);
|
||||
|
||||
test_telemetry(expected_telemetry);
|
||||
|
||||
SpecialPowers.popPrefEnv();
|
||||
});
|
||||
|
|
|
@ -6,6 +6,18 @@
|
|||
*/
|
||||
'use strict';
|
||||
|
||||
var expected_telemetry = {
|
||||
"histograms": {
|
||||
"MIXED_CONTENT_HSTS_PRIMING_RESULT": 1,
|
||||
"MIXED_CONTENT_HSTS_PRIMING_REQUESTS": 3,
|
||||
},
|
||||
"keyed-histograms": {
|
||||
"HSTS_PRIMING_REQUEST_DURATION": {
|
||||
"success": 1,
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
//jscs:disable
|
||||
add_task(function*() {
|
||||
//jscs:enable
|
||||
|
@ -14,7 +26,7 @@ add_task(function*() {
|
|||
|
||||
// add the top-level server
|
||||
test_servers['non-standard-port'] = {
|
||||
host: 'example.com:1234',
|
||||
host: 'test1.example.com:1234',
|
||||
response: true,
|
||||
id: 'non-standard-port',
|
||||
};
|
||||
|
@ -23,6 +35,7 @@ add_task(function*() {
|
|||
let which = "block_active";
|
||||
|
||||
SetupPrefTestEnvironment(which);
|
||||
clear_hists(expected_telemetry);
|
||||
|
||||
yield execute_test("non-standard-port", test_settings[which].mimetype);
|
||||
|
||||
|
@ -30,5 +43,7 @@ add_task(function*() {
|
|||
|
||||
ok("prime-hsts" in test_settings[which_test].priming, "Sent priming request on standard port after non-standard was not primed");
|
||||
|
||||
test_telemetry(expected_telemetry);
|
||||
|
||||
SpecialPowers.popPrefEnv();
|
||||
});
|
||||
|
|
|
@ -5,6 +5,18 @@
|
|||
*/
|
||||
'use strict';
|
||||
|
||||
var expected_telemetry = {
|
||||
"histograms": {
|
||||
"MIXED_CONTENT_HSTS_PRIMING_RESULT": 3,
|
||||
"MIXED_CONTENT_HSTS_PRIMING_REQUESTS": 3,
|
||||
},
|
||||
"keyed-histograms": {
|
||||
"HSTS_PRIMING_REQUEST_DURATION": {
|
||||
"failure": 3,
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
//jscs:disable
|
||||
add_task(function*() {
|
||||
//jscs:enable
|
||||
|
@ -15,10 +27,13 @@ add_task(function*() {
|
|||
|
||||
SetupPrefTestEnvironment(which, [["security.mixed_content.hsts_priming_request_timeout",
|
||||
1000]]);
|
||||
clear_hists(expected_telemetry);
|
||||
|
||||
for (let server of Object.keys(test_servers)) {
|
||||
yield execute_test(server, test_settings[which].mimetype);
|
||||
}
|
||||
|
||||
test_telemetry(expected_telemetry);
|
||||
|
||||
SpecialPowers.popPrefEnv();
|
||||
});
|
||||
|
|
|
@ -377,12 +377,16 @@ function clear_sts_data() {
|
|||
}
|
||||
}
|
||||
|
||||
var oldCanRecord = Services.telemetry.canRecordExtended;
|
||||
|
||||
function do_cleanup() {
|
||||
clear_sts_data();
|
||||
|
||||
Services.obs.removeObserver(Observer, "console-api-log-event");
|
||||
Services.obs.removeObserver(Observer, "http-on-examine-response");
|
||||
|
||||
Services.telemetry.canRecordExtended = oldCanRecord;
|
||||
|
||||
Observer.cleanup();
|
||||
}
|
||||
|
||||
|
@ -404,6 +408,7 @@ function SetupPrefTestEnvironment(which, additional_prefs) {
|
|||
settings.use_hsts],
|
||||
["security.mixed_content.send_hsts_priming",
|
||||
settings.send_hsts_priming],
|
||||
["toolkit.telemetry.enabled", true],
|
||||
];
|
||||
|
||||
if (additional_prefs) {
|
||||
|
@ -412,6 +417,8 @@ function SetupPrefTestEnvironment(which, additional_prefs) {
|
|||
}
|
||||
}
|
||||
|
||||
Services.telemetry.canRecordExtended = true;
|
||||
|
||||
SpecialPowers.pushPrefEnv({'set': prefs});
|
||||
}
|
||||
|
||||
|
@ -433,3 +440,88 @@ async function execute_test(test, mimetype) {
|
|||
|
||||
await BrowserTestUtils.withNewTab(src, () => {});
|
||||
}
|
||||
|
||||
/* Expected should look something like this:
|
||||
* The numbers are the sum of all telemetry values.
|
||||
var expected_telemetry = {
|
||||
"histograms": {
|
||||
"MIXED_CONTENT_HSTS_PRIMING_RESULT": 6,
|
||||
"HSTS_PRIMING_REQUESTS": 10,
|
||||
},
|
||||
"keyed-histograms": {
|
||||
"HSTS_PRIMING_REQUEST_DURATION": {
|
||||
"success": 1,
|
||||
"failure": 2,
|
||||
},
|
||||
}
|
||||
};
|
||||
*/
|
||||
function test_telemetry(expected) {
|
||||
for (let key in expected['histograms']) {
|
||||
let hs = undefined;
|
||||
try {
|
||||
let hist = Services.telemetry.getHistogramById(key);
|
||||
hs = hist.snapshot();
|
||||
hist.clear();
|
||||
} catch(e) {
|
||||
ok(false, "Caught exception trying to get histogram for key " + key + ":" + e);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!hs) {
|
||||
ok(false, "No histogram found for key " + key);
|
||||
continue;
|
||||
}
|
||||
|
||||
// there may have been other background requests processed
|
||||
ok(hs.counts.reduce(sum) >= expected['histograms'][key], "Histogram counts match expected, got " + hs.counts.reduce(sum) + ", expected at least " + expected['histograms'][key]);
|
||||
}
|
||||
|
||||
for (let key in expected['keyed-histograms']) {
|
||||
let hs = undefined;
|
||||
try {
|
||||
let hist = Services.telemetry.getKeyedHistogramById(key);
|
||||
hs = hist.snapshot();
|
||||
hist.clear();
|
||||
} catch(e) {
|
||||
ok(false, "Caught exception trying to get histogram for key " + key + " :" + e);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!hs) {
|
||||
ok(false, "No keyed histogram found for key " + key);
|
||||
continue;
|
||||
}
|
||||
|
||||
for (let hist_key in expected['keyed-histograms'][key]) {
|
||||
ok(hist_key in hs, "Keyed histogram exists with key");
|
||||
if (hist_key in hs) {
|
||||
ok(hs[hist_key].counts.reduce(sum) >= expected['keyed-histograms'][key][hist_key], "Keyed histogram counts match expected got " + hs[hist_key].counts.reduce(sum) + ", expected at least " + expected['keyed-histograms'][key][hist_key])
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function sum(a, b) {
|
||||
return a+b;
|
||||
}
|
||||
|
||||
function clear_hists(hists) {
|
||||
for (let key in hists['histograms']) {
|
||||
try {
|
||||
let hist = Services.telemetry.getHistogramById(key);
|
||||
hist.clear();
|
||||
} catch(e) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
for (let key in hists['keyed-histograms']) {
|
||||
try {
|
||||
let hist = Services.telemetry.getKeyedHistogramById(key);
|
||||
hist.clear();
|
||||
} catch(e) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
#ifndef nsXBLBinding_h_
|
||||
#define nsXBLBinding_h_
|
||||
|
||||
#include "mozilla/ServoBindings.h"
|
||||
#include "nsXBLService.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsINodeList.h"
|
||||
|
@ -24,6 +23,7 @@ class nsIAtom;
|
|||
class nsIDocument;
|
||||
|
||||
namespace mozilla {
|
||||
class ServoStyleSet;
|
||||
namespace dom {
|
||||
|
||||
class ShadowRoot;
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
#ifndef nsXBLPrototypeResources_h__
|
||||
#define nsXBLPrototypeResources_h__
|
||||
|
||||
#include "mozilla/ServoBindings.h"
|
||||
#include "mozilla/StyleSheet.h"
|
||||
#include "nsICSSLoaderObserver.h"
|
||||
|
||||
|
|
|
@ -5856,6 +5856,18 @@ HTMLEditRules::GetNodesForOperation(
|
|||
GetInnerContent(*node, aOutArrayOfNodes, &j);
|
||||
}
|
||||
}
|
||||
// Empty text node shouldn't be selected if unnecessary
|
||||
for (int32_t i = aOutArrayOfNodes.Length() - 1; i >= 0; i--) {
|
||||
OwningNonNull<nsINode> node = aOutArrayOfNodes[i];
|
||||
if (EditorBase::IsTextNode(node)) {
|
||||
// Don't select empty text except to empty block
|
||||
bool isEmpty = false;
|
||||
htmlEditor->IsVisTextNode(node->AsContent(), &isEmpty, false);
|
||||
if (isEmpty) {
|
||||
aOutArrayOfNodes.RemoveElementAt(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// Indent/outdent already do something special for list items, but we still
|
||||
// need to make sure we don't act on table elements
|
||||
|
|
|
@ -235,6 +235,7 @@ skip-if = toolkit == 'android' # bug 1315898
|
|||
[test_bug1352799.html]
|
||||
[test_bug1355792.html]
|
||||
[test_bug1358025.html]
|
||||
[test_bug1361008.html]
|
||||
[test_bug1368544.html]
|
||||
|
||||
[test_CF_HTML_clipboard.html]
|
||||
|
|
|
@ -0,0 +1,63 @@
|
|||
<!DOCTYPE html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi=id=1361008
|
||||
-->
|
||||
<html>
|
||||
<head>
|
||||
<title>Bug 1361008</title>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1361008">Mozilla Bug 1361008</a>
|
||||
<p id="display"></p>
|
||||
<div contenteditable="true" id="edit1">
|
||||
<br>
|
||||
</div>
|
||||
<div contenteditable="true" id="edit2">
|
||||
<br>
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script type="application/javascript">
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
SimpleTest.waitForFocus(() => {
|
||||
document.execCommand("defaultparagraphseparator", false, "div")
|
||||
let edit1 = document.getElementById("edit1");
|
||||
edit1.focus();
|
||||
let selection = window.getSelection();
|
||||
// Insert text before BR element
|
||||
selection.collapse(edit1, 0);
|
||||
synthesizeKey("A", {});
|
||||
synthesizeKey("B", {});
|
||||
synthesizeKey("VK_RETURN", {});
|
||||
// count <div> element into contenteidable
|
||||
is(edit1.getElementsByTagName('div').length, 2,
|
||||
"DIV element should be 2 children");
|
||||
is(edit1.getElementsByTagName('div')[0].innerText,
|
||||
"AB", "AB should be in 1st DIV element");
|
||||
is(edit1.getElementsByTagName('div')[1].innerHTML,
|
||||
"<br>", "BR element should be in 2nd DIV element");
|
||||
|
||||
document.execCommand("defaultparagraphseparator", false, "p")
|
||||
let edit2 = document.getElementById("edit2");
|
||||
edit2.focus();
|
||||
selection.collapse(edit2, 0);
|
||||
// Insert text before BR element
|
||||
synthesizeKey("A", {});
|
||||
synthesizeKey("B", {});
|
||||
synthesizeKey("VK_RETURN", {});
|
||||
|
||||
is(edit2.getElementsByTagName('p').length, 2,
|
||||
"P element should be 2 children");
|
||||
is(edit2.getElementsByTagName('p')[0].innerText,
|
||||
"AB", "AB should be in 1st P element");
|
||||
is(edit2.getElementsByTagName('p')[1].innerHTML,
|
||||
"<br>", "BR element should be into 2nd P element");
|
||||
|
||||
SimpleTest.finish();
|
||||
});
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
|
@ -78,20 +78,13 @@ using namespace mozilla::dom;
|
|||
//#define DEBUG_INLINESPELL
|
||||
|
||||
// the number of milliseconds that we will take at once to do spellchecking
|
||||
#define INLINESPELL_CHECK_TIMEOUT 50
|
||||
#define INLINESPELL_CHECK_TIMEOUT 1
|
||||
|
||||
// The number of words to check before we look at the time to see if
|
||||
// INLINESPELL_CHECK_TIMEOUT ms have elapsed. This prevents us from spending
|
||||
// too much time checking the clock. Note that misspelled words count for
|
||||
// more than one word in this calculation.
|
||||
#define INLINESPELL_TIMEOUT_CHECK_FREQUENCY 50
|
||||
|
||||
// This number is the number of checked words a misspelled word counts for
|
||||
// when we're checking the time to see if the alloted time is up for
|
||||
// spellchecking. Misspelled words take longer to process since we have to
|
||||
// create a range, so they count more. The exact number isn't very important
|
||||
// since this just controls how often we check the current time.
|
||||
#define MISSPELLED_WORD_COUNT_PENALTY 4
|
||||
// INLINESPELL_CHECK_TIMEOUT ms have elapsed. This prevents us from getting
|
||||
// stuck and not moving forward because the INLINESPELL_CHECK_TIMEOUT might
|
||||
// be too short to a low-end machine.
|
||||
#define INLINESPELL_MINIMUM_WORDS_BEFORE_TIMEOUT 5
|
||||
|
||||
// These notifications are broadcast when spell check starts and ends. STARTED
|
||||
// must always be followed by ENDED.
|
||||
|
@ -101,7 +94,10 @@ using namespace mozilla::dom;
|
|||
static bool ContentIsDescendantOf(nsINode* aPossibleDescendant,
|
||||
nsINode* aPossibleAncestor);
|
||||
|
||||
static const char kMaxSpellCheckSelectionSize[] = "extensions.spellcheck.inline.max-misspellings";
|
||||
static const char kMaxSpellCheckSelectionSize[] =
|
||||
"extensions.spellcheck.inline.max-misspellings";
|
||||
static const PRTime kMaxSpellCheckTimeInUsec =
|
||||
INLINESPELL_CHECK_TIMEOUT * PR_USEC_PER_MSEC;
|
||||
|
||||
mozInlineSpellStatus::mozInlineSpellStatus(mozInlineSpellChecker* aSpellChecker)
|
||||
: mSpellChecker(aSpellChecker), mWordCount(0)
|
||||
|
@ -484,11 +480,11 @@ mozInlineSpellStatus::PositionToCollapsedRange(nsIDOMDocument* aDocument,
|
|||
class mozInlineSpellResume : public Runnable
|
||||
{
|
||||
public:
|
||||
mozInlineSpellResume(const mozInlineSpellStatus& aStatus,
|
||||
mozInlineSpellResume(UniquePtr<mozInlineSpellStatus>&& aStatus,
|
||||
uint32_t aDisabledAsyncToken)
|
||||
: Runnable("mozInlineSpellResume")
|
||||
, mDisabledAsyncToken(aDisabledAsyncToken)
|
||||
, mStatus(aStatus)
|
||||
, mStatus(Move(aStatus))
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -501,15 +497,15 @@ public:
|
|||
{
|
||||
// Discard the resumption if the spell checker was disabled after the
|
||||
// resumption was scheduled.
|
||||
if (mDisabledAsyncToken == mStatus.mSpellChecker->mDisabledAsyncToken) {
|
||||
mStatus.mSpellChecker->ResumeCheck(&mStatus);
|
||||
if (mDisabledAsyncToken == mStatus->mSpellChecker->mDisabledAsyncToken) {
|
||||
mStatus->mSpellChecker->ResumeCheck(Move(mStatus));
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
private:
|
||||
uint32_t mDisabledAsyncToken;
|
||||
mozInlineSpellStatus mStatus;
|
||||
UniquePtr<mozInlineSpellStatus> mStatus;
|
||||
};
|
||||
|
||||
// Used as the nsIEditorSpellCheck::InitSpellChecker callback.
|
||||
|
@ -700,7 +696,8 @@ mozInlineSpellChecker::UpdateCanEnableInlineSpellChecking()
|
|||
|
||||
// mozInlineSpellChecker::RegisterEventListeners
|
||||
//
|
||||
// The inline spell checker listens to mouse events and keyboard navigation+ // events.
|
||||
// The inline spell checker listens to mouse events and keyboard navigation
|
||||
// events.
|
||||
|
||||
nsresult
|
||||
mozInlineSpellChecker::RegisterEventListeners()
|
||||
|
@ -901,14 +898,15 @@ mozInlineSpellChecker::SpellCheckAfterEditorChange(
|
|||
rv = aSelection->GetAnchorOffset(&anchorOffset);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
mozInlineSpellStatus status(this);
|
||||
rv = status.InitForEditorChange((EditAction)aAction,
|
||||
anchorNode, anchorOffset,
|
||||
aPreviousSelectedNode, aPreviousSelectedOffset,
|
||||
aStartNode, aStartOffset,
|
||||
aEndNode, aEndOffset);
|
||||
auto status = MakeUnique<mozInlineSpellStatus>(this);
|
||||
rv = status->InitForEditorChange((EditAction)aAction,
|
||||
anchorNode, anchorOffset,
|
||||
aPreviousSelectedNode,
|
||||
aPreviousSelectedOffset,
|
||||
aStartNode, aStartOffset,
|
||||
aEndNode, aEndOffset);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
rv = ScheduleSpellCheck(status);
|
||||
rv = ScheduleSpellCheck(Move(status));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// remember the current caret position after every change
|
||||
|
@ -931,11 +929,11 @@ mozInlineSpellChecker::SpellCheckRange(nsIDOMRange* aRange)
|
|||
return NS_ERROR_NOT_INITIALIZED;
|
||||
}
|
||||
|
||||
mozInlineSpellStatus status(this);
|
||||
auto status = MakeUnique<mozInlineSpellStatus>(this);
|
||||
nsRange* range = static_cast<nsRange*>(aRange);
|
||||
nsresult rv = status.InitForRange(range);
|
||||
nsresult rv = status->InitForRange(range);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
return ScheduleSpellCheck(status);
|
||||
return ScheduleSpellCheck(Move(status));
|
||||
}
|
||||
|
||||
// mozInlineSpellChecker::GetMisspelledWord
|
||||
|
@ -1002,10 +1000,10 @@ mozInlineSpellChecker::AddWordToDictionary(const nsAString &word)
|
|||
nsresult rv = mSpellCheck->AddWordToDictionary(wordstr.get());
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
mozInlineSpellStatus status(this);
|
||||
rv = status.InitForSelection();
|
||||
auto status = MakeUnique<mozInlineSpellStatus>(this);
|
||||
rv = status->InitForSelection();
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
return ScheduleSpellCheck(status);
|
||||
return ScheduleSpellCheck(Move(status));
|
||||
}
|
||||
|
||||
// mozInlineSpellChecker::RemoveWordFromDictionary
|
||||
|
@ -1019,10 +1017,10 @@ mozInlineSpellChecker::RemoveWordFromDictionary(const nsAString &word)
|
|||
nsresult rv = mSpellCheck->RemoveWordFromDictionary(wordstr.get());
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
mozInlineSpellStatus status(this);
|
||||
rv = status.InitForRange(nullptr);
|
||||
auto status = MakeUnique<mozInlineSpellStatus>(this);
|
||||
rv = status->InitForRange(nullptr);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
return ScheduleSpellCheck(status);
|
||||
return ScheduleSpellCheck(Move(status));
|
||||
}
|
||||
|
||||
// mozInlineSpellChecker::IgnoreWord
|
||||
|
@ -1036,10 +1034,10 @@ mozInlineSpellChecker::IgnoreWord(const nsAString &word)
|
|||
nsresult rv = mSpellCheck->IgnoreWordAllOccurrences(wordstr.get());
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
mozInlineSpellStatus status(this);
|
||||
rv = status.InitForSelection();
|
||||
auto status = MakeUnique<mozInlineSpellStatus>(this);
|
||||
rv = status->InitForSelection();
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
return ScheduleSpellCheck(status);
|
||||
return ScheduleSpellCheck(Move(status));
|
||||
}
|
||||
|
||||
// mozInlineSpellChecker::IgnoreWords
|
||||
|
@ -1054,10 +1052,10 @@ mozInlineSpellChecker::IgnoreWords(const char16_t **aWordsToIgnore,
|
|||
for (uint32_t index = 0; index < aCount; index++)
|
||||
mSpellCheck->IgnoreWordAllOccurrences(aWordsToIgnore[index]);
|
||||
|
||||
mozInlineSpellStatus status(this);
|
||||
nsresult rv = status.InitForSelection();
|
||||
auto status = MakeUnique<mozInlineSpellStatus>(this);
|
||||
nsresult rv = status->InitForSelection();
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
return ScheduleSpellCheck(status);
|
||||
return ScheduleSpellCheck(Move(status));
|
||||
}
|
||||
|
||||
NS_IMETHODIMP mozInlineSpellChecker::WillCreateNode(const nsAString & aTag, nsIDOMNode *aParent, int32_t aPosition)
|
||||
|
@ -1244,10 +1242,10 @@ mozInlineSpellChecker::SpellCheckBetweenNodes(nsIDOMNode *aStartNode,
|
|||
if (! range)
|
||||
return NS_OK; // range is empty: nothing to do
|
||||
|
||||
mozInlineSpellStatus status(this);
|
||||
rv = status.InitForRange(range);
|
||||
auto status = MakeUnique<mozInlineSpellStatus>(this);
|
||||
rv = status->InitForRange(range);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
return ScheduleSpellCheck(status);
|
||||
return ScheduleSpellCheck(Move(status));
|
||||
}
|
||||
|
||||
// mozInlineSpellChecker::ShouldSpellCheckNode
|
||||
|
@ -1332,20 +1330,23 @@ mozInlineSpellChecker::ShouldSpellCheckNode(nsIEditor* aEditor,
|
|||
// the proper structures for calls to DoSpellCheck.
|
||||
|
||||
nsresult
|
||||
mozInlineSpellChecker::ScheduleSpellCheck(const mozInlineSpellStatus& aStatus)
|
||||
mozInlineSpellChecker::ScheduleSpellCheck(UniquePtr<mozInlineSpellStatus>&& aStatus)
|
||||
{
|
||||
if (mFullSpellCheckScheduled) {
|
||||
// Just ignore this; we're going to spell-check everything anyway
|
||||
return NS_OK;
|
||||
}
|
||||
// Cache the value because we are going to move aStatus's ownership to
|
||||
// the new created mozInlineSpellResume instance.
|
||||
bool isFullSpellCheck = aStatus->IsFullSpellCheck();
|
||||
|
||||
RefPtr<mozInlineSpellResume> resume =
|
||||
new mozInlineSpellResume(aStatus, mDisabledAsyncToken);
|
||||
new mozInlineSpellResume(Move(aStatus), mDisabledAsyncToken);
|
||||
NS_ENSURE_TRUE(resume, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
nsresult rv = resume->Post();
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
if (aStatus.IsFullSpellCheck()) {
|
||||
if (isFullSpellCheck) {
|
||||
// We're going to check everything. Suppress further spell-check attempts
|
||||
// until that happens.
|
||||
mFullSpellCheckScheduled = true;
|
||||
|
@ -1368,8 +1369,7 @@ mozInlineSpellChecker::ScheduleSpellCheck(const mozInlineSpellStatus& aStatus)
|
|||
|
||||
nsresult
|
||||
mozInlineSpellChecker::DoSpellCheckSelection(mozInlineSpellWordUtil& aWordUtil,
|
||||
Selection* aSpellCheckSelection,
|
||||
mozInlineSpellStatus* aStatus)
|
||||
Selection* aSpellCheckSelection)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
|
@ -1400,8 +1400,8 @@ mozInlineSpellChecker::DoSpellCheckSelection(mozInlineSpellWordUtil& aWordUtil,
|
|||
// We use this state object for all calls, and just update its range. Note
|
||||
// that we don't need to call FinishInit since we will be filling in the
|
||||
// necessary information.
|
||||
mozInlineSpellStatus status(this);
|
||||
rv = status.InitForRange(nullptr);
|
||||
auto status = MakeUnique<mozInlineSpellStatus>(this);
|
||||
rv = status->InitForRange(nullptr);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
bool doneChecking;
|
||||
|
@ -1410,14 +1410,14 @@ mozInlineSpellChecker::DoSpellCheckSelection(mozInlineSpellWordUtil& aWordUtil,
|
|||
// check range over it that needs to be deleted. All the old ranges
|
||||
// were cleared above. We also need to clear the word count so that we
|
||||
// check all words instead of stopping early.
|
||||
status.mRange = ranges[idx];
|
||||
rv = DoSpellCheck(aWordUtil, aSpellCheckSelection, &status,
|
||||
status->mRange = ranges[idx];
|
||||
rv = DoSpellCheck(aWordUtil, aSpellCheckSelection, status,
|
||||
&doneChecking);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
MOZ_ASSERT(doneChecking,
|
||||
"We gave the spellchecker one word, but it didn't finish checking?!?!");
|
||||
|
||||
status.mWordCount = 0;
|
||||
status->mWordCount = 0;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
|
@ -1456,7 +1456,7 @@ mozInlineSpellChecker::DoSpellCheckSelection(mozInlineSpellWordUtil& aWordUtil,
|
|||
|
||||
nsresult mozInlineSpellChecker::DoSpellCheck(mozInlineSpellWordUtil& aWordUtil,
|
||||
Selection *aSpellCheckSelection,
|
||||
mozInlineSpellStatus* aStatus,
|
||||
const UniquePtr<mozInlineSpellStatus>& aStatus,
|
||||
bool* aDoneChecking)
|
||||
{
|
||||
*aDoneChecking = true;
|
||||
|
@ -1505,7 +1505,7 @@ nsresult mozInlineSpellChecker::DoSpellCheck(mozInlineSpellWordUtil& aWordUtil,
|
|||
if (! editor)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
int32_t wordsSinceTimeCheck = 0;
|
||||
int32_t wordsChecked = 0;
|
||||
PRTime beginTime = PR_Now();
|
||||
|
||||
nsAutoString wordText;
|
||||
|
@ -1515,7 +1515,6 @@ nsresult mozInlineSpellChecker::DoSpellCheck(mozInlineSpellWordUtil& aWordUtil,
|
|||
getter_AddRefs(wordRange),
|
||||
&dontCheckWord)) &&
|
||||
wordRange) {
|
||||
wordsSinceTimeCheck++;
|
||||
|
||||
// get the range for the current word.
|
||||
nsINode *beginNode;
|
||||
|
@ -1528,6 +1527,25 @@ nsresult mozInlineSpellChecker::DoSpellCheck(mozInlineSpellWordUtil& aWordUtil,
|
|||
beginOffset = wordRange->GetStartOffset(erv);
|
||||
endOffset = wordRange->GetEndOffset(erv);
|
||||
|
||||
// see if we've done enough words in this round and run out of time.
|
||||
if (wordsChecked >= INLINESPELL_MINIMUM_WORDS_BEFORE_TIMEOUT &&
|
||||
PR_Now() > PRTime(beginTime + kMaxSpellCheckTimeInUsec)) {
|
||||
// stop checking, our time limit has been exceeded.
|
||||
#ifdef DEBUG_INLINESPELL
|
||||
printf("We have run out of the time, schedule next round.");
|
||||
#endif
|
||||
// move the range to encompass the stuff that needs checking.
|
||||
nsresult rv = aStatus->mRange->SetStart(beginNode, beginOffset);
|
||||
if (NS_FAILED(rv)) {
|
||||
// The range might be unhappy because the beginning is after the
|
||||
// end. This is possible when the requested end was in the middle
|
||||
// of a word, just ignore this situation and assume we're done.
|
||||
return NS_OK;
|
||||
}
|
||||
*aDoneChecking = false;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
#ifdef DEBUG_INLINESPELL
|
||||
printf("->Got word \"%s\"", NS_ConvertUTF16toUTF8(wordText).get());
|
||||
if (dontCheckWord)
|
||||
|
@ -1579,33 +1597,16 @@ nsresult mozInlineSpellChecker::DoSpellCheck(mozInlineSpellWordUtil& aWordUtil,
|
|||
if (NS_FAILED(rv))
|
||||
continue;
|
||||
|
||||
wordsChecked++;
|
||||
|
||||
if (isMisspelled) {
|
||||
// misspelled words count extra toward the max
|
||||
wordsSinceTimeCheck += MISSPELLED_WORD_COUNT_PENALTY;
|
||||
AddRange(aSpellCheckSelection, wordRange);
|
||||
|
||||
aStatus->mWordCount ++;
|
||||
if (aStatus->mWordCount >= mMaxMisspellingsPerCheck ||
|
||||
SpellCheckSelectionIsFull())
|
||||
SpellCheckSelectionIsFull()) {
|
||||
break;
|
||||
}
|
||||
|
||||
// see if we've run out of time, only check every N words for perf
|
||||
if (wordsSinceTimeCheck >= INLINESPELL_TIMEOUT_CHECK_FREQUENCY) {
|
||||
wordsSinceTimeCheck = 0;
|
||||
if (PR_Now() > PRTime(beginTime + INLINESPELL_CHECK_TIMEOUT * PR_USEC_PER_MSEC)) {
|
||||
// stop checking, our time limit has been exceeded
|
||||
|
||||
// move the range to encompass the stuff that needs checking
|
||||
rv = aStatus->mRange->SetStart(endNode, endOffset);
|
||||
if (NS_FAILED(rv)) {
|
||||
// The range might be unhappy because the beginning is after the
|
||||
// end. This is possible when the requested end was in the middle
|
||||
// of a word, just ignore this situation and assume we're done.
|
||||
return NS_OK;
|
||||
}
|
||||
*aDoneChecking = false;
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1637,7 +1638,7 @@ private:
|
|||
// the last resume left off.
|
||||
|
||||
nsresult
|
||||
mozInlineSpellChecker::ResumeCheck(mozInlineSpellStatus* aStatus)
|
||||
mozInlineSpellChecker::ResumeCheck(UniquePtr<mozInlineSpellStatus>&& aStatus)
|
||||
{
|
||||
// Observers should be notified that spell check has ended only after spell
|
||||
// check is done below, but since there are many early returns in this method
|
||||
|
@ -1696,13 +1697,13 @@ mozInlineSpellChecker::ResumeCheck(mozInlineSpellStatus* aStatus)
|
|||
|
||||
bool doneChecking = true;
|
||||
if (aStatus->mOp == mozInlineSpellStatus::eOpSelection)
|
||||
rv = DoSpellCheckSelection(wordUtil, spellCheckSelection, aStatus);
|
||||
rv = DoSpellCheckSelection(wordUtil, spellCheckSelection);
|
||||
else
|
||||
rv = DoSpellCheck(wordUtil, spellCheckSelection, aStatus, &doneChecking);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (! doneChecking)
|
||||
rv = ScheduleSpellCheck(*aStatus);
|
||||
rv = ScheduleSpellCheck(Move(aStatus));
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
@ -1897,14 +1898,15 @@ mozInlineSpellChecker::HandleNavigationEvent(bool aForceWordSpellCheck,
|
|||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
bool shouldPost;
|
||||
mozInlineSpellStatus status(this);
|
||||
rv = status.InitForNavigation(aForceWordSpellCheck, aNewPositionOffset,
|
||||
currentAnchorNode, currentAnchorOffset,
|
||||
mCurrentSelectionAnchorNode, mCurrentSelectionOffset,
|
||||
&shouldPost);
|
||||
auto status = MakeUnique<mozInlineSpellStatus>(this);
|
||||
rv = status->InitForNavigation(aForceWordSpellCheck, aNewPositionOffset,
|
||||
currentAnchorNode, currentAnchorOffset,
|
||||
mCurrentSelectionAnchorNode,
|
||||
mCurrentSelectionOffset,
|
||||
&shouldPost);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
if (shouldPost) {
|
||||
rv = ScheduleSpellCheck(status);
|
||||
rv = ScheduleSpellCheck(Move(status));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
||||
|
|
|
@ -218,14 +218,13 @@ public:
|
|||
|
||||
// spell check the text contained within aRange, potentially scheduling
|
||||
// another check in the future if the time threshold is reached
|
||||
nsresult ScheduleSpellCheck(const mozInlineSpellStatus& aStatus);
|
||||
nsresult ScheduleSpellCheck(mozilla::UniquePtr<mozInlineSpellStatus>&& aStatus);
|
||||
|
||||
nsresult DoSpellCheckSelection(mozInlineSpellWordUtil& aWordUtil,
|
||||
mozilla::dom::Selection* aSpellCheckSelection,
|
||||
mozInlineSpellStatus* aStatus);
|
||||
mozilla::dom::Selection* aSpellCheckSelection);
|
||||
nsresult DoSpellCheck(mozInlineSpellWordUtil& aWordUtil,
|
||||
mozilla::dom::Selection *aSpellCheckSelection,
|
||||
mozInlineSpellStatus* aStatus,
|
||||
const mozilla::UniquePtr<mozInlineSpellStatus>& aStatus,
|
||||
bool* aDoneChecking);
|
||||
|
||||
// helper routine to determine if a point is inside of the passed in selection.
|
||||
|
@ -253,7 +252,7 @@ public:
|
|||
nsresult GetSpellCheckSelection(nsISelection ** aSpellCheckSelection);
|
||||
nsresult SaveCurrentSelectionPosition();
|
||||
|
||||
nsresult ResumeCheck(mozInlineSpellStatus* aStatus);
|
||||
nsresult ResumeCheck(mozilla::UniquePtr<mozInlineSpellStatus>&& aStatus);
|
||||
|
||||
protected:
|
||||
virtual ~mozInlineSpellChecker();
|
||||
|
|
|
@ -389,7 +389,10 @@ LoadInfoToLoadInfoArgs(nsILoadInfo *aLoadInfo,
|
|||
aLoadInfo->GetForcePreflight(),
|
||||
aLoadInfo->GetIsPreflight(),
|
||||
aLoadInfo->GetForceHSTSPriming(),
|
||||
aLoadInfo->GetMixedContentWouldBlock());
|
||||
aLoadInfo->GetMixedContentWouldBlock(),
|
||||
aLoadInfo->GetIsHSTSPriming(),
|
||||
aLoadInfo->GetIsHSTSPrimingUpgrade()
|
||||
);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -474,7 +477,9 @@ LoadInfoArgsToLoadInfo(const OptionalLoadInfoArgs& aOptionalLoadInfoArgs,
|
|||
loadInfoArgs.forcePreflight(),
|
||||
loadInfoArgs.isPreflight(),
|
||||
loadInfoArgs.forceHSTSPriming(),
|
||||
loadInfoArgs.mixedContentWouldBlock()
|
||||
loadInfoArgs.mixedContentWouldBlock(),
|
||||
loadInfoArgs.isHSTSPriming(),
|
||||
loadInfoArgs.isHSTSPrimingUpgrade()
|
||||
);
|
||||
|
||||
loadInfo.forget(outLoadInfo);
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
== table-repaint-a.html table-repaint-a-ref.html
|
||||
== table-repaint-b.html table-repaint-b-ref.html
|
||||
== table-repaint-border-collapse.html table-repaint-border-collapse-ref.html
|
||||
== table-repaint-c.html table-repaint-c-ref.html
|
||||
== table-repaint-d.html table-repaint-d-ref.html
|
||||
== table-repaint-non-border-collapse.html table-repaint-non-border-collapse-ref.html
|
||||
== 540247-1.xul 540247-1-ref.xul
|
||||
== 543681-1.html 543681-1-ref.html
|
||||
== 1243409-1.html 1243409-1-ref.html
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>table-repaint-border-collapse-ref</title>
|
||||
<style>
|
||||
table, td, th {
|
||||
border-collapse: collapse;
|
||||
border: 1px solid black;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<table>
|
||||
<tr>
|
||||
<td style="border: 5px solid black">xxx</td>
|
||||
<td>YYY</td>
|
||||
<td>zzz</td>
|
||||
</tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,31 @@
|
|||
<!DOCTYPE html>
|
||||
<html class="reftest-wait">
|
||||
<head>
|
||||
<title>table-repaint-border-collapse</title>
|
||||
<style>
|
||||
table, td, th {
|
||||
border-collapse: collapse;
|
||||
border: 1px solid black;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<table>
|
||||
<tr>
|
||||
<td>xxx</td>
|
||||
<td>yyy</td>
|
||||
<td>zzz</td>
|
||||
</tr>
|
||||
</table>
|
||||
<script>
|
||||
function foo() {
|
||||
let x=document.getElementsByTagName('td')[0];
|
||||
x.style.border = "5px solid black";
|
||||
let y=document.getElementsByTagName('td')[1];
|
||||
y.innerHTML = "YYY";
|
||||
document.documentElement.removeAttribute("class");
|
||||
}
|
||||
document.addEventListener("MozReftestInvalidate", foo);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,20 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>table-repaint-non-border-collapse-ref</title>
|
||||
<style>
|
||||
table, td, th {
|
||||
border: 1px solid black;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<table>
|
||||
<tr>
|
||||
<td style="border: 5px solid black">xxx</td>
|
||||
<td>YYY</td>
|
||||
<td>zzz</td>
|
||||
</tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,30 @@
|
|||
<!DOCTYPE html>
|
||||
<html class="reftest-wait">
|
||||
<head>
|
||||
<title>table-repaint-non-border-collapse</title>
|
||||
<style>
|
||||
table, td, th {
|
||||
border: 1px solid black;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<table>
|
||||
<tr>
|
||||
<td>xxx</td>
|
||||
<td>yyy</td>
|
||||
<td>zzz</td>
|
||||
</tr>
|
||||
</table>
|
||||
<script>
|
||||
function foo() {
|
||||
let x=document.getElementsByTagName('td')[0];
|
||||
x.style.border = "5px solid black";
|
||||
let y=document.getElementsByTagName('td')[1];
|
||||
y.innerHTML = "YYY";
|
||||
document.documentElement.removeAttribute("class");
|
||||
}
|
||||
document.addEventListener("MozReftestInvalidate", foo);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -38,7 +38,7 @@ fuzzy-if(skiaContent,1,550) == anim-css-fill-1-from-to-hex-curcol.svg anim-css
|
|||
fuzzy-if(skiaContent,1,550) == anim-css-fill-1-to-ident-curcol.svg anim-css-fill-1-ref.svg
|
||||
|
||||
# 'fill' property, paced calcMode
|
||||
fails-if(styloVsGecko||stylo) == anim-css-fill-2-paced-rgb.svg anim-css-fill-2-ref.svg
|
||||
== anim-css-fill-2-paced-rgb.svg anim-css-fill-2-ref.svg
|
||||
|
||||
# 'fill' property, animating *by* a named color
|
||||
fuzzy-if(skiaContent,1,580) fails-if(styloVsGecko||stylo) == anim-css-fill-3-by-ident-ident.svg anim-css-fill-3-ref.svg
|
||||
|
@ -89,9 +89,9 @@ fails-if(styloVsGecko||stylo) == anim-css-font-1.svg anim-css-font-1-ref.svg
|
|||
== anim-css-fontsize-1-from-to-px-pct.svg anim-css-fontsize-1-ref.svg
|
||||
|
||||
# 'font-size' property, with negative addition
|
||||
fails-if(styloVsGecko||stylo) == anim-css-fontsize-2-from-by-px-px.svg anim-css-fontsize-2-ref.svg
|
||||
fails-if(styloVsGecko||stylo) == anim-css-fontsize-2-from-by-px-em.svg anim-css-fontsize-2-ref.svg
|
||||
fails-if(styloVsGecko||stylo) == anim-css-fontsize-2-from-by-em-em.svg anim-css-fontsize-2-ref.svg
|
||||
== anim-css-fontsize-2-from-by-px-px.svg anim-css-fontsize-2-ref.svg
|
||||
== anim-css-fontsize-2-from-by-px-em.svg anim-css-fontsize-2-ref.svg
|
||||
== anim-css-fontsize-2-from-by-em-em.svg anim-css-fontsize-2-ref.svg
|
||||
|
||||
# 'stroke-dasharray' property, from/to with pixel values only
|
||||
skip-if(!styloVsGecko) == anim-css-strokedasharray-1.svg anim-css-strokedasharray-1-ref.svg
|
||||
|
@ -147,9 +147,9 @@ fuzzy-if(skiaContent,1,360) == anim-css-strokewidth-2-values-px-px.svg anim-c
|
|||
== anim-css-strokewidth-3-paced.svg anim-css-strokewidth-3-ref.svg
|
||||
|
||||
# 'stroke-width' property, negative addition
|
||||
fails-if(styloVsGecko||stylo) == anim-css-strokewidth-4-from-by-px-px.svg anim-css-strokewidth-4-ref.svg
|
||||
fails-if(styloVsGecko||stylo) == anim-css-strokewidth-4-from-by-px-em.svg anim-css-strokewidth-4-ref.svg
|
||||
fails-if(styloVsGecko||stylo) == anim-css-strokewidth-4-from-by-em-em.svg anim-css-strokewidth-4-ref.svg
|
||||
== anim-css-strokewidth-4-from-by-px-px.svg anim-css-strokewidth-4-ref.svg
|
||||
== anim-css-strokewidth-4-from-by-px-em.svg anim-css-strokewidth-4-ref.svg
|
||||
== anim-css-strokewidth-4-from-by-em-em.svg anim-css-strokewidth-4-ref.svg
|
||||
fuzzy-if(skiaContent,1,170) == anim-css-strokewidth-4-from-by-no-no.svg anim-css-strokewidth-4-ref.svg
|
||||
|
||||
# check correct handling of "!important" values
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
<!DOCTYPE html>
|
||||
<html class="reftest-wait">
|
||||
<title>Discard cancelled animation styles</title>
|
||||
<style>
|
||||
#test {
|
||||
width: 100px; height: 100px;
|
||||
background-color: white;
|
||||
}
|
||||
.changed {
|
||||
color: red;
|
||||
}
|
||||
|
||||
</style>
|
||||
<div id="test"></div>
|
||||
<script>
|
||||
var target = document.getElementById("test");
|
||||
var anim = target.animate({ backgroundColor: [ "red", "red" ] }, 100000);
|
||||
|
||||
anim.ready.then(() => {
|
||||
anim.cancel();
|
||||
// Add a class name to cause selector matching in a subsequent restyle.
|
||||
target.classList.add("changed");
|
||||
|
||||
requestAnimationFrame(() => {
|
||||
document.documentElement.classList.remove("reftest-wait");
|
||||
});
|
||||
});
|
||||
</script>
|
|
@ -21,3 +21,4 @@ test-pref(dom.animations-api.core.enabled,true) == stacking-context-transform-lo
|
|||
test-pref(dom.animations-api.core.enabled,true) == style-updates-on-iteration-composition-changed-from-accumulate-to-replace.html style-updates-for-iteration-composite-ref.html
|
||||
test-pref(dom.animations-api.core.enabled,true) == style-updates-on-iteration-composition-changed-from-replace-to-accumulate.html style-updates-for-iteration-composite-ref.html
|
||||
test-pref(dom.animations-api.core.enabled,true) == style-updates-on-current-iteration-changed.html style-updates-for-iteration-composite-ref.html
|
||||
test-pref(dom.animations-api.core.enabled,true) == cancel-animation-with-selector-matching.html about:blank
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
#define mozilla_ServoSpecifiedValues_h
|
||||
|
||||
#include "mozilla/GenericSpecifiedValues.h"
|
||||
#include "mozilla/ServoBindings.h"
|
||||
#include "mozilla/ServoBindingTypes.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
|
||||
#include "gfxPlatformFontList.h"
|
||||
#include "mozilla/DocumentStyleRootIterator.h"
|
||||
#include "mozilla/ServoBindings.h"
|
||||
#include "mozilla/ServoRestyleManager.h"
|
||||
#include "mozilla/dom/AnonymousContent.h"
|
||||
#include "mozilla/dom/ChildIterator.h"
|
||||
|
|
|
@ -1039,7 +1039,8 @@ nsStyleContext::CalcStyleDifferenceInternal(StyleContextLike* aNewContext,
|
|||
// any change hints for those structs.
|
||||
bool checkUnrequestedServoStructs = mSource.IsServoComputedValues();
|
||||
|
||||
#define DO_STRUCT_DIFFERENCE(struct_) \
|
||||
#define EXPAND(...) __VA_ARGS__
|
||||
#define DO_STRUCT_DIFFERENCE_WITH_ARGS(struct_, extra_args_) \
|
||||
PR_BEGIN_MACRO \
|
||||
const nsStyle##struct_* this##struct_ = PeekStyle##struct_(); \
|
||||
bool unrequestedStruct; \
|
||||
|
@ -1061,7 +1062,7 @@ nsStyleContext::CalcStyleDifferenceInternal(StyleContextLike* aNewContext,
|
|||
*aEqualStructs |= NS_STYLE_INHERIT_BIT(struct_); \
|
||||
} else { \
|
||||
nsChangeHint difference = \
|
||||
this##struct_->CalcDifference(*other##struct_ EXTRA_DIFF_ARGS); \
|
||||
this##struct_->CalcDifference(*other##struct_ EXPAND extra_args_); \
|
||||
if (!unrequestedStruct) { \
|
||||
hint |= difference; \
|
||||
} \
|
||||
|
@ -1074,11 +1075,12 @@ nsStyleContext::CalcStyleDifferenceInternal(StyleContextLike* aNewContext,
|
|||
} \
|
||||
styleStructCount++; \
|
||||
PR_END_MACRO
|
||||
#define DO_STRUCT_DIFFERENCE(struct_) \
|
||||
DO_STRUCT_DIFFERENCE_WITH_ARGS(struct_, ())
|
||||
|
||||
// FIXME: The order of these DO_STRUCT_DIFFERENCE calls is no longer
|
||||
// significant. With a small amount of effort, we could replace them with a
|
||||
// #include "nsStyleStructList.h".
|
||||
#define EXTRA_DIFF_ARGS /* nothing */
|
||||
DO_STRUCT_DIFFERENCE(Display);
|
||||
DO_STRUCT_DIFFERENCE(XUL);
|
||||
DO_STRUCT_DIFFERENCE(Column);
|
||||
|
@ -1090,14 +1092,10 @@ nsStyleContext::CalcStyleDifferenceInternal(StyleContextLike* aNewContext,
|
|||
DO_STRUCT_DIFFERENCE(Table);
|
||||
DO_STRUCT_DIFFERENCE(UIReset);
|
||||
DO_STRUCT_DIFFERENCE(Text);
|
||||
DO_STRUCT_DIFFERENCE(List);
|
||||
DO_STRUCT_DIFFERENCE_WITH_ARGS(List, (, PeekStyleDisplay()));
|
||||
DO_STRUCT_DIFFERENCE(SVGReset);
|
||||
DO_STRUCT_DIFFERENCE(SVG);
|
||||
#undef EXTRA_DIFF_ARGS
|
||||
#define EXTRA_DIFF_ARGS , PeekStyleVisibility()
|
||||
DO_STRUCT_DIFFERENCE(Position);
|
||||
#undef EXTRA_DIFF_ARGS
|
||||
#define EXTRA_DIFF_ARGS /* nothing */
|
||||
DO_STRUCT_DIFFERENCE_WITH_ARGS(Position, (, PeekStyleVisibility()));
|
||||
DO_STRUCT_DIFFERENCE(Font);
|
||||
DO_STRUCT_DIFFERENCE(Margin);
|
||||
DO_STRUCT_DIFFERENCE(Padding);
|
||||
|
@ -1106,9 +1104,10 @@ nsStyleContext::CalcStyleDifferenceInternal(StyleContextLike* aNewContext,
|
|||
DO_STRUCT_DIFFERENCE(Effects);
|
||||
DO_STRUCT_DIFFERENCE(Background);
|
||||
DO_STRUCT_DIFFERENCE(Color);
|
||||
#undef EXTRA_DIFF_ARGS
|
||||
|
||||
#undef DO_STRUCT_DIFFERENCE
|
||||
#undef DO_STRUCT_DIFFERENCE_WITH_ARGS
|
||||
#undef EXPAND
|
||||
|
||||
MOZ_ASSERT(styleStructCount == nsStyleStructID_Length,
|
||||
"missing a call to DO_STRUCT_DIFFERENCE");
|
||||
|
|
|
@ -690,7 +690,8 @@ nsStyleList::GetQuotePairs() const
|
|||
}
|
||||
|
||||
nsChangeHint
|
||||
nsStyleList::CalcDifference(const nsStyleList& aNewData) const
|
||||
nsStyleList::CalcDifference(const nsStyleList& aNewData,
|
||||
const nsStyleDisplay* aOldDisplay) const
|
||||
{
|
||||
// If the quotes implementation is ever going to change we might not need
|
||||
// a framechange here and a reflow should be sufficient. See bug 35768.
|
||||
|
@ -699,20 +700,37 @@ nsStyleList::CalcDifference(const nsStyleList& aNewData) const
|
|||
GetQuotePairs() != aNewData.GetQuotePairs()) {
|
||||
return nsChangeHint_ReconstructFrame;
|
||||
}
|
||||
if (mListStylePosition != aNewData.mListStylePosition) {
|
||||
return nsChangeHint_ReconstructFrame;
|
||||
}
|
||||
if (DefinitelyEqualImages(mListStyleImage, aNewData.mListStyleImage) &&
|
||||
mCounterStyle == aNewData.mCounterStyle) {
|
||||
if (mImageRegion.IsEqualInterior(aNewData.mImageRegion)) {
|
||||
return nsChangeHint(0);
|
||||
nsChangeHint hint = nsChangeHint(0);
|
||||
// Only elements whose display value is list-item can be affected by
|
||||
// list-style-position and list-style-type. If the old display struct
|
||||
// doesn't exist, assume it isn't affected by display value at all,
|
||||
// and thus these properties should not affect it either. This also
|
||||
// relies on that when the display value changes from something else
|
||||
// to list-item, that change itself would cause ReconstructFrame.
|
||||
if (aOldDisplay && aOldDisplay->mDisplay == StyleDisplay::ListItem) {
|
||||
if (mListStylePosition != aNewData.mListStylePosition) {
|
||||
return nsChangeHint_ReconstructFrame;
|
||||
}
|
||||
if (mImageRegion.width == aNewData.mImageRegion.width &&
|
||||
mImageRegion.height == aNewData.mImageRegion.height) {
|
||||
return NS_STYLE_HINT_VISUAL;
|
||||
if (mCounterStyle != aNewData.mCounterStyle) {
|
||||
return NS_STYLE_HINT_REFLOW;
|
||||
}
|
||||
} else if (mListStylePosition != aNewData.mListStylePosition ||
|
||||
mCounterStyle != aNewData.mCounterStyle) {
|
||||
hint = nsChangeHint_NeutralChange;
|
||||
}
|
||||
return NS_STYLE_HINT_REFLOW;
|
||||
// list-style-image and -moz-image-region may affect some XUL elements
|
||||
// regardless of display value, so we still need to check them.
|
||||
if (!DefinitelyEqualImages(mListStyleImage, aNewData.mListStyleImage)) {
|
||||
return NS_STYLE_HINT_REFLOW;
|
||||
}
|
||||
if (!mImageRegion.IsEqualInterior(aNewData.mImageRegion)) {
|
||||
if (mImageRegion.width != aNewData.mImageRegion.width ||
|
||||
mImageRegion.height != aNewData.mImageRegion.height) {
|
||||
return NS_STYLE_HINT_REFLOW;
|
||||
}
|
||||
return NS_STYLE_HINT_VISUAL;
|
||||
}
|
||||
return hint;
|
||||
}
|
||||
|
||||
already_AddRefed<nsIURI>
|
||||
|
|
|
@ -1454,7 +1454,8 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleList
|
|||
FreeByObjectID(mozilla::eArenaObjectID_nsStyleList, this);
|
||||
}
|
||||
|
||||
nsChangeHint CalcDifference(const nsStyleList& aNewData) const;
|
||||
nsChangeHint CalcDifference(const nsStyleList& aNewData,
|
||||
const nsStyleDisplay* aOldDisplay) const;
|
||||
|
||||
static void Shutdown() {
|
||||
sInitialQuotes = nullptr;
|
||||
|
|
|
@ -62,11 +62,10 @@ to mochitest command.
|
|||
* test_property_syntax_errors.html `grid`: actually there are issues with this [8]
|
||||
* test_value_storage.html `'grid` [195]
|
||||
* Unimplemented CSS properties:
|
||||
* font-variant shorthand bug 1356134
|
||||
* test_value_storage.html `'font-variant'` [65]
|
||||
* font-variant-alternates property bug 1355721
|
||||
* test_property_syntax_errors.html `font-variant-alternates` [2]
|
||||
* test_value_storage.html `font-variant-alternates` [22]
|
||||
* test_value_storage.html `'font-variant'` [14]
|
||||
* ... `font-variant-alternates` [22]
|
||||
* test_specified_value_serialization.html `bug-721136` [1]
|
||||
* Unsupported prefixed values
|
||||
* moz-prefixed gradient functions bug 1337655
|
||||
|
|
|
@ -960,9 +960,10 @@ nsTableCellFrame::Reflow(nsPresContext* aPresContext,
|
|||
FinishReflowChild(firstKid, aPresContext, kidSize, &kidReflowInput,
|
||||
wm, kidOrigin, containerSize, 0);
|
||||
|
||||
nsTableFrame::InvalidateTableFrame(firstKid, origRect, origVisualOverflow,
|
||||
firstReflow);
|
||||
|
||||
if (tableFrame->IsBorderCollapse()) {
|
||||
nsTableFrame::InvalidateTableFrame(firstKid, origRect, origVisualOverflow,
|
||||
firstReflow);
|
||||
}
|
||||
// first, compute the bsize which can be set w/o being restricted by
|
||||
// available bsize
|
||||
LogicalSize cellSize(wm);
|
||||
|
|
|
@ -394,9 +394,13 @@ nsTableRowFrame::DidResize()
|
|||
|
||||
cellSize.BSize(wm) = cellBSize;
|
||||
cellFrame->SetSize(wm, cellSize);
|
||||
nsTableFrame::InvalidateTableFrame(cellFrame, cellOldRect,
|
||||
cellVisualOverflow,
|
||||
false);
|
||||
|
||||
nsTableFrame* tableFrame = GetTableFrame();
|
||||
if (tableFrame->IsBorderCollapse()) {
|
||||
nsTableFrame::InvalidateTableFrame(cellFrame, cellOldRect,
|
||||
cellVisualOverflow,
|
||||
false);
|
||||
}
|
||||
}
|
||||
|
||||
// realign cell content based on the new bsize. We might be able to
|
||||
|
@ -957,8 +961,11 @@ nsTableRowFrame::ReflowChildren(nsPresContext* aPresContext,
|
|||
FinishReflowChild(kidFrame, aPresContext, desiredSize, nullptr,
|
||||
wm, kidPosition, containerSize, 0);
|
||||
|
||||
nsTableFrame::InvalidateTableFrame(kidFrame, kidRect, kidVisualOverflow,
|
||||
firstReflow);
|
||||
nsTableFrame* tableFrame = GetTableFrame();
|
||||
if (tableFrame->IsBorderCollapse()) {
|
||||
nsTableFrame::InvalidateTableFrame(kidFrame, kidRect, kidVisualOverflow,
|
||||
firstReflow);
|
||||
}
|
||||
|
||||
iCoord += desiredSize.ISize(wm);
|
||||
} else {
|
||||
|
|
|
@ -293,8 +293,11 @@ nsTableRowGroupFrame::PlaceChild(nsPresContext* aPresContext,
|
|||
FinishReflowChild(aKidFrame, aPresContext, aDesiredSize, nullptr,
|
||||
aWM, aKidPosition, aContainerSize, 0);
|
||||
|
||||
nsTableFrame::InvalidateTableFrame(aKidFrame, aOriginalKidRect,
|
||||
aOriginalKidVisualOverflow, isFirstReflow);
|
||||
nsTableFrame* tableFrame = GetTableFrame();
|
||||
if (tableFrame->IsBorderCollapse()) {
|
||||
nsTableFrame::InvalidateTableFrame(aKidFrame, aOriginalKidRect,
|
||||
aOriginalKidVisualOverflow, isFirstReflow);
|
||||
}
|
||||
|
||||
// Adjust the running block-offset
|
||||
aReflowInput.bCoord += aDesiredSize.BSize(aWM);
|
||||
|
|
|
@ -1036,9 +1036,12 @@ nsTableWrapperFrame::Reflow(nsPresContext* aPresContext,
|
|||
wm, innerOrigin, containerSize, 0);
|
||||
innerRI.reset();
|
||||
|
||||
nsTableFrame::InvalidateTableFrame(InnerTableFrame(), origInnerRect,
|
||||
origInnerVisualOverflow,
|
||||
innerFirstReflow);
|
||||
if (InnerTableFrame()->IsBorderCollapse()) {
|
||||
nsTableFrame::InvalidateTableFrame(InnerTableFrame(), origInnerRect,
|
||||
origInnerVisualOverflow,
|
||||
innerFirstReflow);
|
||||
}
|
||||
|
||||
if (mCaptionFrames.NotEmpty()) {
|
||||
nsTableFrame::InvalidateTableFrame(mCaptionFrames.FirstChild(),
|
||||
origCaptionRect,
|
||||
|
|
|
@ -41,7 +41,7 @@ NS_NewSprocketLayout(nsCOMPtr<nsBoxLayout>& aNewLayout)
|
|||
// we have not instance variables so just return our static one.
|
||||
aNewLayout = nsSprocketLayout::gInstance;
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
|
||||
/*static*/ void
|
||||
nsSprocketLayout::Shutdown()
|
||||
|
@ -53,7 +53,7 @@ nsSprocketLayout::nsSprocketLayout()
|
|||
{
|
||||
}
|
||||
|
||||
bool
|
||||
bool
|
||||
nsSprocketLayout::IsXULHorizontal(nsIFrame* aBox)
|
||||
{
|
||||
return (aBox->GetStateBits() & NS_STATE_IS_HORIZONTAL) != 0;
|
||||
|
@ -72,7 +72,7 @@ GetFrameDirection(nsIFrame* aBox)
|
|||
}
|
||||
|
||||
static void
|
||||
HandleBoxPack(nsIFrame* aBox, const nsFrameState& aFrameState, nscoord& aX, nscoord& aY,
|
||||
HandleBoxPack(nsIFrame* aBox, const nsFrameState& aFrameState, nscoord& aX, nscoord& aY,
|
||||
const nsRect& aOriginalRect, const nsRect& aClientRect)
|
||||
{
|
||||
// In the normal direction we lay out our kids in the positive direction (e.g., |x| will get
|
||||
|
@ -91,7 +91,7 @@ HandleBoxPack(nsIFrame* aBox, const nsFrameState& aFrameState, nscoord& aX, nsco
|
|||
aX = aClientRect.x + aOriginalRect.width;
|
||||
}
|
||||
// |y| is always in the normal direction in horizontal boxes
|
||||
aY = aClientRect.y;
|
||||
aY = aClientRect.y;
|
||||
}
|
||||
else {
|
||||
// take direction property into account for |x| in vertical boxes
|
||||
|
@ -117,10 +117,10 @@ HandleBoxPack(nsIFrame* aBox, const nsFrameState& aFrameState, nscoord& aX, nsco
|
|||
nsIFrame::Halignment halign = aBox->GetXULHAlign();
|
||||
nsIFrame::Valignment valign = aBox->GetXULVAlign();
|
||||
|
||||
// The following code handles box PACKING. Packing comes into play in the case where the computed size for
|
||||
// The following code handles box PACKING. Packing comes into play in the case where the computed size for
|
||||
// all of our children (now stored in our client rect) is smaller than the size available for
|
||||
// the box (stored in |aOriginalRect|).
|
||||
//
|
||||
// the box (stored in |aOriginalRect|).
|
||||
//
|
||||
// Here we adjust our |x| and |y| variables accordingly so that we start at the beginning,
|
||||
// middle, or end of the box.
|
||||
//
|
||||
|
@ -133,7 +133,7 @@ HandleBoxPack(nsIFrame* aBox, const nsFrameState& aFrameState, nscoord& aX, nsco
|
|||
case nsBoxFrame::hAlign_Center:
|
||||
if (aFrameState & NS_STATE_IS_DIRECTION_NORMAL)
|
||||
aX += (aOriginalRect.width - aClientRect.width)/2;
|
||||
else
|
||||
else
|
||||
aX -= (aOriginalRect.width - aClientRect.width)/2;
|
||||
break;
|
||||
|
||||
|
@ -174,9 +174,9 @@ nsSprocketLayout::XULLayout(nsIFrame* aBox, nsBoxLayoutState& aState)
|
|||
// children and give them a rect of 0 width and height.
|
||||
if (aBox->IsXULCollapsed()) {
|
||||
nsIFrame* child = nsBox::GetChildXULBox(aBox);
|
||||
while(child)
|
||||
while(child)
|
||||
{
|
||||
nsBoxFrame::LayoutChildAt(aState, child, nsRect(0,0,0,0));
|
||||
nsBoxFrame::LayoutChildAt(aState, child, nsRect(0,0,0,0));
|
||||
child = nsBox::GetNextXULBox(child);
|
||||
}
|
||||
return NS_OK;
|
||||
|
@ -214,7 +214,7 @@ nsSprocketLayout::XULLayout(nsIFrame* aBox, nsBoxLayoutState& aState)
|
|||
nscoord max = 0;
|
||||
int32_t flexes = 0;
|
||||
PopulateBoxSizes(aBox, aState, boxSizes, min, max, flexes);
|
||||
|
||||
|
||||
// The |size| variable will hold the total size of children along the axis of
|
||||
// the box. Continuing with the example begun in the comment above, size would
|
||||
// be 150 pixels.
|
||||
|
@ -228,7 +228,7 @@ nsSprocketLayout::XULLayout(nsIFrame* aBox, nsBoxLayoutState& aState)
|
|||
// appropriate dimension to match this size. In our example, we now assign
|
||||
// 150 pixels into the clientRect.width.
|
||||
//
|
||||
// The variables |min| and |max| hold the minimum required size box must be
|
||||
// The variables |min| and |max| hold the minimum required size box must be
|
||||
// in the OPPOSITE orientation, e.g., for a horizontal box, |min| is the minimum
|
||||
// height we require to enclose our children, and |max| is the maximum height
|
||||
// required to enclose our children.
|
||||
|
@ -256,7 +256,7 @@ nsSprocketLayout::XULLayout(nsIFrame* aBox, nsBoxLayoutState& aState)
|
|||
bool finished;
|
||||
nscoord passes = 0;
|
||||
|
||||
// We flow children at their preferred locations (along with the appropriate computed flex).
|
||||
// We flow children at their preferred locations (along with the appropriate computed flex).
|
||||
// After we flow a child, it is possible that the child will change its size. If/when this happens,
|
||||
// we have to do another pass. Typically only 2 passes are required, but the code is prepared to
|
||||
// do as many passes as are necessary to achieve equilibrium.
|
||||
|
@ -272,14 +272,14 @@ nsSprocketLayout::XULLayout(nsIFrame* aBox, nsBoxLayoutState& aState)
|
|||
// |passes| stores our number of passes. If for any reason we end up doing more than, say, 10
|
||||
// passes, we assert to indicate that something is seriously screwed up.
|
||||
passes = 0;
|
||||
do
|
||||
{
|
||||
do
|
||||
{
|
||||
#ifdef DEBUG_REFLOW
|
||||
if (passes > 0) {
|
||||
AddIndents();
|
||||
printf("ChildResized doing pass: %d\n", passes);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Always assume that we're done. This will change if, for example, children don't stay
|
||||
// the same size after being flowed.
|
||||
|
@ -293,7 +293,7 @@ nsSprocketLayout::XULLayout(nsIFrame* aBox, nsBoxLayoutState& aState)
|
|||
origX = x;
|
||||
origY = y;
|
||||
|
||||
// Now we iterate over our box children and our box size lists in
|
||||
// Now we iterate over our box children and our box size lists in
|
||||
// parallel. For each child, we look at its sizes and figure out
|
||||
// where to place it.
|
||||
nsComputedBoxSize* childComputedBoxSize = computedBoxSizes;
|
||||
|
@ -303,14 +303,14 @@ nsSprocketLayout::XULLayout(nsIFrame* aBox, nsBoxLayoutState& aState)
|
|||
|
||||
int32_t count = 0;
|
||||
while (child || (childBoxSize && childBoxSize->bogus))
|
||||
{
|
||||
{
|
||||
// If for some reason, our lists are not the same length, we guard
|
||||
// by bailing out of the loop.
|
||||
if (childBoxSize == nullptr) {
|
||||
NS_NOTREACHED("Lists not the same length.");
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
nscoord width = clientRect.width;
|
||||
nscoord height = clientRect.height;
|
||||
|
||||
|
@ -324,20 +324,20 @@ nsSprocketLayout::XULLayout(nsIFrame* aBox, nsBoxLayoutState& aState)
|
|||
nsSize minSize = child->GetXULMinSize(aState);
|
||||
nsSize maxSize = child->GetXULMaxSize(aState);
|
||||
prefSize = nsBox::BoundsCheck(minSize, prefSize, maxSize);
|
||||
|
||||
|
||||
AddMargin(child, prefSize);
|
||||
width = std::min(prefSize.width, originalClientRect.width);
|
||||
height = std::min(prefSize.height, originalClientRect.height);
|
||||
}
|
||||
}
|
||||
|
||||
// Obtain the computed size along the axis of the box for this child from the computedBoxSize entry.
|
||||
// Obtain the computed size along the axis of the box for this child from the computedBoxSize entry.
|
||||
// We store the result in |width| for horizontal boxes and |height| for vertical boxes.
|
||||
if (frameState & NS_STATE_IS_HORIZONTAL)
|
||||
width = childComputedBoxSize->size;
|
||||
else
|
||||
height = childComputedBoxSize->size;
|
||||
|
||||
|
||||
// Adjust our x/y for the left/right spacing.
|
||||
if (frameState & NS_STATE_IS_HORIZONTAL) {
|
||||
if (frameState & NS_STATE_IS_DIRECTION_NORMAL)
|
||||
|
@ -374,7 +374,7 @@ nsSprocketLayout::XULLayout(nsIFrame* aBox, nsBoxLayoutState& aState)
|
|||
|
||||
if (childRect.height > clientRect.height)
|
||||
clientRect.height = childRect.height;
|
||||
|
||||
|
||||
// Either |nextX| or |nextY| is updated by this function call, according
|
||||
// to our axis.
|
||||
nscoord nextX = x;
|
||||
|
@ -395,7 +395,7 @@ nsSprocketLayout::XULLayout(nsIFrame* aBox, nsBoxLayoutState& aState)
|
|||
else {
|
||||
if (frameState & NS_STATE_IS_DIRECTION_NORMAL)
|
||||
nextY += (childBoxSize->right);
|
||||
else
|
||||
else
|
||||
nextY -= (childBoxSize->left);
|
||||
if (GetFrameDirection(aBox) == NS_STYLE_DIRECTION_LTR) {
|
||||
childRect.x = originalClientRect.x;
|
||||
|
@ -404,10 +404,10 @@ nsSprocketLayout::XULLayout(nsIFrame* aBox, nsBoxLayoutState& aState)
|
|||
childRect.x = clientRect.x + originalClientRect.width - childRect.width;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// If we encounter a completely bogus box size, we just leave this child completely
|
||||
// alone and continue through the loop to the next child.
|
||||
if (childBoxSize->bogus)
|
||||
if (childBoxSize->bogus)
|
||||
{
|
||||
childComputedBoxSize = childComputedBoxSize->next;
|
||||
childBoxSize = childBoxSize->next;
|
||||
|
@ -472,7 +472,7 @@ nsSprocketLayout::XULLayout(nsIFrame* aBox, nsBoxLayoutState& aState)
|
|||
|
||||
if (childRect.height > maxSize.height)
|
||||
childRect.height = maxSize.height;
|
||||
|
||||
|
||||
// set it again
|
||||
child->SetXULBounds(aState, childRect);
|
||||
}
|
||||
|
@ -482,8 +482,8 @@ nsSprocketLayout::XULLayout(nsIFrame* aBox, nsBoxLayoutState& aState)
|
|||
// around as a result of the size change.
|
||||
if (layout || sizeChanged)
|
||||
child->XULLayout(aState);
|
||||
|
||||
// If the child was a block or inline (e.g., HTML) it may have changed its rect *during* layout.
|
||||
|
||||
// If the child was a block or inline (e.g., HTML) it may have changed its rect *during* layout.
|
||||
// We have to check for this.
|
||||
nsRect newChildRect(child->GetRect());
|
||||
|
||||
|
@ -498,12 +498,12 @@ nsSprocketLayout::XULLayout(nsIFrame* aBox, nsBoxLayoutState& aState)
|
|||
// The child changed size during layout. The ChildResized method handles this
|
||||
// scenario.
|
||||
ChildResized(aBox,
|
||||
aState,
|
||||
aState,
|
||||
child,
|
||||
childBoxSize,
|
||||
childComputedBoxSize,
|
||||
boxSizes,
|
||||
computedBoxSizes,
|
||||
boxSizes,
|
||||
computedBoxSizes,
|
||||
childRect,
|
||||
newChildRect,
|
||||
clientRect,
|
||||
|
@ -544,12 +544,12 @@ nsSprocketLayout::XULLayout(nsIFrame* aBox, nsBoxLayoutState& aState)
|
|||
// If the child resized then recompute its position.
|
||||
ComputeChildsNextPosition(aBox, x, y, nextX, nextY, newChildRect);
|
||||
|
||||
if (newChildRect.width >= margin.left + margin.right && newChildRect.height >= margin.top + margin.bottom)
|
||||
if (newChildRect.width >= margin.left + margin.right && newChildRect.height >= margin.top + margin.bottom)
|
||||
newChildRect.Deflate(margin);
|
||||
|
||||
if (childRect.width >= margin.left + margin.right && childRect.height >= margin.top + margin.bottom)
|
||||
if (childRect.width >= margin.left + margin.right && childRect.height >= margin.top + margin.bottom)
|
||||
childRect.Deflate(margin);
|
||||
|
||||
|
||||
child->SetXULBounds(aState, newChildRect);
|
||||
|
||||
// If we are the first box that changed size, then we don't need to do a second pass
|
||||
|
@ -560,7 +560,7 @@ nsSprocketLayout::XULLayout(nsIFrame* aBox, nsBoxLayoutState& aState)
|
|||
// Now update our x/y finally.
|
||||
x = nextX;
|
||||
y = nextY;
|
||||
|
||||
|
||||
// Move to the next child.
|
||||
childComputedBoxSize = childComputedBoxSize->next;
|
||||
childBoxSize = childBoxSize->next;
|
||||
|
@ -623,7 +623,7 @@ nsSprocketLayout::XULLayout(nsIFrame* aBox, nsBoxLayoutState& aState)
|
|||
nsIFrame* child = nsBox::GetChildXULBox(aBox);
|
||||
|
||||
// reposition all our children
|
||||
while (child)
|
||||
while (child)
|
||||
{
|
||||
nsRect childRect(child->GetRect());
|
||||
childRect.x += (x - origX);
|
||||
|
@ -637,8 +637,8 @@ nsSprocketLayout::XULLayout(nsIFrame* aBox, nsBoxLayoutState& aState)
|
|||
if (!(frameState & NS_STATE_AUTO_STRETCH)) {
|
||||
AlignChildren(aBox, aState);
|
||||
}
|
||||
|
||||
// That's it! If you made it this far without having a nervous breakdown,
|
||||
|
||||
// That's it! If you made it this far without having a nervous breakdown,
|
||||
// congratulations! Go get yourself a beer.
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -684,13 +684,13 @@ nsSprocketLayout::PopulateBoxSizes(nsIFrame* aBox, nsBoxLayoutState& aState, nsB
|
|||
|
||||
#if 0
|
||||
nsBoxSize* start = aBoxSizes;
|
||||
|
||||
|
||||
while(child)
|
||||
{
|
||||
// ok if we started with a list move down the list
|
||||
// until we reach the end. Then start looking at childen.
|
||||
// This feature is used extensively for Grid.
|
||||
nscoord flex = 0;
|
||||
nscoord flex = 0;
|
||||
|
||||
if (!start) {
|
||||
if (!currentBox) {
|
||||
|
@ -700,7 +700,7 @@ nsSprocketLayout::PopulateBoxSizes(nsIFrame* aBox, nsBoxLayoutState& aState, nsB
|
|||
currentBox->next = new (aState) nsBoxSize();
|
||||
currentBox = currentBox->next;
|
||||
}
|
||||
|
||||
|
||||
|
||||
flex = child->GetXULFlex();
|
||||
|
||||
|
@ -710,10 +710,10 @@ nsSprocketLayout::PopulateBoxSizes(nsIFrame* aBox, nsBoxLayoutState& aState, nsB
|
|||
flex = start->flex;
|
||||
start = start->next;
|
||||
}
|
||||
|
||||
if (flex > 0)
|
||||
|
||||
if (flex > 0)
|
||||
aFlexes++;
|
||||
|
||||
|
||||
child = GetNextXULBox(child);
|
||||
}
|
||||
#endif
|
||||
|
@ -802,13 +802,13 @@ nsSprocketLayout::PopulateBoxSizes(nsIFrame* aBox, nsBoxLayoutState& aState, nsB
|
|||
// we specified all our children are equal size;
|
||||
if (frameState & NS_STATE_EQUAL_SIZE) {
|
||||
|
||||
if (prefWidth > biggestPrefWidth)
|
||||
if (prefWidth > biggestPrefWidth)
|
||||
biggestPrefWidth = prefWidth;
|
||||
|
||||
if (minWidth > biggestMinWidth)
|
||||
if (minWidth > biggestMinWidth)
|
||||
biggestMinWidth = minWidth;
|
||||
|
||||
if (maxWidth < smallestMaxWidth)
|
||||
if (maxWidth < smallestMaxWidth)
|
||||
smallestMaxWidth = maxWidth;
|
||||
} else { // not we can set our children right now.
|
||||
currentBox->pref = prefWidth;
|
||||
|
@ -847,13 +847,13 @@ nsSprocketLayout::PopulateBoxSizes(nsIFrame* aBox, nsBoxLayoutState& aState, nsB
|
|||
|
||||
if (childCount > 0) {
|
||||
nscoord maxAllowedFlex = nscoord_MAX / childCount;
|
||||
|
||||
|
||||
if (MOZ_UNLIKELY(maxFlex > maxAllowedFlex)) {
|
||||
// clamp all the flexes
|
||||
currentBox = aBoxSizes;
|
||||
while (currentBox) {
|
||||
currentBox->flex = std::min(currentBox->flex, maxAllowedFlex);
|
||||
currentBox = currentBox->next;
|
||||
currentBox = currentBox->next;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -888,11 +888,11 @@ nsSprocketLayout::PopulateBoxSizes(nsIFrame* aBox, nsBoxLayoutState& aState, nsB
|
|||
}
|
||||
|
||||
void
|
||||
nsSprocketLayout::ComputeChildsNextPosition(nsIFrame* aBox,
|
||||
const nscoord& aCurX,
|
||||
const nscoord& aCurY,
|
||||
nscoord& aNextX,
|
||||
nscoord& aNextY,
|
||||
nsSprocketLayout::ComputeChildsNextPosition(nsIFrame* aBox,
|
||||
const nscoord& aCurX,
|
||||
const nscoord& aCurY,
|
||||
nscoord& aNextX,
|
||||
nscoord& aNextY,
|
||||
const nsRect& aCurrentChildSize)
|
||||
{
|
||||
// Get the position along the box axis for the child.
|
||||
|
@ -1012,26 +1012,26 @@ nsSprocketLayout::AlignChildren(nsIFrame* aBox,
|
|||
|
||||
void
|
||||
nsSprocketLayout::ChildResized(nsIFrame* aBox,
|
||||
nsBoxLayoutState& aState,
|
||||
nsBoxLayoutState& aState,
|
||||
nsIFrame* aChild,
|
||||
nsBoxSize* aChildBoxSize,
|
||||
nsComputedBoxSize* aChildComputedSize,
|
||||
nsBoxSize* aBoxSizes,
|
||||
nsComputedBoxSize* aComputedBoxSizes,
|
||||
const nsRect& aChildLayoutRect,
|
||||
nsRect& aChildActualRect,
|
||||
nsBoxSize* aBoxSizes,
|
||||
nsComputedBoxSize* aComputedBoxSizes,
|
||||
const nsRect& aChildLayoutRect,
|
||||
nsRect& aChildActualRect,
|
||||
nsRect& aContainingRect,
|
||||
int32_t aFlexes,
|
||||
int32_t aFlexes,
|
||||
bool& aFinished)
|
||||
|
||||
|
||||
{
|
||||
nsRect childCurrentRect(aChildLayoutRect);
|
||||
|
||||
bool isHorizontal = IsXULHorizontal(aBox);
|
||||
nscoord childLayoutWidth = GET_WIDTH(aChildLayoutRect,isHorizontal);
|
||||
nscoord& childActualWidth = GET_WIDTH(aChildActualRect,isHorizontal);
|
||||
nscoord& containingWidth = GET_WIDTH(aContainingRect,isHorizontal);
|
||||
|
||||
nscoord& containingWidth = GET_WIDTH(aContainingRect,isHorizontal);
|
||||
|
||||
//nscoord childLayoutHeight = GET_HEIGHT(aChildLayoutRect,isHorizontal);
|
||||
nscoord& childActualHeight = GET_HEIGHT(aChildActualRect,isHorizontal);
|
||||
nscoord& containingHeight = GET_HEIGHT(aContainingRect,isHorizontal);
|
||||
|
@ -1045,7 +1045,7 @@ nsSprocketLayout::ChildResized(nsIFrame* aBox,
|
|||
// ok if the height changed then we need to reflow everyone but us at the new height
|
||||
// so we will set the changed index to be us. And signal that we need a new pass.
|
||||
|
||||
nsSize min = aChild->GetXULMinSize(aState);
|
||||
nsSize min = aChild->GetXULMinSize(aState);
|
||||
nsSize max = nsBox::BoundsCheckMinMax(min, aChild->GetXULMaxSize(aState));
|
||||
AddMargin(aChild, max);
|
||||
|
||||
|
@ -1075,14 +1075,14 @@ nsSprocketLayout::ChildResized(nsIFrame* aBox,
|
|||
node = node->next;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (childActualWidth > childLayoutWidth) {
|
||||
nsSize min = aChild->GetXULMinSize(aState);
|
||||
nsSize max = nsBox::BoundsCheckMinMax(min, aChild->GetXULMaxSize(aState));
|
||||
|
||||
|
||||
AddMargin(aChild, max);
|
||||
|
||||
// our width now becomes the new size
|
||||
|
@ -1110,7 +1110,7 @@ nsSprocketLayout::ChildResized(nsIFrame* aBox,
|
|||
while(node) {
|
||||
if (node->resized)
|
||||
node->valid = true;
|
||||
|
||||
|
||||
node = node->next;
|
||||
}
|
||||
|
||||
|
@ -1118,7 +1118,7 @@ nsSprocketLayout::ChildResized(nsIFrame* aBox,
|
|||
aFinished = false;
|
||||
} else {
|
||||
containingWidth += aChildComputedSize->size - childLayoutWidth;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1127,12 +1127,12 @@ nsSprocketLayout::ChildResized(nsIFrame* aBox,
|
|||
|
||||
if (!childCurrentRect.IsEqualInterior(aChildActualRect)) {
|
||||
// the childRect includes the margin
|
||||
// make sure we remove it before setting
|
||||
// make sure we remove it before setting
|
||||
// the bounds.
|
||||
nsMargin margin(0,0,0,0);
|
||||
aChild->GetXULMargin(margin);
|
||||
nsRect rect(aChildActualRect);
|
||||
if (rect.width >= margin.left + margin.right && rect.height >= margin.top + margin.bottom)
|
||||
if (rect.width >= margin.left + margin.right && rect.height >= margin.top + margin.bottom)
|
||||
rect.Deflate(margin);
|
||||
|
||||
aChild->SetXULBounds(aState, rect);
|
||||
|
@ -1152,11 +1152,11 @@ nsSprocketLayout::InvalidateComputedSizes(nsComputedBoxSize* aComputedBoxSizes)
|
|||
|
||||
void
|
||||
nsSprocketLayout::ComputeChildSizes(nsIFrame* aBox,
|
||||
nsBoxLayoutState& aState,
|
||||
nscoord& aGivenSize,
|
||||
nsBoxSize* aBoxSizes,
|
||||
nsBoxLayoutState& aState,
|
||||
nscoord& aGivenSize,
|
||||
nsBoxSize* aBoxSizes,
|
||||
nsComputedBoxSize*& aComputedBoxSizes)
|
||||
{
|
||||
{
|
||||
|
||||
//nscoord onePixel = aState.PresContext()->IntScaledPixelsToTwips(1);
|
||||
|
||||
|
@ -1167,28 +1167,28 @@ nsSprocketLayout::ComputeChildSizes(nsIFrame* aBox,
|
|||
|
||||
if (!aComputedBoxSizes)
|
||||
aComputedBoxSizes = new (aState) nsComputedBoxSize();
|
||||
|
||||
|
||||
nsBoxSize* boxSizes = aBoxSizes;
|
||||
nsComputedBoxSize* computedBoxSizes = aComputedBoxSizes;
|
||||
int32_t count = 0;
|
||||
int32_t validCount = 0;
|
||||
|
||||
while (boxSizes)
|
||||
while (boxSizes)
|
||||
{
|
||||
|
||||
NS_ASSERTION((boxSizes->min <= boxSizes->pref && boxSizes->pref <= boxSizes->max),"bad pref, min, max size");
|
||||
|
||||
|
||||
|
||||
// ignore collapsed children
|
||||
// if (boxSizes->collapsed)
|
||||
// if (boxSizes->collapsed)
|
||||
// {
|
||||
// computedBoxSizes->valid = true;
|
||||
// computedBoxSizes->size = boxSizes->pref;
|
||||
// validCount++;
|
||||
// boxSizes->flex = 0;
|
||||
// }// else {
|
||||
|
||||
if (computedBoxSizes->valid) {
|
||||
|
||||
if (computedBoxSizes->valid) {
|
||||
sizeRemaining -= computedBoxSizes->size;
|
||||
validCount++;
|
||||
} else {
|
||||
|
@ -1205,11 +1205,11 @@ nsSprocketLayout::ComputeChildSizes(nsIFrame* aBox,
|
|||
|
||||
sizeRemaining -= (boxSizes->left + boxSizes->right);
|
||||
|
||||
//}
|
||||
//}
|
||||
|
||||
boxSizes = boxSizes->next;
|
||||
|
||||
if (boxSizes && !computedBoxSizes->next)
|
||||
if (boxSizes && !computedBoxSizes->next)
|
||||
computedBoxSizes->next = new (aState) nsComputedBoxSize();
|
||||
|
||||
computedBoxSizes = computedBoxSizes->next;
|
||||
|
@ -1222,18 +1222,18 @@ nsSprocketLayout::ComputeChildSizes(nsIFrame* aBox,
|
|||
// ----- Ok we are give a size to fit into so stretch or squeeze to fit
|
||||
// ----- Make sure we look at our min and max size
|
||||
bool limit = true;
|
||||
for (int pass=1; true == limit; pass++)
|
||||
for (int pass=1; true == limit; pass++)
|
||||
{
|
||||
limit = false;
|
||||
boxSizes = aBoxSizes;
|
||||
computedBoxSizes = aComputedBoxSizes;
|
||||
|
||||
while (boxSizes) {
|
||||
while (boxSizes) {
|
||||
|
||||
// ignore collapsed spacers
|
||||
|
||||
// if (!boxSizes->collapsed) {
|
||||
|
||||
|
||||
nscoord pref = 0;
|
||||
nscoord max = NS_INTRINSICSIZE;
|
||||
nscoord min = 0;
|
||||
|
@ -1269,7 +1269,7 @@ nsSprocketLayout::ComputeChildSizes(nsIFrame* aBox,
|
|||
computedBoxSizes = computedBoxSizes->next;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ---- once we have removed and min and max issues just stretch us out in the remaining space
|
||||
// ---- or shrink us. Depends on the size remaining and the spacer constants
|
||||
|
@ -1277,11 +1277,11 @@ nsSprocketLayout::ComputeChildSizes(nsIFrame* aBox,
|
|||
boxSizes = aBoxSizes;
|
||||
computedBoxSizes = aComputedBoxSizes;
|
||||
|
||||
while (boxSizes) {
|
||||
while (boxSizes) {
|
||||
|
||||
// ignore collapsed spacers
|
||||
// if (!(boxSizes && boxSizes->collapsed)) {
|
||||
|
||||
|
||||
nscoord pref = 0;
|
||||
nscoord flex = 0;
|
||||
pref = boxSizes->pref;
|
||||
|
@ -1306,7 +1306,7 @@ nsSprocketLayout::ComputeChildSizes(nsIFrame* aBox,
|
|||
nsSize
|
||||
nsSprocketLayout::GetXULPrefSize(nsIFrame* aBox, nsBoxLayoutState& aState)
|
||||
{
|
||||
nsSize vpref (0, 0);
|
||||
nsSize vpref (0, 0);
|
||||
bool isHorizontal = IsXULHorizontal(aBox);
|
||||
|
||||
nscoord biggestPref = 0;
|
||||
|
@ -1319,9 +1319,9 @@ nsSprocketLayout::GetXULPrefSize(nsIFrame* aBox, nsBoxLayoutState& aState)
|
|||
GetFrameState(aBox, frameState);
|
||||
bool isEqual = !!(frameState & NS_STATE_EQUAL_SIZE);
|
||||
int32_t count = 0;
|
||||
|
||||
while (child)
|
||||
{
|
||||
|
||||
while (child)
|
||||
{
|
||||
// ignore collapsed children
|
||||
if (!child->IsXULCollapsed())
|
||||
{
|
||||
|
@ -1352,7 +1352,7 @@ nsSprocketLayout::GetXULPrefSize(nsIFrame* aBox, nsBoxLayoutState& aState)
|
|||
else
|
||||
vpref.height = biggestPref*count;
|
||||
}
|
||||
|
||||
|
||||
// now add our border and padding
|
||||
AddBorderAndPadding(aBox, vpref);
|
||||
|
||||
|
@ -1377,14 +1377,14 @@ nsSprocketLayout::GetXULMinSize(nsIFrame* aBox, nsBoxLayoutState& aState)
|
|||
bool isEqual = !!(frameState & NS_STATE_EQUAL_SIZE);
|
||||
int32_t count = 0;
|
||||
|
||||
while (child)
|
||||
{
|
||||
while (child)
|
||||
{
|
||||
// ignore collapsed children
|
||||
if (!child->IsXULCollapsed())
|
||||
{
|
||||
nsSize min = child->GetXULMinSize(aState);
|
||||
nsSize pref(0,0);
|
||||
|
||||
|
||||
// if the child is not flexible then
|
||||
// its min size is its pref size.
|
||||
if (child->GetXULFlex() == 0) {
|
||||
|
@ -1414,7 +1414,7 @@ nsSprocketLayout::GetXULMinSize(nsIFrame* aBox, nsBoxLayoutState& aState)
|
|||
child = nsBox::GetNextXULBox(child);
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (isEqual) {
|
||||
if (isHorizontal)
|
||||
minSize.width = biggestMin*count;
|
||||
|
@ -1446,8 +1446,8 @@ nsSprocketLayout::GetXULMaxSize(nsIFrame* aBox, nsBoxLayoutState& aState)
|
|||
bool isEqual = !!(frameState & NS_STATE_EQUAL_SIZE);
|
||||
int32_t count = 0;
|
||||
|
||||
while (child)
|
||||
{
|
||||
while (child)
|
||||
{
|
||||
// ignore collapsed children
|
||||
if (!child->IsXULCollapsed())
|
||||
{
|
||||
|
@ -1504,11 +1504,11 @@ nsSprocketLayout::GetAscent(nsIFrame* aBox, nsBoxLayoutState& aState)
|
|||
|
||||
// run through all the children and get their min, max, and preferred sizes
|
||||
// return us the size of the box
|
||||
|
||||
|
||||
nsIFrame* child = nsBox::GetChildXULBox(aBox);
|
||||
|
||||
while (child)
|
||||
{
|
||||
|
||||
while (child)
|
||||
{
|
||||
// ignore collapsed children
|
||||
//if (!child->IsXULCollapsed())
|
||||
//{
|
||||
|
@ -1529,7 +1529,7 @@ nsSprocketLayout::GetAscent(nsIFrame* aBox, nsBoxLayoutState& aState)
|
|||
}
|
||||
//}
|
||||
|
||||
child = nsBox::GetNextXULBox(child);
|
||||
child = nsBox::GetNextXULBox(child);
|
||||
}
|
||||
|
||||
nsMargin borderPadding;
|
||||
|
@ -1579,7 +1579,7 @@ nsSprocketLayout::AddLargestSize(nsSize& aSize, const nsSize& aSizeToAdd, bool a
|
|||
void
|
||||
nsSprocketLayout::AddCoord(nscoord& aCoord, nscoord aCoordToAdd)
|
||||
{
|
||||
if (aCoord != NS_INTRINSICSIZE)
|
||||
if (aCoord != NS_INTRINSICSIZE)
|
||||
{
|
||||
if (aCoordToAdd == NS_INTRINSICSIZE)
|
||||
aCoord = aCoordToAdd;
|
||||
|
@ -1594,7 +1594,7 @@ nsSprocketLayout::AddSmallestSize(nsSize& aSize, const nsSize& aSizeToAdd, bool
|
|||
AddCoord(aSize.width, aSizeToAdd.width);
|
||||
else
|
||||
AddCoord(aSize.height, aSizeToAdd.height);
|
||||
|
||||
|
||||
SetSmallestSize(aSize, aSizeToAdd, aIsHorizontal);
|
||||
}
|
||||
|
||||
|
@ -1627,26 +1627,26 @@ nsBoxSize::nsBoxSize()
|
|||
}
|
||||
|
||||
|
||||
void*
|
||||
void*
|
||||
nsBoxSize::operator new(size_t sz, nsBoxLayoutState& aState) CPP_THROW_NEW
|
||||
{
|
||||
return mozilla::AutoStackArena::Allocate(sz);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
void
|
||||
nsBoxSize::operator delete(void* aPtr, size_t sz)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void*
|
||||
void*
|
||||
nsComputedBoxSize::operator new(size_t sz, nsBoxLayoutState& aState) CPP_THROW_NEW
|
||||
{
|
||||
return mozilla::AutoStackArena::Allocate(sz);
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
nsComputedBoxSize::operator delete(void* aPtr, size_t sz)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -524,12 +524,6 @@ static OPUS_INLINE int interp_bits2pulses(const CELTMode *m, int start, int end,
|
|||
return codedBands;
|
||||
}
|
||||
|
||||
#if !defined(__clang__) && defined(__GNUC__) && defined(__arm__) && \
|
||||
__GNUC__ == 4 && __GNUC_MINOR__ == 8
|
||||
#warning "OPUS library causes an internal compiler error for gcc-4.8 based toolchain in arm"
|
||||
#pragma GCC push_options
|
||||
#pragma GCC optimize ("O0")
|
||||
#endif
|
||||
int compute_allocation(const CELTMode *m, int start, int end, const int *offsets, const int *cap, int alloc_trim, int *intensity, int *dual_stereo,
|
||||
opus_int32 total, opus_int32 *balance, int *pulses, int *ebits, int *fine_priority, int C, int LM, ec_ctx *ec, int encode, int prev, int signalBandwidth)
|
||||
{
|
||||
|
@ -642,7 +636,4 @@ int compute_allocation(const CELTMode *m, int start, int end, const int *offsets
|
|||
RESTORE_STACK;
|
||||
return codedBands;
|
||||
}
|
||||
#if !defined(__clang__) && defined(__GNUC__) && defined(__arm__) && \
|
||||
__GNUC__ == 4 && __GNUC_MINOR__ == 8
|
||||
#pragma GCC pop_options
|
||||
#endif
|
||||
|
||||
|
|
|
@ -1,39 +0,0 @@
|
|||
From 609166a46f6a22ae2d0a0ab7c64415c779c65f37 Mon Sep 17 00:00:00 2001
|
||||
From: Juan Gomez <atilag@gmail.com>
|
||||
Date: Wed, 26 Nov 2014 23:57:49 +0100
|
||||
Subject: [PATCH] Bug 1056337 - Upgrade toolchain used for B2G ICS builds *
|
||||
Patch for gcc ICE in OPUS library (arm)
|
||||
|
||||
---
|
||||
media/libopus/celt/rate.c | 11 ++++++++++-
|
||||
1 file changed, 10 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/media/libopus/celt/rate.c b/media/libopus/celt/rate.c
|
||||
index e13d839..1055e63 100644
|
||||
--- a/media/libopus/celt/rate.c
|
||||
+++ b/media/libopus/celt/rate.c
|
||||
@@ -523,6 +523,12 @@ static OPUS_INLINE int interp_bits2pulses(const CELTMode *m, int start, int end,
|
||||
return codedBands;
|
||||
}
|
||||
|
||||
+#if !defined(__clang__) && defined(__GNUC__) && defined(__arm__) && \
|
||||
+ __GNUC__ == 4 && __GNUC_MINOR__ == 8
|
||||
+#warning "OPUS library causes an internal compiler error for gcc-4.8 based toolchain in arm"
|
||||
+#pragma GCC push_options
|
||||
+#pragma GCC optimize ("O0")
|
||||
+#endif
|
||||
int compute_allocation(const CELTMode *m, int start, int end, const int *offsets, const int *cap, int alloc_trim, int *intensity, int *dual_stereo,
|
||||
opus_int32 total, opus_int32 *balance, int *pulses, int *ebits, int *fine_priority, int C, int LM, ec_ctx *ec, int encode, int prev, int signalBandwidth)
|
||||
{
|
||||
@@ -635,4 +641,7 @@ int compute_allocation(const CELTMode *m, int start, int end, const int *offsets
|
||||
RESTORE_STACK;
|
||||
return codedBands;
|
||||
}
|
||||
-
|
||||
+#if !defined(__clang__) && defined(__GNUC__) && defined(__arm__) && \
|
||||
+ __GNUC__ == 4 && __GNUC_MINOR__ == 8
|
||||
+#pragma GCC pop_options
|
||||
+#endif
|
||||
--
|
||||
2.1.0
|
||||
|
|
@ -74,5 +74,4 @@ sed -e "s/DEFINES\['OPUS_VERSION'\][ \t]*=[ \t]*'\".*\"'/DEFINES['OPUS_VERSION']
|
|||
python gen-sources.py $1
|
||||
|
||||
# apply outstanding local patches
|
||||
patch -p3 < gcc-4.8-ICE.patch
|
||||
patch -p3 < nonunified.patch
|
||||
|
|
|
@ -134,7 +134,11 @@ if CONFIG['MOZ_WEBRTC_SIGNALING']:
|
|||
|
||||
if CONFIG['ENABLE_TESTS']:
|
||||
TEST_DIRS += [
|
||||
'signaling/fuzztest',
|
||||
'signaling/gtest',
|
||||
'trunk/gtest',
|
||||
]
|
||||
|
||||
if CONFIG['FUZZING']:
|
||||
TEST_DIRS += [
|
||||
'signaling/fuzztest'
|
||||
]
|
||||
|
|
|
@ -3,47 +3,19 @@
|
|||
# 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/.
|
||||
if CONFIG['OS_TARGET'] == 'Linux' or CONFIG['OS_TARGET'] == 'Darwin':
|
||||
DISABLE_STL_WRAPPING = True
|
||||
DEFINES['CPR_STRING_USE_FALLIBLE_MALLOC'] = True
|
||||
DEFINES['MOZ_NO_MOZALLOC'] = True
|
||||
|
||||
if CONFIG['OS_TARGET'] == 'Darwin':
|
||||
DEFINES['SIP_OS_OSX'] = True
|
||||
else:
|
||||
DEFINES['SIP_OS_LINUX'] = True
|
||||
Library('FuzzingSdp')
|
||||
|
||||
LOCAL_INCLUDES += [
|
||||
'../..',
|
||||
'/media/mtransport',
|
||||
'/media/webrtc/signaling/src/common/browser_logging',
|
||||
]
|
||||
LOCAL_INCLUDES += [
|
||||
'/ipc/chromium/src',
|
||||
'/media/mtransport',
|
||||
'/media/webrtc/',
|
||||
'/media/webrtc/signaling/src/common/time_profiling',
|
||||
'/media/webrtc/signaling/src/peerconnection',
|
||||
]
|
||||
|
||||
USE_LIBS += [
|
||||
'/testing/gtest/gtest',
|
||||
'mozglue',
|
||||
'nspr',
|
||||
]
|
||||
SOURCES += [
|
||||
'sdp_parser_libfuzz.cpp',
|
||||
]
|
||||
|
||||
SOURCES = [
|
||||
'/media/webrtc/signaling/src/sdp/SdpAttribute.cpp',
|
||||
'/media/webrtc/signaling/src/sdp/SdpHelper.cpp',
|
||||
'/media/webrtc/signaling/src/sdp/SdpMediaSection.cpp',
|
||||
'/media/webrtc/signaling/src/sdp/sipcc/cpr_string.c',
|
||||
'/media/webrtc/signaling/src/sdp/sipcc/sdp_access.c',
|
||||
'/media/webrtc/signaling/src/sdp/sipcc/sdp_attr.c',
|
||||
'/media/webrtc/signaling/src/sdp/sipcc/sdp_attr_access.c',
|
||||
'/media/webrtc/signaling/src/sdp/sipcc/sdp_base64.c',
|
||||
'/media/webrtc/signaling/src/sdp/sipcc/sdp_config.c',
|
||||
'/media/webrtc/signaling/src/sdp/sipcc/sdp_main.c',
|
||||
'/media/webrtc/signaling/src/sdp/sipcc/sdp_services_unix.c',
|
||||
'/media/webrtc/signaling/src/sdp/sipcc/sdp_token.c',
|
||||
'/media/webrtc/signaling/src/sdp/sipcc/sdp_utils.c',
|
||||
'/media/webrtc/signaling/src/sdp/SipccSdp.cpp',
|
||||
'/media/webrtc/signaling/src/sdp/SipccSdpAttributeList.cpp',
|
||||
'/media/webrtc/signaling/src/sdp/SipccSdpMediaSection.cpp',
|
||||
'/media/webrtc/signaling/src/sdp/SipccSdpParser.cpp',
|
||||
'sdp_file_parser.cpp',
|
||||
]
|
||||
|
||||
Program('sdp_file_parser')
|
||||
FINAL_LIBRARY = 'xul-gtest'
|
||||
|
|
|
@ -1,119 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set ts=2 et sw=2 tw=80: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
|
||||
#define GTEST_HAS_RTTI 0
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
#include "signaling/src/sdp/SipccSdpParser.h"
|
||||
|
||||
#include "CSFLog.h"
|
||||
|
||||
void CSFLog(CSFLogLevel priority, const char* sourceFile, int sourceLine, const char* tag , const char* format, ...)
|
||||
{
|
||||
va_list ap;
|
||||
va_start(ap, format);
|
||||
|
||||
printf("%s\n:", tag);
|
||||
vprintf(format, ap);
|
||||
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
extern "C" {
|
||||
void NS_DebugBreak(uint32_t aSeverity,
|
||||
const char* aStr, const char* aExpr,
|
||||
const char* aFile, int32_t aLine)
|
||||
{
|
||||
fprintf(stderr, "NS_DebugBreak: %u %s %s %s %u", aSeverity, aStr, aExpr,
|
||||
aFile, aLine);
|
||||
}
|
||||
} // end extern "C".
|
||||
|
||||
class PRLogModuleInfo;
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
enum class LogLevel {
|
||||
|
||||
};
|
||||
|
||||
namespace detail {
|
||||
|
||||
void log_print(PRLogModuleInfo const* info, LogLevel level, char const* format, ...) {
|
||||
va_list ap;
|
||||
va_start(ap, format);
|
||||
|
||||
vprintf(format, ap);
|
||||
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
} // End namespace detail.
|
||||
|
||||
const std::string kDefaultFilename((char *)"/tmp/sdp.bin");
|
||||
std::string filename(kDefaultFilename);
|
||||
|
||||
class SdpParseTest : public ::testing::Test
|
||||
{
|
||||
public:
|
||||
SdpParseTest() {}
|
||||
|
||||
void ParseSdp(const std::string &sdp) {
|
||||
mSdp = mParser.Parse(sdp);
|
||||
}
|
||||
|
||||
void SerializeSdp() {
|
||||
if (mSdp) {
|
||||
mSdp->Serialize(os);
|
||||
std::cout << "Serialized SDP:" << std::endl <<
|
||||
os.str() << std::endl;;
|
||||
}
|
||||
}
|
||||
|
||||
SipccSdpParser mParser;
|
||||
mozilla::UniquePtr<Sdp> mSdp;
|
||||
std::stringstream os;
|
||||
}; // class SdpParseTest
|
||||
|
||||
TEST_F(SdpParseTest, parseSdpFromFile)
|
||||
{
|
||||
std::ifstream file(filename.c_str(),
|
||||
std::ios::in|std::ios::binary|std::ios::ate);
|
||||
ASSERT_TRUE(file.is_open());
|
||||
std::streampos size = file.tellg();
|
||||
size_t nsize = size;
|
||||
nsize+=1;
|
||||
char *memblock = new char [nsize];
|
||||
memset(memblock, '\0', nsize);
|
||||
file.seekg(0, std::ios::beg);
|
||||
file.read(memblock, size);
|
||||
file.close();
|
||||
std::cout << "Read file " << filename << std::endl;
|
||||
ParseSdp(memblock);
|
||||
std::cout << "Parsed SDP" << std::endl;
|
||||
SerializeSdp();
|
||||
delete[] memblock;
|
||||
}
|
||||
|
||||
} // End namespace mozilla.
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
::testing::InitGoogleTest(&argc, argv);
|
||||
|
||||
if (argc == 2) {
|
||||
mozilla::filename = argv[1];
|
||||
} else if (argc > 2) {
|
||||
std::cerr << "Usage: ./sdp_file_parser [filename]" << std::endl;
|
||||
return(1);
|
||||
}
|
||||
|
||||
return RUN_ALL_TESTS();
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set ts=2 et sw=2 tw=80: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
#include "FuzzingInterface.h"
|
||||
#include "LibFuzzerRegistry.h"
|
||||
|
||||
#include "signaling/src/sdp/SipccSdpParser.h"
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
static mozilla::UniquePtr<Sdp> sdpPtr;
|
||||
static SipccSdpParser mParser;
|
||||
|
||||
int FuzzingInitSdpParser(int *argc, char ***argv) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
RunSdpParserFuzzing(const uint8_t* data, size_t size) {
|
||||
std::string message(reinterpret_cast<const char*>(data), size);
|
||||
|
||||
sdpPtr = mParser.Parse(message);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
MOZ_FUZZING_INTERFACE_RAW(FuzzingInitSdpParser, RunSdpParserFuzzing, SdpParser);
|
|
@ -38,6 +38,7 @@ android {
|
|||
|
||||
dexOptions {
|
||||
javaMaxHeapSize "2g"
|
||||
jumboMode = true
|
||||
}
|
||||
|
||||
lintOptions {
|
||||
|
@ -45,14 +46,6 @@ android {
|
|||
}
|
||||
|
||||
buildTypes {
|
||||
// Bug 1367768: With current code, we need jumboMode for a string table larger than 65536.
|
||||
// To not interrupt release 55 nightly to beta merge, jumboMode only applies to debug now
|
||||
// and will apply to all builds very soon (Mid June 2017, see bug 1370156).
|
||||
debug {
|
||||
dexOptions {
|
||||
jumboMode = true
|
||||
}
|
||||
}
|
||||
// We have the following difficult situation. Minification (Proguard) is only available per
|
||||
// Android-Gradle `buildType`. Instrumentation (Robocop) is only available for exactly one
|
||||
// `buildType` (see Android-Gradle `testBuildType`, which defaults to "debug"). Local
|
||||
|
|
|
@ -242,7 +242,7 @@ classes.dex: .gradle.deps
|
|||
else
|
||||
classes.dex: .proguard.deps
|
||||
$(REPORT_BUILD)
|
||||
$(DX) --dex --output=classes.dex jars-proguarded
|
||||
$(DX) --dex --output=classes.dex --force-jumbo jars-proguarded
|
||||
endif
|
||||
|
||||
ifdef MOZ_DISABLE_PROGUARD
|
||||
|
|
|
@ -147,7 +147,7 @@ var NewPrefDialog = {
|
|||
|
||||
switch(this.type) {
|
||||
case "boolean":
|
||||
Services.prefs.setBoolPref(this._prefNameInputElt.value, (this._booleanValue.value == "true") ? true : false);
|
||||
Services.prefs.setBoolPref(this._prefNameInputElt.value, !!(this._booleanValue.value == "true"));
|
||||
break;
|
||||
case "string":
|
||||
Services.prefs.setCharPref(this._prefNameInputElt.value, this._stringValue.value);
|
||||
|
|
|
@ -15,9 +15,9 @@
|
|||
"unpack": true
|
||||
},
|
||||
{
|
||||
"version": "rustc 1.17.0 (56124baa9 2017-04-24) repack with cargo 0.19.0-beta.1 (03efb7fc8 2017-04-23)",
|
||||
"size": 115834080,
|
||||
"digest": "7a70b51daf709cb04cd677ec07ac3c3bb4ec7bd8dc1daccf9b509af2b4ef8a00b4cb87f3bdbc97af011f1454b6427741dd60dbdad6a4b9b1d7f9ccffd3c98de9",
|
||||
"version": "rustc 1.18.0 (03fc9d622 2017-06-06) repack",
|
||||
"size": 139759616,
|
||||
"digest": "56f632c063744fa6d57a13a2647916e22e5bb89f4e02d7e94df1d45b5532c1db12a6e97d9c3951963f4e89b68467cca6818f7fe86d26b7e28577d04e196e873b",
|
||||
"algorithm": "sha512",
|
||||
"filename": "rustc.tar.xz",
|
||||
"unpack": true
|
||||
|
|
|
@ -48,9 +48,9 @@
|
|||
"unpack": true
|
||||
},
|
||||
{
|
||||
"version": "rustc 1.17.0 (56124baa9 2017-04-24) repack with cargo 0.19.0-beta.1 (03efb7fc8 2017-04-23)",
|
||||
"size": 115834080,
|
||||
"digest": "7a70b51daf709cb04cd677ec07ac3c3bb4ec7bd8dc1daccf9b509af2b4ef8a00b4cb87f3bdbc97af011f1454b6427741dd60dbdad6a4b9b1d7f9ccffd3c98de9",
|
||||
"version": "rustc 1.18.0 (03fc9d622 2017-06-06) repack",
|
||||
"size": 139759616,
|
||||
"digest": "56f632c063744fa6d57a13a2647916e22e5bb89f4e02d7e94df1d45b5532c1db12a6e97d9c3951963f4e89b68467cca6818f7fe86d26b7e28577d04e196e873b",
|
||||
"algorithm": "sha512",
|
||||
"filename": "rustc.tar.xz",
|
||||
"unpack": true
|
||||
|
|
|
@ -73,9 +73,9 @@
|
|||
"size": 51753660
|
||||
},
|
||||
{
|
||||
"version": "rustc 1.17.0 (56124baa9 2017-04-24) repack with cargo 0.19.0-beta.1 (03efb7fc8 2017-04-23)",
|
||||
"size": 115834080,
|
||||
"digest": "7a70b51daf709cb04cd677ec07ac3c3bb4ec7bd8dc1daccf9b509af2b4ef8a00b4cb87f3bdbc97af011f1454b6427741dd60dbdad6a4b9b1d7f9ccffd3c98de9",
|
||||
"version": "rustc 1.18.0 (03fc9d622 2017-06-06) repack",
|
||||
"size": 139759616,
|
||||
"digest": "56f632c063744fa6d57a13a2647916e22e5bb89f4e02d7e94df1d45b5532c1db12a6e97d9c3951963f4e89b68467cca6818f7fe86d26b7e28577d04e196e873b",
|
||||
"algorithm": "sha512",
|
||||
"filename": "rustc.tar.xz",
|
||||
"unpack": true
|
||||
|
|
|
@ -56,7 +56,7 @@ class GeckoViewProgress extends GeckoViewModule {
|
|||
!aWebProgress.isLoadingDocument) {
|
||||
let message = {
|
||||
type: "GeckoView:PageStop",
|
||||
success: aStatus ? false : true
|
||||
success: !aStatus
|
||||
};
|
||||
|
||||
this.eventDispatcher.sendRequest(message);
|
||||
|
|
|
@ -3721,8 +3721,6 @@ pref("intl.tsf.hack.free_chang_jie.do_not_return_no_layout_error", true);
|
|||
pref("intl.tsf.hack.ms_simplified_chinese.do_not_return_no_layout_error", true);
|
||||
// For Microsoft ChangJie and Microsoft Quick
|
||||
pref("intl.tsf.hack.ms_traditional_chinese.do_not_return_no_layout_error", true);
|
||||
// For Easy Changjei
|
||||
pref("intl.tsf.hack.easy_changjei.do_not_return_no_layout_error", true);
|
||||
// Whether use previous character rect for the result of
|
||||
// ITfContextView::GetTextExt() if the specified range is the first character
|
||||
// of selected clause of composition string.
|
||||
|
|
|
@ -58,6 +58,8 @@ LoadInfo::LoadInfo(nsIPrincipal* aLoadingPrincipal,
|
|||
, mIsPreflight(false)
|
||||
, mForceHSTSPriming(false)
|
||||
, mMixedContentWouldBlock(false)
|
||||
, mIsHSTSPriming(false)
|
||||
, mIsHSTSPrimingUpgrade(false)
|
||||
{
|
||||
MOZ_ASSERT(mLoadingPrincipal);
|
||||
MOZ_ASSERT(mTriggeringPrincipal);
|
||||
|
@ -231,6 +233,8 @@ LoadInfo::LoadInfo(nsPIDOMWindowOuter* aOuterWindow,
|
|||
, mIsPreflight(false)
|
||||
, mForceHSTSPriming(false)
|
||||
, mMixedContentWouldBlock(false)
|
||||
, mIsHSTSPriming(false)
|
||||
, mIsHSTSPrimingUpgrade(false)
|
||||
{
|
||||
// Top-level loads are never third-party
|
||||
// Grab the information we can out of the window.
|
||||
|
@ -294,6 +298,8 @@ LoadInfo::LoadInfo(const LoadInfo& rhs)
|
|||
, mIsPreflight(rhs.mIsPreflight)
|
||||
, mForceHSTSPriming(rhs.mForceHSTSPriming)
|
||||
, mMixedContentWouldBlock(rhs.mMixedContentWouldBlock)
|
||||
, mIsHSTSPriming(rhs.mIsHSTSPriming)
|
||||
, mIsHSTSPrimingUpgrade(rhs.mIsHSTSPrimingUpgrade)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -322,7 +328,9 @@ LoadInfo::LoadInfo(nsIPrincipal* aLoadingPrincipal,
|
|||
bool aForcePreflight,
|
||||
bool aIsPreflight,
|
||||
bool aForceHSTSPriming,
|
||||
bool aMixedContentWouldBlock)
|
||||
bool aMixedContentWouldBlock,
|
||||
bool aIsHSTSPriming,
|
||||
bool aIsHSTSPrimingUpgrade)
|
||||
: mLoadingPrincipal(aLoadingPrincipal)
|
||||
, mTriggeringPrincipal(aTriggeringPrincipal)
|
||||
, mPrincipalToInherit(aPrincipalToInherit)
|
||||
|
@ -346,6 +354,8 @@ LoadInfo::LoadInfo(nsIPrincipal* aLoadingPrincipal,
|
|||
, mIsPreflight(aIsPreflight)
|
||||
, mForceHSTSPriming (aForceHSTSPriming)
|
||||
, mMixedContentWouldBlock(aMixedContentWouldBlock)
|
||||
, mIsHSTSPriming(aIsHSTSPriming)
|
||||
, mIsHSTSPrimingUpgrade(aIsHSTSPrimingUpgrade)
|
||||
{
|
||||
// Only top level TYPE_DOCUMENT loads can have a null loadingPrincipal
|
||||
MOZ_ASSERT(mLoadingPrincipal || aContentPolicyType == nsIContentPolicy::TYPE_DOCUMENT);
|
||||
|
@ -933,6 +943,38 @@ LoadInfo::ClearHSTSPriming()
|
|||
mMixedContentWouldBlock = false;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
LoadInfo::SetIsHSTSPriming(bool aIsHSTSPriming)
|
||||
{
|
||||
MOZ_ASSERT(aIsHSTSPriming);
|
||||
mIsHSTSPriming = aIsHSTSPriming;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
LoadInfo::GetIsHSTSPriming(bool* aIsHSTSPriming)
|
||||
{
|
||||
MOZ_ASSERT(aIsHSTSPriming);
|
||||
*aIsHSTSPriming = mIsHSTSPriming;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
LoadInfo::SetIsHSTSPrimingUpgrade(bool aIsHSTSPrimingUpgrade)
|
||||
{
|
||||
MOZ_ASSERT(aIsHSTSPrimingUpgrade);
|
||||
mIsHSTSPrimingUpgrade = aIsHSTSPrimingUpgrade;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
LoadInfo::GetIsHSTSPrimingUpgrade(bool* aIsHSTSPrimingUpgrade)
|
||||
{
|
||||
MOZ_ASSERT(aIsHSTSPrimingUpgrade);
|
||||
*aIsHSTSPrimingUpgrade = mIsHSTSPrimingUpgrade;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
LoadInfo::GetTainting(uint32_t* aTaintingOut)
|
||||
{
|
||||
|
|
|
@ -115,7 +115,9 @@ private:
|
|||
bool aForcePreflight,
|
||||
bool aIsPreflight,
|
||||
bool aForceHSTSPriming,
|
||||
bool aMixedContentWouldBlock);
|
||||
bool aMixedContentWouldBlock,
|
||||
bool aIsHSTSPriming,
|
||||
bool aIsHSTSPrimingUpgrade);
|
||||
LoadInfo(const LoadInfo& rhs);
|
||||
|
||||
NS_IMETHOD GetRedirects(JSContext* aCx, JS::MutableHandle<JS::Value> aRedirects,
|
||||
|
@ -165,6 +167,8 @@ private:
|
|||
|
||||
bool mForceHSTSPriming : 1;
|
||||
bool mMixedContentWouldBlock : 1;
|
||||
bool mIsHSTSPriming: 1;
|
||||
bool mIsHSTSPrimingUpgrade: 1;
|
||||
};
|
||||
|
||||
} // namespace net
|
||||
|
|
|
@ -675,6 +675,16 @@ interface nsILoadInfo : nsISupports
|
|||
*/
|
||||
[noscript, infallible] readonly attribute boolean mixedContentWouldBlock;
|
||||
|
||||
/**
|
||||
* True if this load is an HSTS priming request.
|
||||
*/
|
||||
[noscript, infallible] attribute boolean isHSTSPriming;
|
||||
|
||||
/**
|
||||
* True if this load was upgraded from HSTS priming
|
||||
*/
|
||||
[noscript, infallible] attribute boolean isHSTSPrimingUpgrade;
|
||||
|
||||
/**
|
||||
* Mark this LoadInfo as needing HSTS Priming
|
||||
*
|
||||
|
|
|
@ -2569,6 +2569,14 @@ NS_ShouldSecureUpgrade(nsIURI* aURI,
|
|||
aShouldUpgrade = true;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
if (aLoadInfo->GetForceHSTSPriming()) {
|
||||
// don't log requests which might be upgraded due to HSTS Priming
|
||||
// they get logged in nsHttpChannel::OnHSTSPrimingSucceeded or
|
||||
// nsHttpChannel::OnHSTSPrimingFailed if the load is allowed to proceed.
|
||||
aShouldUpgrade = false;
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
|
||||
// enforce Strict-Transport-Security
|
||||
|
@ -2598,6 +2606,21 @@ NS_ShouldSecureUpgrade(nsIURI* aURI,
|
|||
Telemetry::Accumulate(Telemetry::HTTP_SCHEME_UPGRADE, 1);
|
||||
}
|
||||
} else {
|
||||
if (aLoadInfo) {
|
||||
if (aLoadInfo->GetIsHSTSPriming()) {
|
||||
// don't log HSTS priming requests
|
||||
aShouldUpgrade = false;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
if (aLoadInfo->GetIsHSTSPrimingUpgrade()) {
|
||||
// if the upgrade occured due to HSTS priming, it was logged in
|
||||
// nsHttpChannel::OnHSTSPrimingSucceeded before redirect
|
||||
aShouldUpgrade = false;
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
|
||||
Telemetry::Accumulate(Telemetry::HTTP_SCHEME_UPGRADE, 0);
|
||||
}
|
||||
aShouldUpgrade = false;
|
||||
|
|
|
@ -63,6 +63,8 @@ struct LoadInfoArgs
|
|||
bool isPreflight;
|
||||
bool forceHSTSPriming;
|
||||
bool mixedContentWouldBlock;
|
||||
bool isHSTSPriming;
|
||||
bool isHSTSPrimingUpgrade;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
#include "mozilla/net/RtspChannelChild.h"
|
||||
#endif
|
||||
#include "SerializedLoadContext.h"
|
||||
#include "nsGlobalWindow.h"
|
||||
#include "nsIOService.h"
|
||||
#include "nsINetworkPredictor.h"
|
||||
#include "nsINetworkPredictorVerifier.h"
|
||||
|
@ -208,8 +209,18 @@ NeckoChild::DeallocPWebSocketChild(PWebSocketChild* child)
|
|||
PWebSocketEventListenerChild*
|
||||
NeckoChild::AllocPWebSocketEventListenerChild(const uint64_t& aInnerWindowID)
|
||||
{
|
||||
nsCOMPtr<nsIEventTarget> target;
|
||||
if (nsGlobalWindow* win = nsGlobalWindow::GetInnerWindowWithId(aInnerWindowID)) {
|
||||
target = win->EventTargetFor(TaskCategory::Other);
|
||||
}
|
||||
|
||||
RefPtr<WebSocketEventListenerChild> c =
|
||||
new WebSocketEventListenerChild(aInnerWindowID);
|
||||
new WebSocketEventListenerChild(aInnerWindowID, target);
|
||||
|
||||
if (target) {
|
||||
gNeckoChild->SetEventTargetForActor(c, target);
|
||||
}
|
||||
|
||||
return c.forget().take();
|
||||
}
|
||||
|
||||
|
|
|
@ -47,6 +47,7 @@ FINAL_LIBRARY = 'xul'
|
|||
|
||||
LOCAL_INCLUDES += [
|
||||
'/caps',
|
||||
'/dom/base',
|
||||
'/modules/libjar',
|
||||
'/netwerk/base',
|
||||
'/netwerk/protocol/http',
|
||||
|
|
|
@ -51,21 +51,24 @@ HSTSPrimingListener::GetInterface(const nsIID & aIID, void **aResult)
|
|||
}
|
||||
|
||||
void
|
||||
HSTSPrimingListener::ReportTiming(nsresult aResult)
|
||||
HSTSPrimingListener::ReportTiming(nsIHstsPrimingCallback* aCallback, nsresult aResult)
|
||||
{
|
||||
nsCOMPtr<nsITimedChannel> timingChannel =
|
||||
do_QueryInterface(mCallback);
|
||||
if (timingChannel) {
|
||||
TimeStamp channelCreationTime;
|
||||
nsresult rv = timingChannel->GetChannelCreation(&channelCreationTime);
|
||||
if (NS_SUCCEEDED(rv) && !channelCreationTime.IsNull()) {
|
||||
PRUint32 interval =
|
||||
(PRUint32) (TimeStamp::Now() - channelCreationTime).ToMilliseconds();
|
||||
Telemetry::Accumulate(Telemetry::HSTS_PRIMING_REQUEST_DURATION,
|
||||
(NS_SUCCEEDED(aResult)) ? NS_LITERAL_CSTRING("success")
|
||||
: NS_LITERAL_CSTRING("failure"),
|
||||
interval);
|
||||
}
|
||||
do_QueryInterface(aCallback);
|
||||
if (!timingChannel) {
|
||||
LOG(("HSTS priming: mCallback is not an nsITimedChannel!"));
|
||||
return;
|
||||
}
|
||||
|
||||
TimeStamp channelCreationTime;
|
||||
nsresult rv = timingChannel->GetChannelCreation(&channelCreationTime);
|
||||
if (NS_SUCCEEDED(rv) && !channelCreationTime.IsNull()) {
|
||||
PRUint32 interval =
|
||||
(PRUint32) (TimeStamp::Now() - channelCreationTime).ToMilliseconds();
|
||||
Telemetry::Accumulate(Telemetry::HSTS_PRIMING_REQUEST_DURATION,
|
||||
(NS_SUCCEEDED(aResult)) ? NS_LITERAL_CSTRING("success")
|
||||
: NS_LITERAL_CSTRING("failure"),
|
||||
interval);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -88,7 +91,7 @@ HSTSPrimingListener::OnStartRequest(nsIRequest *aRequest,
|
|||
}
|
||||
|
||||
nsresult primingResult = CheckHSTSPrimingRequestStatus(aRequest);
|
||||
ReportTiming(primingResult);
|
||||
ReportTiming(callback, primingResult);
|
||||
|
||||
if (NS_FAILED(primingResult)) {
|
||||
LOG(("HSTS Priming Failed (request was not approved)"));
|
||||
|
@ -192,7 +195,7 @@ HSTSPrimingListener::Notify(nsITimer* timer)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
ReportTiming(NS_ERROR_HSTS_PRIMING_TIMEOUT);
|
||||
ReportTiming(callback, NS_ERROR_HSTS_PRIMING_TIMEOUT);
|
||||
|
||||
if (mPrimingChannel) {
|
||||
rv = mPrimingChannel->Cancel(NS_ERROR_HSTS_PRIMING_TIMEOUT);
|
||||
|
@ -237,12 +240,16 @@ HSTSPrimingListener::StartHSTSPriming(nsIChannel* aRequestChannel,
|
|||
|
||||
if (hsts) {
|
||||
// already saw this host and will upgrade if allowed by preferences
|
||||
Telemetry::Accumulate(Telemetry::MIXED_CONTENT_HSTS_PRIMING_REQUESTS,
|
||||
HSTSPrimingRequest::eHSTS_PRIMING_REQUEST_CACHED_HSTS);
|
||||
return aCallback->OnHSTSPrimingSucceeded(true);
|
||||
}
|
||||
|
||||
if (cached) {
|
||||
// there is a non-expired entry in the cache that doesn't allow us to
|
||||
// upgrade, so go ahead and fail early.
|
||||
Telemetry::Accumulate(Telemetry::MIXED_CONTENT_HSTS_PRIMING_REQUESTS,
|
||||
HSTSPrimingRequest::eHSTS_PRIMING_REQUEST_CACHED_NO_HSTS);
|
||||
return aCallback->OnHSTSPrimingFailed(NS_ERROR_CONTENT_BLOCKED, true);
|
||||
}
|
||||
|
||||
|
@ -257,6 +264,7 @@ HSTSPrimingListener::StartHSTSPriming(nsIChannel* aRequestChannel,
|
|||
|
||||
nsCOMPtr<nsILoadInfo> loadInfo = static_cast<mozilla::LoadInfo*>
|
||||
(originalLoadInfo.get())->CloneForNewRequest();
|
||||
loadInfo->SetIsHSTSPriming(true);
|
||||
|
||||
// the LoadInfo must have a security flag set in order to pass through priming
|
||||
// if none of these security flags are set, go ahead and fail now instead of
|
||||
|
@ -370,6 +378,9 @@ HSTSPrimingListener::StartHSTSPriming(nsIChannel* aRequestChannel,
|
|||
|
||||
listener->mHSTSPrimingTimer.swap(timer);
|
||||
|
||||
Telemetry::Accumulate(Telemetry::MIXED_CONTENT_HSTS_PRIMING_REQUESTS,
|
||||
HSTSPrimingRequest::eHSTS_PRIMING_REQUEST_SENT);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -26,6 +26,31 @@ namespace net {
|
|||
class HttpChannelParent;
|
||||
class nsHttpChannel;
|
||||
|
||||
/*
|
||||
* How often do we send an HSTS priming request (over all requests)
|
||||
*/
|
||||
enum HSTSPrimingRequest {
|
||||
// No HSTS priming request. The request is not mixed-content, or we have
|
||||
// already cached the result before nsMixedContentBlocker::ShouldLoad
|
||||
eHSTS_PRIMING_NO_REQUEST = 0,
|
||||
// Sent an HSTS priming request
|
||||
eHSTS_PRIMING_REQUEST_SENT = 1,
|
||||
// Channel marked for priming, but already had a cached result
|
||||
eHSTS_PRIMING_REQUEST_CACHED_HSTS = 2,
|
||||
// Channel marked for priming, but already had a cached result
|
||||
eHSTS_PRIMING_REQUEST_CACHED_NO_HSTS = 3,
|
||||
// An error occured setting up the the priming request channel. If the
|
||||
// priming channel failed in OnstopRequest, there is no HSTS, or the
|
||||
// channel is redirected, that is recorded by
|
||||
// MIXED_CONTENT_HSTS_PRIMING_RESULT.
|
||||
eHSTS_PRIMING_REQUEST_ERROR = 4,
|
||||
// The channel had no load info, so is ineligible for priming
|
||||
eHSTS_PRIMING_REQUEST_NO_LOAD_INFO = 5,
|
||||
// The request was marked for HSTS priming, but was upgraded by
|
||||
// NS_ShouldSecureUpgrade before HSTS priming was sent.
|
||||
eHSTS_PRIMING_REQUEST_ALREADY_UPGRADED = 6,
|
||||
};
|
||||
|
||||
/*
|
||||
* How often do we get back an HSTS priming result which upgrades the connection to HTTPS?
|
||||
*/
|
||||
|
@ -56,7 +81,7 @@ enum HSTSPrimingResult {
|
|||
eHSTS_PRIMING_TIMEOUT_BLOCK = 9,
|
||||
// The HSTS Priming request timed out, and the load is allowed by
|
||||
// mixed-content
|
||||
eHSTS_PRIMING_TIMEOUT_ACCEPT = 10
|
||||
eHSTS_PRIMING_TIMEOUT_ACCEPT = 10,
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
@ -103,7 +128,7 @@ private:
|
|||
nsresult CheckHSTSPrimingRequestStatus(nsIRequest* aRequest);
|
||||
|
||||
// send telemetry about how long HSTS priming requests take
|
||||
void ReportTiming(nsresult aResult);
|
||||
void ReportTiming(nsIHstsPrimingCallback* aCallback, nsresult aResult);
|
||||
|
||||
/**
|
||||
* the nsIHttpChannel to notify with the result of HSTS priming.
|
||||
|
|
|
@ -483,6 +483,11 @@ nsresult
|
|||
nsHttpChannel::TryHSTSPriming()
|
||||
{
|
||||
if (mLoadInfo) {
|
||||
if (mLoadInfo->GetIsHSTSPriming()) {
|
||||
// shortcut priming requests so they don't get counted
|
||||
return ContinueConnect();
|
||||
}
|
||||
|
||||
// HSTS priming requires the LoadInfo provided with AsyncOpen2
|
||||
bool requireHSTSPriming =
|
||||
mLoadInfo->GetForceHSTSPriming();
|
||||
|
@ -498,18 +503,38 @@ nsHttpChannel::TryHSTSPriming()
|
|||
|
||||
if (NS_FAILED(rv)) {
|
||||
CloseCacheEntry(false);
|
||||
Telemetry::Accumulate(Telemetry::MIXED_CONTENT_HSTS_PRIMING_REQUESTS,
|
||||
HSTSPrimingRequest::eHSTS_PRIMING_REQUEST_ERROR);
|
||||
return rv;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// The request was already upgraded, for example by
|
||||
// upgrade-insecure-requests or a prior successful priming request
|
||||
Telemetry::Accumulate(Telemetry::MIXED_CONTENT_HSTS_PRIMING_RESULT,
|
||||
HSTSPrimingResult::eHSTS_PRIMING_ALREADY_UPGRADED);
|
||||
if (!mLoadInfo->GetIsHSTSPrimingUpgrade()) {
|
||||
// The request was already upgraded, for example by a prior
|
||||
// successful priming request
|
||||
LOG(("HSTS Priming: request already upgraded"));
|
||||
Telemetry::Accumulate(Telemetry::MIXED_CONTENT_HSTS_PRIMING_RESULT,
|
||||
HSTSPrimingResult::eHSTS_PRIMING_ALREADY_UPGRADED);
|
||||
|
||||
// No HSTS Priming request was sent.
|
||||
Telemetry::Accumulate(Telemetry::MIXED_CONTENT_HSTS_PRIMING_REQUESTS,
|
||||
HSTSPrimingRequest::eHSTS_PRIMING_REQUEST_ALREADY_UPGRADED);
|
||||
}
|
||||
|
||||
mLoadInfo->ClearHSTSPriming();
|
||||
return ContinueConnect();
|
||||
}
|
||||
|
||||
if (!mLoadInfo->GetIsHSTSPrimingUpgrade()) {
|
||||
// No HSTS Priming request was sent, and we didn't already record this request
|
||||
Telemetry::Accumulate(Telemetry::MIXED_CONTENT_HSTS_PRIMING_REQUESTS,
|
||||
HSTSPrimingRequest::eHSTS_PRIMING_NO_REQUEST);
|
||||
}
|
||||
} else {
|
||||
Telemetry::Accumulate(Telemetry::MIXED_CONTENT_HSTS_PRIMING_REQUESTS,
|
||||
HSTSPrimingRequest::eHSTS_PRIMING_REQUEST_NO_LOAD_INFO);
|
||||
}
|
||||
|
||||
return ContinueConnect();
|
||||
|
@ -8610,6 +8635,14 @@ nsHttpChannel::OnPreflightFailed(nsresult aError)
|
|||
nsresult
|
||||
nsHttpChannel::OnHSTSPrimingSucceeded(bool aCached)
|
||||
{
|
||||
// If "security.mixed_content.use_hsts" is false, record the result of
|
||||
// HSTS priming and block or proceed with the load as required by
|
||||
// mixed-content blocking
|
||||
bool wouldBlock = mLoadInfo->GetMixedContentWouldBlock();
|
||||
// Clear out the HSTS priming flags on the LoadInfo to simplify the logic in
|
||||
// TryHSTSPriming()
|
||||
mLoadInfo->ClearHSTSPriming();
|
||||
|
||||
if (nsMixedContentBlocker::sUseHSTS) {
|
||||
// redirect the channel to HTTPS if the pref
|
||||
// "security.mixed_content.use_hsts" is true
|
||||
|
@ -8617,14 +8650,12 @@ nsHttpChannel::OnHSTSPrimingSucceeded(bool aCached)
|
|||
Telemetry::Accumulate(Telemetry::MIXED_CONTENT_HSTS_PRIMING_RESULT,
|
||||
(aCached) ? HSTSPrimingResult::eHSTS_PRIMING_CACHED_DO_UPGRADE :
|
||||
HSTSPrimingResult::eHSTS_PRIMING_SUCCEEDED);
|
||||
// we have to record this upgrade here
|
||||
Telemetry::Accumulate(Telemetry::HTTP_SCHEME_UPGRADE, 3);
|
||||
mLoadInfo->SetIsHSTSPrimingUpgrade(true);
|
||||
return AsyncCall(&nsHttpChannel::HandleAsyncRedirectChannelToHttps);
|
||||
}
|
||||
|
||||
// If "security.mixed_content.use_hsts" is false, record the result of
|
||||
// HSTS priming and block or proceed with the load as required by
|
||||
// mixed-content blocking
|
||||
bool wouldBlock = mLoadInfo->GetMixedContentWouldBlock();
|
||||
|
||||
// preserve the mixed-content-before-hsts order and block if required
|
||||
if (wouldBlock) {
|
||||
LOG(("HSTS Priming succeeded, blocking for mixed-content [this=%p]",
|
||||
|
@ -8639,6 +8670,9 @@ nsHttpChannel::OnHSTSPrimingSucceeded(bool aCached)
|
|||
Telemetry::Accumulate(Telemetry::MIXED_CONTENT_HSTS_PRIMING_RESULT,
|
||||
HSTSPrimingResult::eHSTS_PRIMING_SUCCEEDED_HTTP);
|
||||
|
||||
// log HTTP_SCHEME_UPGRADE telemetry
|
||||
Telemetry::Accumulate(Telemetry::HTTP_SCHEME_UPGRADE, 0);
|
||||
|
||||
nsresult rv = ContinueConnect();
|
||||
if (NS_FAILED(rv)) {
|
||||
CloseCacheEntry(false);
|
||||
|
@ -8656,6 +8690,9 @@ nsresult
|
|||
nsHttpChannel::OnHSTSPrimingFailed(nsresult aError, bool aCached)
|
||||
{
|
||||
bool wouldBlock = mLoadInfo->GetMixedContentWouldBlock();
|
||||
// Clear out the HSTS priming flags on the LoadInfo to simplify the logic in
|
||||
// TryHSTSPriming()
|
||||
mLoadInfo->ClearHSTSPriming();
|
||||
|
||||
LOG(("HSTS Priming Failed [this=%p], %s the load", this,
|
||||
(wouldBlock) ? "blocking" : "allowing"));
|
||||
|
@ -8697,6 +8734,9 @@ nsHttpChannel::OnHSTSPrimingFailed(nsresult aError, bool aCached)
|
|||
return AsyncAbort(aError);
|
||||
}
|
||||
|
||||
// log HTTP_SCHEME_UPGRADE telemetry
|
||||
Telemetry::Accumulate(Telemetry::HTTP_SCHEME_UPGRADE, 0);
|
||||
|
||||
// we can continue the load and the UI has been updated as mixed content
|
||||
rv = ContinueConnect();
|
||||
if (NS_FAILED(rv)) {
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#include "mozilla/dom/TabChild.h"
|
||||
#include "mozilla/net/NeckoChild.h"
|
||||
#include "WebSocketChannelChild.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsITabChild.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "mozilla/ipc/IPCStreamUtils.h"
|
||||
|
@ -51,7 +52,8 @@ NS_INTERFACE_MAP_BEGIN(WebSocketChannelChild)
|
|||
NS_INTERFACE_MAP_END
|
||||
|
||||
WebSocketChannelChild::WebSocketChannelChild(bool aEncrypted)
|
||||
: mIPCState(Closed)
|
||||
: NeckoTargetHolder(nullptr)
|
||||
, mIPCState(Closed)
|
||||
, mMutex("WebSocketChannelChild::mMutex")
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread(), "not main thread");
|
||||
|
@ -107,9 +109,11 @@ WebSocketChannelChild::MaybeReleaseIPCObject()
|
|||
}
|
||||
|
||||
if (!NS_IsMainThread()) {
|
||||
nsCOMPtr<nsIEventTarget> target = GetNeckoTarget();
|
||||
MOZ_ALWAYS_SUCCEEDS(
|
||||
NS_DispatchToMainThread(NewRunnableMethod(this,
|
||||
&WebSocketChannelChild::MaybeReleaseIPCObject)));
|
||||
target->Dispatch(NewRunnableMethod(this,
|
||||
&WebSocketChannelChild::MaybeReleaseIPCObject),
|
||||
NS_DISPATCH_NORMAL));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -496,6 +500,17 @@ WebSocketChannelChild::OnServerClose(const uint16_t& aCode,
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
WebSocketChannelChild::SetupNeckoTarget()
|
||||
{
|
||||
mNeckoTarget = nsContentUtils::GetEventTargetByLoadInfo(mLoadInfo, TaskCategory::Network);
|
||||
if (!mNeckoTarget) {
|
||||
return;
|
||||
}
|
||||
|
||||
gNeckoChild->SetEventTargetForActor(this, mNeckoTarget);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
WebSocketChannelChild::AsyncOpen(nsIURI *aURI,
|
||||
const nsACString &aOrigin,
|
||||
|
@ -554,6 +569,9 @@ WebSocketChannelChild::AsyncOpen(nsIURI *aURI,
|
|||
transportProvider = ipcChild;
|
||||
}
|
||||
|
||||
// This must be called before sending constructor message.
|
||||
SetupNeckoTarget();
|
||||
|
||||
gNeckoChild->SendPWebSocketConstructor(this, tabChild,
|
||||
IPC::SerializedLoadContext(this),
|
||||
mSerial);
|
||||
|
@ -607,7 +625,9 @@ WebSocketChannelChild::Close(uint16_t code, const nsACString & reason)
|
|||
{
|
||||
if (!NS_IsMainThread()) {
|
||||
MOZ_RELEASE_ASSERT(mTargetThread->IsOnCurrentThread());
|
||||
return NS_DispatchToMainThread(new CloseEvent(this, code, reason));
|
||||
nsCOMPtr<nsIEventTarget> target = GetNeckoTarget();
|
||||
return target->Dispatch(new CloseEvent(this, code, reason),
|
||||
NS_DISPATCH_NORMAL);
|
||||
}
|
||||
LOG(("WebSocketChannelChild::Close() %p\n", this));
|
||||
|
||||
|
@ -659,7 +679,9 @@ WebSocketChannelChild::SendMsg(const nsACString &aMsg)
|
|||
{
|
||||
if (!NS_IsMainThread()) {
|
||||
MOZ_RELEASE_ASSERT(IsOnTargetThread());
|
||||
return NS_DispatchToMainThread(new MsgEvent(this, aMsg, false));
|
||||
nsCOMPtr<nsIEventTarget> target = GetNeckoTarget();
|
||||
return target->Dispatch(new MsgEvent(this, aMsg, false),
|
||||
NS_DISPATCH_NORMAL);
|
||||
}
|
||||
LOG(("WebSocketChannelChild::SendMsg() %p\n", this));
|
||||
|
||||
|
@ -682,7 +704,9 @@ WebSocketChannelChild::SendBinaryMsg(const nsACString &aMsg)
|
|||
{
|
||||
if (!NS_IsMainThread()) {
|
||||
MOZ_RELEASE_ASSERT(IsOnTargetThread());
|
||||
return NS_DispatchToMainThread(new MsgEvent(this, aMsg, true));
|
||||
nsCOMPtr<nsIEventTarget> target = GetNeckoTarget();
|
||||
return target->Dispatch(new MsgEvent(this, aMsg, true),
|
||||
NS_DISPATCH_NORMAL);
|
||||
}
|
||||
LOG(("WebSocketChannelChild::SendBinaryMsg() %p\n", this));
|
||||
|
||||
|
@ -735,7 +759,9 @@ WebSocketChannelChild::SendBinaryStream(nsIInputStream *aStream,
|
|||
{
|
||||
if (!NS_IsMainThread()) {
|
||||
MOZ_RELEASE_ASSERT(mTargetThread->IsOnCurrentThread());
|
||||
return NS_DispatchToMainThread(new BinaryStreamEvent(this, aStream, aLength));
|
||||
nsCOMPtr<nsIEventTarget> target = GetNeckoTarget();
|
||||
return target->Dispatch(new BinaryStreamEvent(this, aStream, aLength),
|
||||
NS_DISPATCH_NORMAL);
|
||||
}
|
||||
|
||||
LOG(("WebSocketChannelChild::SendBinaryStream() %p\n", this));
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#ifndef mozilla_net_WebSocketChannelChild_h
|
||||
#define mozilla_net_WebSocketChannelChild_h
|
||||
|
||||
#include "mozilla/net/NeckoTargetHolder.h"
|
||||
#include "mozilla/net/PWebSocketChild.h"
|
||||
#include "mozilla/net/BaseWebSocketChannel.h"
|
||||
#include "nsString.h"
|
||||
|
@ -19,7 +20,8 @@ class ChannelEvent;
|
|||
class ChannelEventQueue;
|
||||
|
||||
class WebSocketChannelChild final : public BaseWebSocketChannel,
|
||||
public PWebSocketChild
|
||||
public PWebSocketChild,
|
||||
public NeckoTargetHolder
|
||||
{
|
||||
public:
|
||||
explicit WebSocketChannelChild(bool aSecure);
|
||||
|
@ -63,13 +65,16 @@ class WebSocketChannelChild final : public BaseWebSocketChannel,
|
|||
void OnBinaryMessageAvailable(const nsCString& aMsg);
|
||||
void OnAcknowledge(const uint32_t& aSize);
|
||||
void OnServerClose(const uint16_t& aCode, const nsCString& aReason);
|
||||
void AsyncOpenFailed();
|
||||
void AsyncOpenFailed();
|
||||
|
||||
void DispatchToTargetThread(ChannelEvent *aChannelEvent);
|
||||
bool IsOnTargetThread();
|
||||
|
||||
void MaybeReleaseIPCObject();
|
||||
|
||||
// This function tries to get a labeled event target for |mNeckoTarget|.
|
||||
void SetupNeckoTarget();
|
||||
|
||||
RefPtr<ChannelEventQueue> mEventQ;
|
||||
nsString mEffectiveURL;
|
||||
|
||||
|
|
|
@ -12,8 +12,10 @@
|
|||
namespace mozilla {
|
||||
namespace net {
|
||||
|
||||
WebSocketEventListenerChild::WebSocketEventListenerChild(uint64_t aInnerWindowID)
|
||||
: mService(WebSocketEventService::GetOrCreate())
|
||||
WebSocketEventListenerChild::WebSocketEventListenerChild(uint64_t aInnerWindowID,
|
||||
nsIEventTarget* aTarget)
|
||||
: NeckoTargetHolder(aTarget)
|
||||
, mService(WebSocketEventService::GetOrCreate())
|
||||
, mInnerWindowID(aInnerWindowID)
|
||||
{}
|
||||
|
||||
|
@ -28,8 +30,9 @@ WebSocketEventListenerChild::RecvWebSocketCreated(const uint32_t& aWebSocketSeri
|
|||
const nsCString& aProtocols)
|
||||
{
|
||||
if (mService) {
|
||||
nsCOMPtr<nsIEventTarget> target = GetNeckoTarget();
|
||||
mService->WebSocketCreated(aWebSocketSerialID, mInnerWindowID, aURI,
|
||||
aProtocols);
|
||||
aProtocols, target);
|
||||
}
|
||||
|
||||
return IPC_OK();
|
||||
|
@ -42,8 +45,9 @@ WebSocketEventListenerChild::RecvWebSocketOpened(const uint32_t& aWebSocketSeria
|
|||
const nsCString& aExtensions)
|
||||
{
|
||||
if (mService) {
|
||||
nsCOMPtr<nsIEventTarget> target = GetNeckoTarget();
|
||||
mService->WebSocketOpened(aWebSocketSerialID, mInnerWindowID,
|
||||
aEffectiveURI, aProtocols, aExtensions);
|
||||
aEffectiveURI, aProtocols, aExtensions, target);
|
||||
}
|
||||
|
||||
return IPC_OK();
|
||||
|
@ -55,8 +59,9 @@ WebSocketEventListenerChild::RecvWebSocketMessageAvailable(const uint32_t& aWebS
|
|||
const uint16_t& aMessageType)
|
||||
{
|
||||
if (mService) {
|
||||
nsCOMPtr<nsIEventTarget> target = GetNeckoTarget();
|
||||
mService->WebSocketMessageAvailable(aWebSocketSerialID, mInnerWindowID,
|
||||
aData, aMessageType);
|
||||
aData, aMessageType, target);
|
||||
}
|
||||
|
||||
return IPC_OK();
|
||||
|
@ -69,8 +74,9 @@ WebSocketEventListenerChild::RecvWebSocketClosed(const uint32_t& aWebSocketSeria
|
|||
const nsString& aReason)
|
||||
{
|
||||
if (mService) {
|
||||
nsCOMPtr<nsIEventTarget> target = GetNeckoTarget();
|
||||
mService->WebSocketClosed(aWebSocketSerialID, mInnerWindowID,
|
||||
aWasClean, aCode, aReason);
|
||||
aWasClean, aCode, aReason, target);
|
||||
}
|
||||
|
||||
return IPC_OK();
|
||||
|
@ -81,8 +87,10 @@ WebSocketEventListenerChild::RecvFrameReceived(const uint32_t& aWebSocketSerialI
|
|||
const WebSocketFrameData& aFrameData)
|
||||
{
|
||||
if (mService) {
|
||||
nsCOMPtr<nsIEventTarget> target = GetNeckoTarget();
|
||||
RefPtr<WebSocketFrame> frame = new WebSocketFrame(aFrameData);
|
||||
mService->FrameReceived(aWebSocketSerialID, mInnerWindowID, frame.forget());
|
||||
mService->FrameReceived(aWebSocketSerialID, mInnerWindowID,
|
||||
frame.forget(), target);
|
||||
}
|
||||
|
||||
return IPC_OK();
|
||||
|
@ -93,8 +101,10 @@ WebSocketEventListenerChild::RecvFrameSent(const uint32_t& aWebSocketSerialID,
|
|||
const WebSocketFrameData& aFrameData)
|
||||
{
|
||||
if (mService) {
|
||||
nsCOMPtr<nsIEventTarget> target = GetNeckoTarget();
|
||||
RefPtr<WebSocketFrame> frame = new WebSocketFrame(aFrameData);
|
||||
mService->FrameSent(aWebSocketSerialID, mInnerWindowID, frame.forget());
|
||||
mService->FrameSent(aWebSocketSerialID, mInnerWindowID,
|
||||
frame.forget(), target);
|
||||
}
|
||||
|
||||
return IPC_OK();
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#ifndef mozilla_net_WebSocketEventListenerChild_h
|
||||
#define mozilla_net_WebSocketEventListenerChild_h
|
||||
|
||||
#include "mozilla/net/NeckoTargetHolder.h"
|
||||
#include "mozilla/net/PWebSocketEventListenerChild.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
@ -15,11 +16,13 @@ namespace net {
|
|||
class WebSocketEventService;
|
||||
|
||||
class WebSocketEventListenerChild final : public PWebSocketEventListenerChild
|
||||
, public NeckoTargetHolder
|
||||
{
|
||||
public:
|
||||
NS_INLINE_DECL_REFCOUNTING(WebSocketEventListenerChild)
|
||||
|
||||
explicit WebSocketEventListenerChild(uint64_t aInnerWindowID);
|
||||
explicit WebSocketEventListenerChild(uint64_t aInnerWindowID,
|
||||
nsIEventTarget* aTarget);
|
||||
|
||||
mozilla::ipc::IPCResult RecvWebSocketCreated(const uint32_t& aWebSocketSerialID,
|
||||
const nsString& aURI,
|
||||
|
|
|
@ -245,7 +245,8 @@ void
|
|||
WebSocketEventService::WebSocketCreated(uint32_t aWebSocketSerialID,
|
||||
uint64_t aInnerWindowID,
|
||||
const nsAString& aURI,
|
||||
const nsACString& aProtocols)
|
||||
const nsACString& aProtocols,
|
||||
nsIEventTarget* aTarget)
|
||||
{
|
||||
// Let's continue only if we have some listeners.
|
||||
if (!HasListeners()) {
|
||||
|
@ -255,7 +256,9 @@ WebSocketEventService::WebSocketCreated(uint32_t aWebSocketSerialID,
|
|||
RefPtr<WebSocketCreatedRunnable> runnable =
|
||||
new WebSocketCreatedRunnable(aWebSocketSerialID, aInnerWindowID,
|
||||
aURI, aProtocols);
|
||||
DebugOnly<nsresult> rv = NS_DispatchToMainThread(runnable);
|
||||
DebugOnly<nsresult> rv = aTarget
|
||||
? aTarget->Dispatch(runnable, NS_DISPATCH_NORMAL)
|
||||
: NS_DispatchToMainThread(runnable);
|
||||
NS_WARNING_ASSERTION(NS_SUCCEEDED(rv), "NS_DispatchToMainThread failed");
|
||||
}
|
||||
|
||||
|
@ -264,7 +267,8 @@ WebSocketEventService::WebSocketOpened(uint32_t aWebSocketSerialID,
|
|||
uint64_t aInnerWindowID,
|
||||
const nsAString& aEffectiveURI,
|
||||
const nsACString& aProtocols,
|
||||
const nsACString& aExtensions)
|
||||
const nsACString& aExtensions,
|
||||
nsIEventTarget* aTarget)
|
||||
{
|
||||
// Let's continue only if we have some listeners.
|
||||
if (!HasListeners()) {
|
||||
|
@ -274,7 +278,9 @@ WebSocketEventService::WebSocketOpened(uint32_t aWebSocketSerialID,
|
|||
RefPtr<WebSocketOpenedRunnable> runnable =
|
||||
new WebSocketOpenedRunnable(aWebSocketSerialID, aInnerWindowID,
|
||||
aEffectiveURI, aProtocols, aExtensions);
|
||||
DebugOnly<nsresult> rv = NS_DispatchToMainThread(runnable);
|
||||
DebugOnly<nsresult> rv = aTarget
|
||||
? aTarget->Dispatch(runnable, NS_DISPATCH_NORMAL)
|
||||
: NS_DispatchToMainThread(runnable);
|
||||
NS_WARNING_ASSERTION(NS_SUCCEEDED(rv), "NS_DispatchToMainThread failed");
|
||||
}
|
||||
|
||||
|
@ -282,7 +288,8 @@ void
|
|||
WebSocketEventService::WebSocketMessageAvailable(uint32_t aWebSocketSerialID,
|
||||
uint64_t aInnerWindowID,
|
||||
const nsACString& aData,
|
||||
uint16_t aMessageType)
|
||||
uint16_t aMessageType,
|
||||
nsIEventTarget* aTarget)
|
||||
{
|
||||
// Let's continue only if we have some listeners.
|
||||
if (!HasListeners()) {
|
||||
|
@ -292,7 +299,9 @@ WebSocketEventService::WebSocketMessageAvailable(uint32_t aWebSocketSerialID,
|
|||
RefPtr<WebSocketMessageAvailableRunnable> runnable =
|
||||
new WebSocketMessageAvailableRunnable(aWebSocketSerialID, aInnerWindowID,
|
||||
aData, aMessageType);
|
||||
DebugOnly<nsresult> rv = NS_DispatchToMainThread(runnable);
|
||||
DebugOnly<nsresult> rv = aTarget
|
||||
? aTarget->Dispatch(runnable, NS_DISPATCH_NORMAL)
|
||||
: NS_DispatchToMainThread(runnable);
|
||||
NS_WARNING_ASSERTION(NS_SUCCEEDED(rv), "NS_DispatchToMainThread failed");
|
||||
}
|
||||
|
||||
|
@ -301,7 +310,8 @@ WebSocketEventService::WebSocketClosed(uint32_t aWebSocketSerialID,
|
|||
uint64_t aInnerWindowID,
|
||||
bool aWasClean,
|
||||
uint16_t aCode,
|
||||
const nsAString& aReason)
|
||||
const nsAString& aReason,
|
||||
nsIEventTarget* aTarget)
|
||||
{
|
||||
// Let's continue only if we have some listeners.
|
||||
if (!HasListeners()) {
|
||||
|
@ -311,14 +321,17 @@ WebSocketEventService::WebSocketClosed(uint32_t aWebSocketSerialID,
|
|||
RefPtr<WebSocketClosedRunnable> runnable =
|
||||
new WebSocketClosedRunnable(aWebSocketSerialID, aInnerWindowID,
|
||||
aWasClean, aCode, aReason);
|
||||
DebugOnly<nsresult> rv = NS_DispatchToMainThread(runnable);
|
||||
DebugOnly<nsresult> rv = aTarget
|
||||
? aTarget->Dispatch(runnable, NS_DISPATCH_NORMAL)
|
||||
: NS_DispatchToMainThread(runnable);
|
||||
NS_WARNING_ASSERTION(NS_SUCCEEDED(rv), "NS_DispatchToMainThread failed");
|
||||
}
|
||||
|
||||
void
|
||||
WebSocketEventService::FrameReceived(uint32_t aWebSocketSerialID,
|
||||
uint64_t aInnerWindowID,
|
||||
already_AddRefed<WebSocketFrame> aFrame)
|
||||
already_AddRefed<WebSocketFrame> aFrame,
|
||||
nsIEventTarget* aTarget)
|
||||
{
|
||||
RefPtr<WebSocketFrame> frame(Move(aFrame));
|
||||
MOZ_ASSERT(frame);
|
||||
|
@ -331,14 +344,17 @@ WebSocketEventService::FrameReceived(uint32_t aWebSocketSerialID,
|
|||
RefPtr<WebSocketFrameRunnable> runnable =
|
||||
new WebSocketFrameRunnable(aWebSocketSerialID, aInnerWindowID,
|
||||
frame.forget(), false /* frameSent */);
|
||||
DebugOnly<nsresult> rv = NS_DispatchToMainThread(runnable);
|
||||
DebugOnly<nsresult> rv = aTarget
|
||||
? aTarget->Dispatch(runnable, NS_DISPATCH_NORMAL)
|
||||
: NS_DispatchToMainThread(runnable);
|
||||
NS_WARNING_ASSERTION(NS_SUCCEEDED(rv), "NS_DispatchToMainThread failed");
|
||||
}
|
||||
|
||||
void
|
||||
WebSocketEventService::FrameSent(uint32_t aWebSocketSerialID,
|
||||
uint64_t aInnerWindowID,
|
||||
already_AddRefed<WebSocketFrame> aFrame)
|
||||
already_AddRefed<WebSocketFrame> aFrame,
|
||||
nsIEventTarget* aTarget)
|
||||
{
|
||||
RefPtr<WebSocketFrame> frame(Move(aFrame));
|
||||
MOZ_ASSERT(frame);
|
||||
|
@ -352,7 +368,9 @@ WebSocketEventService::FrameSent(uint32_t aWebSocketSerialID,
|
|||
new WebSocketFrameRunnable(aWebSocketSerialID, aInnerWindowID,
|
||||
frame.forget(), true /* frameSent */);
|
||||
|
||||
DebugOnly<nsresult> rv = NS_DispatchToMainThread(runnable);
|
||||
DebugOnly<nsresult> rv = aTarget
|
||||
? aTarget->Dispatch(runnable, NS_DISPATCH_NORMAL)
|
||||
: NS_DispatchToMainThread(runnable);
|
||||
NS_WARNING_ASSERTION(NS_SUCCEEDED(rv), "NS_DispatchToMainThread failed");
|
||||
}
|
||||
|
||||
|
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче