Merge mozilla-central to inbound. a=merge

This commit is contained in:
Cosmin Sabou 2018-05-09 20:33:16 +03:00
Родитель 8838c85508 a916fb7c3e
Коммит 275db249df
26 изменённых файлов: 298 добавлений и 142 удалений

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

@ -1500,59 +1500,43 @@ option('--enable-gold',
imply_option('--enable-linker', 'gold', when='--enable-gold')
js_option('--enable-linker', nargs=1,
choices=('bfd', 'gold', 'lld', 'other'),
help='Select the linker',
when=is_linker_option_enabled)
@depends('--enable-linker', c_compiler, developer_options,
extra_toolchain_flags, when=is_linker_option_enabled)
@checking('for linker', lambda x: x.KIND)
@imports('os')
@imports('shutil')
def enable_gnu_linker(enable_gold_option, c_compiler, developer_options, build_env,
toolchain_flags, linker_name):
# Used to check the kind of linker
def select_linker(linker, c_compiler, developer_options, toolchain_flags):
linker = linker[0] if linker else 'other'
# Check the kind of linker
version_check = ['-Wl,--version']
cmd_base = c_compiler.wrapper + [c_compiler.compiler] + c_compiler.flags
# Generate the compiler flag
linker_flag = ["-fuse-ld=" + linker] if linker != "other" else []
cmd = cmd_base + linker_flag + version_check
if toolchain_flags:
cmd_base += toolchain_flags
cmd += toolchain_flags
def resolve_gold():
# Try to force the usage of gold
targetDir = os.path.join(build_env.topobjdir, 'build', 'unix', 'gold')
gold_detection_arg = '-print-prog-name=ld.gold'
detection_cmd = cmd_base + [gold_detection_arg]
gold = check_cmd_output(*detection_cmd).strip()
if not gold:
return
goldFullPath = find_program(gold)
if goldFullPath is None:
return
if os.path.exists(targetDir):
shutil.rmtree(targetDir)
os.makedirs(targetDir)
os.symlink(goldFullPath, os.path.join(targetDir, 'ld'))
linker = ['-B', targetDir]
cmd = cmd_base + linker + version_check
if (linker == 'gold' or developer_options) and linker != 'bfd':
if 'GNU gold' in check_cmd_output(*cmd).decode('utf-8'):
# We have detected gold, will build with the -B workaround
# We have detected gold, will build with -fuse-ld=gold
return namespace(
KIND='gold',
LINKER_FLAG=linker,
LINKER_FLAG=linker_flag,
)
else:
# The -B trick didn't work, removing the directory
shutil.rmtree(targetDir)
if (enable_gold_option or developer_options) and linker_name != 'bfd':
result = resolve_gold()
if result:
return result
# gold is only required if --enable-gold is used.
elif enable_gold_option:
if linker == 'gold':
die('Could not find gold')
# Else fallthrough.
cmd = cmd_base + version_check
cmd_output = check_cmd_output(*cmd).decode('utf-8')
# using decode because ld can be localized and python will
# have problems with french accent for example
@ -1568,41 +1552,22 @@ def enable_gnu_linker(enable_gold_option, c_compiler, developer_options, build_e
KIND='gold'
)
if 'LLD' in cmd_output:
return namespace(
KIND='lld',
LINKER_FLAG=linker_flag,
)
elif linker == 'lld':
# We forced the lld linker but could not find the string
# when checking, fail the build
die("Could not use lld as linker")
# For other platforms without gold or the GNU linker
return namespace(
KIND='other'
)
js_option('--enable-linker', nargs=1,
choices=('bfd', 'gold', 'lld', 'other'),
help='Select the linker',
when=is_linker_option_enabled)
@depends('--enable-linker', c_compiler, developer_options, check_build_environment,
extra_toolchain_flags, when=is_linker_option_enabled)
@checking('for linker', lambda x: x.KIND)
def select_linker(linker, c_compiler, developer_options, build_env, toolchain_flags):
linker = linker[0] if linker else 'other'
if linker in ('gold', 'bfd', 'other'):
return enable_gnu_linker(linker == 'gold', c_compiler, developer_options,
build_env, toolchain_flags, linker)
if linker == 'lld':
version_check = ['-Wl,--version']
cmd_base = c_compiler.wrapper + \
[c_compiler.compiler] + c_compiler.flags
lld = ["-fuse-ld=" + linker]
cmd = cmd_base + lld + version_check
if 'LLD' in check_cmd_output(*cmd).decode('utf-8'):
return namespace(
KIND='lld',
LINKER_FLAG=lld,
)
else:
die("Could not use lld as linker")
set_config('LD_IS_BFD', depends(select_linker.KIND)
(lambda x: x == 'bfd' or None))
set_config('LINKER_LDFLAGS', select_linker.LINKER_FLAG)

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

@ -7,7 +7,8 @@
const PropTypes = require("devtools/client/shared/vendor/react-prop-types");
const { Component } = require("devtools/client/shared/vendor/react");
const { a, div, li, ul } = require("devtools/client/shared/vendor/react-dom-factories");
const DOC_URL = "https://developer.mozilla.org/docs/Web/API/Service_Worker_API/Using_Service_Workers";
const DOC_URL = "https://developer.mozilla.org/docs/Web/API/Service_Worker_API/Using_Service_Workers" +
"?utm_source=devtools&utm_medium=sw-panel-blank";
/**
* This component displays help information when no service workers are found for the

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

@ -71,7 +71,7 @@ When working on make the Network Monitor running in the browser tab, you may nee
* [devtools-launchpad](https://github.com/devtools-html/devtools-core/blob/master/packages/devtools-launchpad/#readme) provide the dev server, landing page and the bootstrap functions to run devtools in the browser tab.
* [devtools-modules](https://github.com/devtools-html/devtools-core/blob/master/packages/devtools-modules/#readme) Devtools shared and shim modules.
* [devtools-source-editor](https://github.com/devtools-html/devtools-core/blob/master/packages/devtools-source-editor/#readme) Source Editor component.
* [devtools-reps](https://github.com/devtools-html/devtools-core/blob/master/packages/devtools-reps/#readme) remote object formatter for variables representation.
* [devtools-reps](https://github.com/devtools-html/debugger.html/blob/master/packages/devtools-reps/#readme) remote object formatter for variables representation.
Do `yarn link` modules in related module directory, then do `yarn link [module-name]` after `yarn install` modules.

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

@ -153,6 +153,7 @@ class HeadersPanel extends Component {
member: Object.assign({}, member, { open: false }),
mode: MODE.TINY,
cropLimit: 60,
noGrip: true,
})),
headerDocURL ? MDNLink({
url: headerDocURL,

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

@ -162,6 +162,7 @@ class PropertiesView extends Component {
member: Object.assign({}, member, { open: false }),
mode: MODE.TINY,
cropLimit: this.props.cropLimit,
noGrip: true,
}));
}

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

@ -134,6 +134,7 @@ skip-if = (os == 'linux' && debug && bits == 32) # Bug 1303439
[browser_net_json-null.js]
[browser_net_json-long.js]
[browser_net_json-malformed.js]
[browser_net_json-nogrip.js]
[browser_net_json_custom_mime.js]
[browser_net_json_text_mime.js]
[browser_net_jsonp.js]

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

@ -0,0 +1,38 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
/**
* Tests if JSON responses with property 'type' are correctly rendered.
* (Reps rendering JSON responses should use `noGrip=true`).
*/
add_task(async function() {
let { tab, monitor } = await initNetMonitor(JSON_BASIC_URL + "?name=nogrip");
info("Starting test... ");
let { document, store, windowRequire } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
store.dispatch(Actions.batchEnable(false));
await performRequests(monitor, tab, 1);
let onResponsePanelReady = waitForDOM(document, "#response-panel .CodeMirror-code");
store.dispatch(Actions.toggleNetworkDetails());
EventUtils.sendMouseEvent({ type: "click" },
document.querySelector("#response-tab"));
await onResponsePanelReady;
let tabpanel = document.querySelector("#response-panel");
let labels = tabpanel
.querySelectorAll("tr:not(.tree-section) .treeLabelCell .treeLabel");
let values = tabpanel
.querySelectorAll("tr:not(.tree-section) .treeValueCell .objectBox");
// Verify that an object is rendered: `obj: {…}`
is(labels[0].textContent, "obj", "The first json property name is correct.");
is(values[0].textContent, "{\u2026}", "The first json property value is correct.");
await teardown(monitor);
});

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

@ -18,5 +18,8 @@ function handleRequest(request, response) {
case "null":
response.write("{ \"greeting\": null }");
break;
case "nogrip":
response.write("{\"obj\": {\"type\": \"string\" }}");
break;
}
}

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

@ -1,7 +1,7 @@
Reps are now maintained on GitHub at: https://github.com/devtools-html/devtools-core/tree/master/packages/devtools-reps
Reps are now maintained on GitHub at: https://github.com/devtools-html/debugger.html/tree/master/packages/devtools-reps
All the files in this folder are copied from the devtools-core github repository and
All the files in this folder are copied from the debugger.html github repository and
should not be modified here.
For any issue or feature request on Reps, please log an issue at
https://github.com/devtools-html/devtools-core/issues with the label "Reps".
https://github.com/devtools-html/debugger.html/issues with the label "devtools-reps".

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

@ -28,6 +28,11 @@ class Draggable extends Component {
}
startDragging(ev) {
if (this.isDragging) {
return;
}
this.isDragging = true;
ev.preventDefault();
const doc = ReactDOM.findDOMNode(this).ownerDocument;
doc.addEventListener("mousemove", this.onMove);
@ -36,6 +41,10 @@ class Draggable extends Component {
}
onMove(ev) {
if (!this.isDragging) {
return;
}
ev.preventDefault();
// Use viewport coordinates so, moving mouse over iframes
// doesn't mangle (relative) coordinates.
@ -43,6 +52,11 @@ class Draggable extends Component {
}
onUp(ev) {
if (!this.isDragging) {
return;
}
this.isDragging = false;
ev.preventDefault();
const doc = ReactDOM.findDOMNode(this).ownerDocument;
doc.removeEventListener("mousemove", this.onMove);

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

@ -1,12 +1,12 @@
devtools-source-map is maintained on GitHub at:
https://github.com/devtools-html/devtools-core/tree/master/packages/devtools-source-map
https://github.com/devtools-html/debugger.html/tree/master/packages/devtools-source-map
All the files in this folder are copied from the above repository and
should not be modified here.
For any issue or feature request on devtools-source-map, please log an issue at:
https://github.com/devtools-html/devtools-core/issues
https://github.com/devtools-html/debugger.html/issues
and label it with "source-map".
and label it with "devtools-source-map".

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

@ -73,7 +73,7 @@ Besides the third party modules, here are modules required for the WebConsole
* [devtools-launchpad](https://github.com/devtools-html/devtools-core/blob/master/packages/devtools-launchpad/#readme) provide the dev server, landing page and the bootstrap functions to run devtools in the browser tab.
* [devtools-modules](https://github.com/devtools-html/devtools-core/blob/master/packages/devtools-modules/#readme) Devtools shared and shim modules.
* [devtools-source-editor](https://github.com/devtools-html/devtools-core/blob/master/packages/devtools-source-editor/#readme) Source Editor component.
* [devtools-reps](https://github.com/devtools-html/devtools-core/blob/master/packages/devtools-reps/#readme) remote object formatter for variables representation.
* [devtools-reps](https://github.com/devtools-html/debugger.html/blob/master/packages/devtools-reps/#readme) remote object formatter for variables representation.
Changes to those modules need to be done on Github, using the Pull Request workflow.
Then, a new version of the modified package need to be released on npm so the version number

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

@ -653,6 +653,7 @@ EventStateManager::PreHandleEvent(nsPresContext* aPresContext,
if (Prefs::ClickHoldContextMenu()) {
KillClickHoldTimer();
}
mInTouchDrag = false;
StopTrackingDragGesture();
sNormalLMouseEventInProcess = false;
// then fall through...

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

@ -305,6 +305,8 @@ HTMLEditor::ShowGrabber(Element& aElement)
mGrabber = CreateGrabber(*parentContent);
NS_ENSURE_TRUE(mGrabber, NS_ERROR_FAILURE);
mHasShownGrabber = true;
// and set its position
return RefreshGrabber();
}

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

@ -11,6 +11,7 @@
#include "mozilla/EditorDOMPoint.h"
#include "mozilla/EventStates.h"
#include "mozilla/mozInlineSpellChecker.h"
#include "mozilla/Telemetry.h"
#include "mozilla/TextEvents.h"
#include "nsCRT.h"
@ -103,15 +104,18 @@ HTMLEditor::HTMLEditor()
: mCRInParagraphCreatesParagraph(false)
, mCSSAware(false)
, mSelectedCellIndex(0)
, mHasShownResizers(false)
, mIsObjectResizingEnabled(true)
, mIsResizing(false)
, mPreserveRatio(false)
, mResizedObjectIsAnImage(false)
, mIsAbsolutelyPositioningEnabled(true)
, mResizedObjectIsAbsolutelyPositioned(false)
, mHasShownGrabber(false)
, mGrabberClicked(false)
, mIsMoving(false)
, mSnapToGridEnabled(false)
, mHasShownInlineTableEditor(false)
, mIsInlineTableEditingEnabled(true)
, mOriginalX(0)
, mOriginalY(0)
@ -127,6 +131,9 @@ HTMLEditor::HTMLEditor()
, mYIncrementFactor(0)
, mWidthIncrementFactor(0)
, mHeightIncrementFactor(0)
, mResizerUsedCount(0)
, mGrabberUsedCount(0)
, mInlineTableEditorUsedCount(0)
, mInfoXIncrement(20)
, mInfoYIncrement(20)
, mPositionedObjectX(0)
@ -164,6 +171,31 @@ HTMLEditor::~HTMLEditor()
RemoveEventListeners();
HideAnonymousEditingUIs();
Telemetry::Accumulate(
Telemetry::HTMLEDITORS_WITH_RESIZERS,
mHasShownResizers ? 1 : 0);
if (mHasShownResizers) {
Telemetry::Accumulate(
Telemetry::HTMLEDITORS_WHOSE_RESIZERS_USED_BY_USER,
mResizerUsedCount);
}
Telemetry::Accumulate(
Telemetry::HTMLEDITORS_WITH_ABSOLUTE_POSITIONER,
mHasShownGrabber ? 1 : 0);
if (mHasShownGrabber) {
Telemetry::Accumulate(
Telemetry::HTMLEDITORS_WHOSE_ABSOLUTE_POSITIONER_USED_BY_USER,
mGrabberUsedCount);
}
Telemetry::Accumulate(
Telemetry::HTMLEDITORS_WITH_INLINE_TABLE_EDITOR,
mHasShownInlineTableEditor ? 1 : 0);
if (mHasShownInlineTableEditor) {
Telemetry::Accumulate(
Telemetry::HTMLEDITORS_WHOSE_INLINE_TABLE_EDITOR_USED_BY_USER,
mInlineTableEditorUsedCount);
}
}
void

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

@ -1282,6 +1282,9 @@ protected:
void UpdateRootElement();
// resizing
// If the instance has shown resizers at least once, mHasShownResizers is
// set to true.
bool mHasShownResizers;
bool mIsObjectResizingEnabled;
bool mIsResizing;
bool mPreserveRatio;
@ -1290,13 +1293,18 @@ protected:
// absolute positioning
bool mIsAbsolutelyPositioningEnabled;
bool mResizedObjectIsAbsolutelyPositioned;
// If the instance has shown grabber at least once, mHasShownGrabber is
// set to true.
bool mHasShownGrabber;
bool mGrabberClicked;
bool mIsMoving;
bool mSnapToGridEnabled;
// inline table editing
// If the instance has shown inline table editor at least once,
// mHasShownInlineTableEditor is set to true.
bool mHasShownInlineTableEditor;
bool mIsInlineTableEditingEnabled;
// resizing
@ -1337,6 +1345,12 @@ protected:
int32_t mWidthIncrementFactor;
int32_t mHeightIncrementFactor;
// When resizers, grabber and/or inline table editor are operated by user
// actually, the following counters are increased.
uint32_t mResizerUsedCount;
uint32_t mGrabberUsedCount;
uint32_t mInlineTableEditorUsedCount;
int8_t mInfoXIncrement;
int8_t mInfoYIncrement;

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

@ -350,6 +350,8 @@ HTMLEditor::ShowResizersInner(Element& aResizedElement)
MOZ_ASSERT(mResizedObject == &aResizedElement);
mHasShownResizers = true;
return NS_OK;
}
@ -525,7 +527,7 @@ HTMLEditor::OnMouseDown(int32_t aClientX,
// If we have an anonymous element and that element is a resizer,
// let's start resizing!
aEvent->PreventDefault();
mResizerUsedCount++;
mOriginalX = aClientX;
mOriginalY = aClientY;
return StartResizing(aTarget);
@ -534,6 +536,7 @@ HTMLEditor::OnMouseDown(int32_t aClientX,
if (anonclass.EqualsLiteral("mozGrabber")) {
// If we have an anonymous element and that element is a grabber,
// let's start moving the element!
mGrabberUsedCount++;
mOriginalX = aClientX;
mOriginalY = aClientY;
return GrabberClicked();

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

@ -88,6 +88,9 @@ HTMLEditor::ShowInlineTableEditingUI(Element* aCell)
AddMouseClickListener(mAddRowAfterButton);
mInlineEditedCell = aCell;
mHasShownInlineTableEditor = true;
return RefreshInlineTableEditingUI();
}
@ -159,6 +162,8 @@ HTMLEditor::DoInlineTableEditingAction(const Element& aElement)
return NS_OK;
}
++mInlineTableEditorUsedCount;
// InsertTableRow might causes reframe
if (Destroyed()) {
return NS_OK;

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

@ -2175,6 +2175,9 @@ pref("network.cookie.lifetime.days", 90); // Ignored unless network.cooki
// Set to 0 to disable moving the cookies.
pref("network.cookie.move.interval_sec", 10);
pref("network.cookie.maxNumber", 3000);
pref("network.cookie.maxPerHost", 180);
// The PAC file to load. Ignored unless network.proxy.type is 2.
pref("network.proxy.autoconfig_url", "");
// Strip off paths when sending URLs to PAC scripts

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

@ -115,7 +115,7 @@ static const int64_t kCookiePurgeAge =
// default limits for the cookie list. these can be tuned by the
// network.cookie.maxNumber and network.cookie.maxPerHost prefs respectively.
static const uint32_t kMaxNumberOfCookies = 3000;
static const uint32_t kMaxCookiesPerHost = 150;
static const uint32_t kMaxCookiesPerHost = 180;
static const uint32_t kMaxBytesPerCookie = 4096;
static const uint32_t kMaxBytesPerPath = 1024;

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

@ -659,6 +659,7 @@ class TupBackend(CommonBackend):
inputs=full_inputs,
outputs=outputs,
extra_outputs=extra_outputs,
check_unchanged=True,
)
def _process_defines(self, backend_file, obj, host=False):
@ -819,6 +820,7 @@ class TupBackend(CommonBackend):
cmd=cmd,
outputs=outputs,
extra_outputs=[self._installed_files],
check_unchanged=True,
)
cpp_backend_file = self._get_backend_file('xpcom/reflect/xptinfo')
@ -834,6 +836,7 @@ class TupBackend(CommonBackend):
'%f',
],
outputs=['xptdata.cpp'],
check_unchanged=True,
)
def _preprocess(self, backend_file, input_file, destdir=None, target=None):
@ -858,6 +861,7 @@ class TupBackend(CommonBackend):
display='Preprocess %o',
cmd=cmd,
outputs=[output],
check_unchanged=True,
)
def _handle_ipdl_sources(self, ipdl_dir, sorted_ipdl_sources, sorted_nonstatic_ipdl_sources,

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

@ -397258,9 +397258,7 @@
"webdriver/tests/execute_script/json_serialize_windowproxy.py": [
[
"/webdriver/tests/execute_script/json_serialize_windowproxy.py",
{
"timeout": "long"
}
{}
]
],
"webdriver/tests/execute_script/user_prompts.py": [
@ -611509,7 +611507,7 @@
"wdspec"
],
"webdriver/tests/close_window/user_prompts.py": [
"59647d3670644c730485cd918f764b9db016e6b7",
"7b1255736f8772f5790b9bf1e46cbf1c5b1c2dee",
"wdspec"
],
"webdriver/tests/conftest.py": [
@ -611549,7 +611547,7 @@
"support"
],
"webdriver/tests/element_click/bubbling.py": [
"46fb2d0359f5f90eec4cc1f06d2591b5fd2fdf78",
"492e283b686abe0743d72e31017be149726628f9",
"wdspec"
],
"webdriver/tests/element_click/select.py": [
@ -611557,7 +611555,7 @@
"wdspec"
],
"webdriver/tests/element_click/stale.py": [
"b9f503108f99d4a87784590b69bb2ad6a23c4ac8",
"490b6c17365c5eab24fd4a7ac07be6614a86a934",
"wdspec"
],
"webdriver/tests/element_send_keys/__init__.py": [
@ -611573,11 +611571,11 @@
"wdspec"
],
"webdriver/tests/element_send_keys/interactability.py": [
"485bd25ba5e1d8c8a646675d0738f278291c7c70",
"5374827c90845ded660d540d23bb7e07ac84e445",
"wdspec"
],
"webdriver/tests/element_send_keys/scroll_into_view.py": [
"b58404e8bb2c8b0cc75300ed1880cfeeb052a364",
"e4a50a53a13c1ab76c6c002bbda1c103f8c32ccf",
"wdspec"
],
"webdriver/tests/execute_async_script/__init__.py": [
@ -611605,7 +611603,7 @@
"wdspec"
],
"webdriver/tests/execute_script/json_serialize_windowproxy.py": [
"00e735d58b77e9fac207c5ea29e0e70ff43ffd14",
"20db10d82ed2b28a22674fcdc37cac0323d33c95",
"wdspec"
],
"webdriver/tests/execute_script/user_prompts.py": [

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

@ -1,3 +0,0 @@
[get.py]
disabled:
if os == "linux": https://bugzilla.mozilla.org/show_bug.cgi?id=1429391

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

@ -441,9 +441,10 @@ var History = Object.freeze({
* @param filter: An object containing a non empty subset of the following
* properties:
* - host: (string)
* Hostname with subhost wildcard (at most one *), or empty for local files.
* The * can be used only if it is the first character in the url, and not the host.
* For example, *.mozilla.org is allowed, *.org, www.*.org or * is not allowed.
* Hostname with or without subhost. Examples:
* "mozilla.org" removes pages from mozilla.org but not its subdomains
* ".mozilla.org" removes pages from mozilla.org and its subdomains
* "." removes local files
* - beginDate: (Date)
* The first time the page was visited (inclusive)
* - endDate: (Date)
@ -467,12 +468,21 @@ var History = Object.freeze({
throw new TypeError("Expected a filter object");
}
let hasHost = "host" in filter;
let hasHost = filter.host;
if (hasHost) {
if (typeof filter.host !== "string") {
throw new TypeError("`host` should be a string");
}
filter.host = filter.host.toLowerCase();
if (filter.host.length > 1 && filter.host.lastIndexOf(".") == 0) {
// The input contains only an initial period, thus it may be a
// wildcarded local host, like ".localhost". Ideally the consumer should
// pass just "localhost", because there is no concept of subhosts for
// it, but we are being more lenient to allow for simpler input.
// Anyway, in this case we remove the wildcard to avoid clearing too
// much if the consumer wrongly passes in things like ".com".
filter.host = filter.host.slice(1);
}
}
let hasBeginDate = "beginDate" in filter;
@ -493,14 +503,11 @@ var History = Object.freeze({
throw new TypeError("Expected a non-empty filter");
}
// Host should follow one of these formats
// The first one matches `localhost` or any other custom set in hostsfile
// The second one matches *.mozilla.org or mozilla.com etc
// The third one is for local files
// Check the host format.
// Either it has no dots, or has multiple dots, or it's a single dot char.
if (hasHost &&
!((/^[a-z0-9-]+$/).test(filter.host)) &&
!((/^(\*\.)?([a-z0-9-]+)(\.[a-z0-9-]+)+$/).test(filter.host)) &&
(filter.host !== "")) {
(!/^(\.?([.a-z0-9-]+\.[a-z0-9-]+)?|[a-z0-9-]+)$/.test(filter.host) ||
filter.host.includes(".."))) {
throw new TypeError("Expected well formed hostname string for `host` with atmost 1 wildcard.");
}
@ -1145,24 +1152,24 @@ var removeByFilter = async function(db, filter, onResult = null) {
// 2. Create fragment for host and subhost filtering
let hostFilterSQLFragment = "";
if (filter.host || filter.host === "") {
// There are four cases that we need to consider,
// mozilla.org, *.mozilla.org, localhost, and local files
if (filter.host.indexOf("*") === 0) {
// Case 1: subhost wildcard is specified (*.mozilla.org)
let revHost = filter.host.slice(2).split("").reverse().join("");
if (filter.host) {
// There are four cases that we need to consider:
// mozilla.org, .mozilla.org, localhost, and local files
let revHost = filter.host.split("").reverse().join("");
if (filter.host == ".") {
// Local files.
hostFilterSQLFragment = `h.rev_host = :revHost`;
} else if (filter.host.startsWith(".")) {
// Remove the subhost wildcard.
revHost = revHost.slice(0, -1);
hostFilterSQLFragment =
`h.rev_host between :revHostStart and :revHostEnd`;
params.revHostStart = revHost + ".";
params.revHostEnd = revHost + "/";
`h.rev_host between :revHost || "." and :revHost || "/"`;
} else {
// This covers the rest (mozilla.org, localhost and local files)
let revHost = filter.host.split("").reverse().join("") + ".";
// This covers non-wildcarded hosts (e.g.: mozilla.org, localhost)
hostFilterSQLFragment =
`h.rev_host = :hostName`;
params.hostName = revHost;
`h.rev_host = :revHost || "."`;
}
params.revHost = revHost;
}
// 3. Find out what needs to be removed

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

@ -1,22 +1,23 @@
"use strict";
/* This test will ideally test the following cases
(each with and without a callback associated with it)
* Case A: Tests which should remove pages (Positives)
* Case A 1: Page has multiple visits both in/out of timeframe, all get deleted
* Case A 2: Page has single uri, removed by host
* Case A 3: Page has random subhost, with same host, removed by wildcard
* Case A 4: Page is localhost and localhost:port, removed by host
* Case A 5: Page is a `file://` type address, removed by empty host
* Cases A 1,2,3 will be tried with and without bookmarks added (which prevent page deletion)
* Case B: Tests in which no pages are removed (Inverses)
* Case B 1 (inverse): Page has no visits in timeframe, and nothing is deleted
* Case B 2: Page has single uri, not removed since hostname is different
* Case B 3: Page has multiple subhosts, not removed since wildcard doesn't match
* Case C: Combinations tests
* Case C 1: Single hostname, multiple visits, at least one in timeframe and hostname
* Case C 2: Random subhosts, multiple visits, at least one in timeframe and hostname-wildcard
*/
/*
This test will ideally test the following cases
(each with and without a callback associated with it)
Case A: Tests which should remove pages (Positives)
Case A 1: Page has multiple visits both in/out of timeframe, all get deleted
Case A 2: Page has single uri, removed by host
Case A 3: Page has random subhost, with same host, removed by wildcard
Case A 4: Page is localhost and localhost:port, removed by host
Case A 5: Page is a `file://` type address, removed by empty host
Cases A 1,2,3 will be tried with and without bookmarks added (which prevent page deletion)
Case B: Tests in which no pages are removed (Inverses)
Case B 1 (inverse): Page has no visits in timeframe, and nothing is deleted
Case B 2: Page has single uri, not removed since hostname is different
Case B 3: Page has multiple subhosts, not removed since wildcard doesn't match
Case C: Combinations tests
Case C 1: Single hostname, multiple visits, at least one in timeframe and hostname
Case C 2: Random subhosts, multiple visits, at least one in timeframe and hostname-wildcard
*/
add_task(async function test_removeByFilter() {
// Cleanup
@ -155,7 +156,7 @@ add_task(async function test_removeByFilter() {
() => checkClosure(remoteUriList[0]),
callbackUse, bookmarkedUri(remoteUriList));
// Case A 3: Multiple subhost
await removeByFilterTester(randomHostVisits, { host: "*.mozilla.org" },
await removeByFilterTester(randomHostVisits, { host: ".mozilla.org" },
async () => { for (let uri of remoteUriList) await assertInDB(uri); },
async () => { for (let uri of checkableArray(remoteUriList)) await checkClosure(uri); },
callbackUse, bookmarkedUri(remoteUriList));
@ -167,7 +168,7 @@ add_task(async function test_removeByFilter() {
async () => { for (let uri of localhostUriList) await assertNotInDB(uri); },
callbackUse);
// Case A 5: Local Files
await removeByFilterTester(fileVisits, { host: "" },
await removeByFilterTester(fileVisits, { host: "." },
async () => { for (let uri of fileUriList) await assertInDB(uri); },
async () => { for (let uri of fileUriList) await assertNotInDB(uri); },
callbackUse);
@ -185,7 +186,12 @@ add_task(async function test_removeByFilter() {
() => assertInDB(remoteUriList[0]),
callbackUse);
// Case B 3 : Multiple subhosts
await removeByFilterTester(randomHostVisits, { host: "*.notthere.org" },
await removeByFilterTester(randomHostVisits, { host: ".notthere.org" },
async () => { for (let uri of remoteUriList) await assertInDB(uri); },
async () => { for (let uri of remoteUriList) await assertInDB(uri); },
callbackUse);
// Case B 4 : invalid local subhost
await removeByFilterTester(randomHostVisits, { host: ".org" },
async () => { for (let uri of remoteUriList) await assertInDB(uri); },
async () => { for (let uri of remoteUriList) await assertInDB(uri); },
callbackUse);
@ -201,7 +207,7 @@ add_task(async function test_removeByFilter() {
callbackUse);
// Case C 2: multiple subhost
await removeByFilterTester(randomHostVisits,
{ host: "*.mozilla.org",
{ host: ".mozilla.org",
beginDate: new Date(2005, 1, 1),
endDate: new Date(2017, 1, 1) },
async () => { for (let uri of remoteUriList) await assertInDB(uri); },
@ -246,11 +252,7 @@ add_task(async function test_error_cases() {
/TypeError: Expected well formed hostname string for/
);
Assert.throws(
() => PlacesUtils.history.removeByFilter({host: "*.org"}),
/TypeError: Expected well formed hostname string for/
);
Assert.throws(
() => PlacesUtils.history.removeByFilter({host: "www.*.org"}),
() => PlacesUtils.history.removeByFilter({host: "www..org"}),
/TypeError: Expected well formed hostname string for/
);
Assert.throws(
@ -258,7 +260,7 @@ add_task(async function test_error_cases() {
/TypeError: `host` should be a string/
);
Assert.throws(
() => PlacesUtils.history.removeByFilter({host: ".mozilla.org"}),
() => PlacesUtils.history.removeByFilter({host: "*.mozilla.org"}),
/TypeError: Expected well formed hostname string for/
);
Assert.throws(
@ -273,6 +275,10 @@ add_task(async function test_error_cases() {
() => PlacesUtils.history.removeByFilter({host: "(local files)"}),
/TypeError: Expected well formed hostname string for/
);
Assert.throws(
() => PlacesUtils.history.removeByFilter({host: ""}),
/TypeError: Expected a non-empty filter/
);
});
// Helper functions

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

@ -13842,5 +13842,65 @@
"kind": "boolean",
"keyed": true,
"description": "Permission requests (showing a permission prompt) by whether they were requested from code handling a user input event."
},
"HTMLEDITORS_WITH_RESIZERS": {
"record_in_processes": ["content"],
"alert_emails": ["mnakano@mozilla.com"],
"bug_numbers": [1452538,1449564],
"expires_in_version": "65",
"kind": "boolean",
"releaseChannelCollection": "opt-out",
"description": "Number of HTML editors which has shown object resizers."
},
"HTMLEDITORS_WHOSE_RESIZERS_USED_BY_USER": {
"record_in_processes": ["content"],
"alert_emails": ["mnakano@mozilla.com"],
"bug_numbers": [1452538,1449564],
"expires_in_version": "65",
"kind": "linear",
"high": 50,
"n_buckets": 20,
"releaseChannelCollection": "opt-out",
"description": "Number of HTML editors whose object resizers are actually used by users."
},
"HTMLEDITORS_WITH_ABSOLUTE_POSITIONER": {
"record_in_processes": ["content"],
"alert_emails": ["mnakano@mozilla.com"],
"bug_numbers": [1452538,1449564],
"expires_in_version": "65",
"kind": "boolean",
"releaseChannelCollection": "opt-out",
"description": "Number of HTML editors which has shown grabber to move absolute positioned elements."
},
"HTMLEDITORS_WHOSE_ABSOLUTE_POSITIONER_USED_BY_USER": {
"record_in_processes": ["content"],
"alert_emails": ["mnakano@mozilla.com"],
"bug_numbers": [1452538,1449564],
"expires_in_version": "65",
"kind": "linear",
"high": 50,
"n_buckets": 20,
"releaseChannelCollection": "opt-out",
"description": "Number of HTML editors whose grabber to move absolute positioned elements is actually used by users."
},
"HTMLEDITORS_WITH_INLINE_TABLE_EDITOR": {
"record_in_processes": ["content"],
"alert_emails": ["mnakano@mozilla.com"],
"bug_numbers": [1452538,1449564],
"expires_in_version": "65",
"kind": "boolean",
"releaseChannelCollection": "opt-out",
"description": "Number of HTML editors which has shown inline table editing UI."
},
"HTMLEDITORS_WHOSE_INLINE_TABLE_EDITOR_USED_BY_USER": {
"record_in_processes": ["content"],
"alert_emails": ["mnakano@mozilla.com"],
"bug_numbers": [1452538,1449564],
"expires_in_version": "65",
"kind": "linear",
"high": 50,
"n_buckets": 20,
"releaseChannelCollection": "opt-out",
"description": "Number of HTML editors whose inline table editing UI is actually used by users."
}
}