mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 03:15:11 +00:00
Merge inbound to mozilla-central. a=merge
This commit is contained in:
commit
d5c5369355
@ -1041,10 +1041,11 @@ pref("security.sandbox.windows.log.stackTraceDepth", 0);
|
||||
// security/sandbox/win/src/sandboxbroker/sandboxBroker.cpp
|
||||
pref("security.sandbox.gpu.level", 0);
|
||||
|
||||
// Controls whether we disable win32k for the GMP processes.
|
||||
// Controls whether we disable win32k for the processes.
|
||||
// true means that win32k system calls are not permitted.
|
||||
// Note: win32k is currently _not_ disabled due to intermittent test failures,
|
||||
// where the GMP process fails very early. See bug 1449348.
|
||||
pref("security.sandbox.rdd.win32k-disable", true);
|
||||
// Note: win32k is currently _not_ disabled for GMP due to intermittent test
|
||||
// failures, where the GMP process fails very early. See bug 1449348.
|
||||
pref("security.sandbox.gmp.win32k-disable", false);
|
||||
#endif
|
||||
|
||||
|
@ -1022,9 +1022,20 @@ endif
|
||||
# We need to run cargo unconditionally, because cargo is the only thing that
|
||||
# has full visibility into how changes in Rust sources might affect the final
|
||||
# build.
|
||||
#
|
||||
# When we are building in --enable-release mode; we add an additional check to confirm
|
||||
# that we are not importing any networking-related functions in rust code. This reduces
|
||||
# the chance of proxy bypasses originating from rust code.
|
||||
force-cargo-library-build:
|
||||
$(REPORT_BUILD)
|
||||
$(call CARGO_BUILD,$(target_cargo_env_vars)) --lib $(cargo_target_flag) $(rust_features_flag) -- $(cargo_rustc_flags)
|
||||
ifndef DEVELOPER_OPTIONS
|
||||
ifndef MOZ_DEBUG_RUST
|
||||
ifeq ($(OS_ARCH), Linux)
|
||||
$(call py_action,check_binary,--target --networking $(RUST_LIBRARY_FILE))
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
$(RUST_LIBRARY_FILE): force-cargo-library-build
|
||||
|
||||
|
@ -19,6 +19,9 @@ createEnum([
|
||||
// Toggles on or off the given pseudo class value for the current selected element.
|
||||
"TOGGLE_PSEUDO_CLASS",
|
||||
|
||||
// Updates whether or not the add new rule button should be enabled.
|
||||
"UPDATE_ADD_RULE_ENABLED",
|
||||
|
||||
// Updates the entire class list state with the new list of classes.
|
||||
"UPDATE_CLASSES",
|
||||
|
||||
|
@ -5,12 +5,26 @@
|
||||
"use strict";
|
||||
|
||||
const {
|
||||
UPDATE_ADD_RULE_ENABLED,
|
||||
UPDATE_HIGHLIGHTED_SELECTOR,
|
||||
UPDATE_RULES,
|
||||
} = require("./index");
|
||||
|
||||
module.exports = {
|
||||
|
||||
/**
|
||||
* Updates whether or not the add new rule button should be enabled.
|
||||
*
|
||||
* @param {Boolean} enabled
|
||||
* Whether or not the add new rule button is enabled.
|
||||
*/
|
||||
updateAddRuleEnabled(enabled) {
|
||||
return {
|
||||
type: UPDATE_ADD_RULE_ENABLED,
|
||||
enabled,
|
||||
};
|
||||
},
|
||||
|
||||
/**
|
||||
* Updates the highlighted selector.
|
||||
*
|
||||
|
@ -29,6 +29,7 @@ class RulesApp extends PureComponent {
|
||||
static get propTypes() {
|
||||
return {
|
||||
onAddClass: PropTypes.func.isRequired,
|
||||
onAddRule: PropTypes.func.isRequired,
|
||||
onSetClassState: PropTypes.func.isRequired,
|
||||
onToggleClassPanelExpanded: PropTypes.func.isRequired,
|
||||
onToggleDeclaration: PropTypes.func.isRequired,
|
||||
@ -175,6 +176,7 @@ class RulesApp extends PureComponent {
|
||||
},
|
||||
Toolbar({
|
||||
onAddClass: this.props.onAddClass,
|
||||
onAddRule: this.props.onAddRule,
|
||||
onSetClassState: this.props.onSetClassState,
|
||||
onToggleClassPanelExpanded: this.props.onToggleClassPanelExpanded,
|
||||
onTogglePseudoClass: this.props.onTogglePseudoClass,
|
||||
|
@ -23,8 +23,10 @@ const { getStr } = require("../utils/l10n");
|
||||
class Toolbar extends PureComponent {
|
||||
static get propTypes() {
|
||||
return {
|
||||
isAddRuleEnabled: PropTypes.bool.isRequired,
|
||||
isClassPanelExpanded: PropTypes.bool.isRequired,
|
||||
onAddClass: PropTypes.func.isRequired,
|
||||
onAddRule: PropTypes.func.isRequired,
|
||||
onSetClassState: PropTypes.func.isRequired,
|
||||
onToggleClassPanelExpanded: PropTypes.func.isRequired,
|
||||
onTogglePseudoClass: PropTypes.func.isRequired,
|
||||
@ -39,10 +41,16 @@ class Toolbar extends PureComponent {
|
||||
isPseudoClassPanelExpanded: false,
|
||||
};
|
||||
|
||||
this.onAddRuleClick = this.onAddRuleClick.bind(this);
|
||||
this.onClassPanelToggle = this.onClassPanelToggle.bind(this);
|
||||
this.onPseudoClassPanelToggle = this.onPseudoClassPanelToggle.bind(this);
|
||||
}
|
||||
|
||||
onAddRuleClick(event) {
|
||||
event.stopPropagation();
|
||||
this.props.onAddRule();
|
||||
}
|
||||
|
||||
onClassPanelToggle(event) {
|
||||
event.stopPropagation();
|
||||
|
||||
@ -70,7 +78,7 @@ class Toolbar extends PureComponent {
|
||||
}
|
||||
|
||||
render() {
|
||||
const { isClassPanelExpanded } = this.props;
|
||||
const { isAddRuleEnabled, isClassPanelExpanded } = this.props;
|
||||
const { isPseudoClassPanelExpanded } = this.state;
|
||||
|
||||
return (
|
||||
@ -85,6 +93,8 @@ class Toolbar extends PureComponent {
|
||||
dom.button({
|
||||
id: "ruleview-add-rule-button",
|
||||
className: "devtools-button",
|
||||
disabled: !isAddRuleEnabled,
|
||||
onClick: this.onAddRuleClick,
|
||||
title: getStr("rule.addRule.tooltip"),
|
||||
}),
|
||||
dom.button({
|
||||
@ -123,6 +133,7 @@ class Toolbar extends PureComponent {
|
||||
|
||||
const mapStateToProps = state => {
|
||||
return {
|
||||
isAddRuleEnabled: state.rules.isAddRuleEnabled,
|
||||
isClassPanelExpanded: state.classList.isClassPanelExpanded,
|
||||
};
|
||||
};
|
||||
|
@ -52,6 +52,12 @@ function ElementStyle(element, ruleView, store, pageStyle, showUserAgentStyles)
|
||||
if (!("disabled" in this.store)) {
|
||||
this.store.disabled = new WeakMap();
|
||||
}
|
||||
|
||||
this.onStyleSheetUpdated = this.onStyleSheetUpdated.bind(this);
|
||||
|
||||
if (this.ruleView.isNewRulesView) {
|
||||
this.pageStyle.on("stylesheet-updated", this.onStyleSheetUpdated);
|
||||
}
|
||||
}
|
||||
|
||||
ElementStyle.prototype = {
|
||||
@ -67,6 +73,10 @@ ElementStyle.prototype = {
|
||||
rule.editor.destroy();
|
||||
}
|
||||
}
|
||||
|
||||
if (this.ruleView.isNewRulesView) {
|
||||
this.pageStyle.off("stylesheet-updated", this.onStyleSheetUpdated);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
@ -334,6 +344,15 @@ ElementStyle.prototype = {
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Adds a new rule. The rules view is updated from a "stylesheet-updated" event
|
||||
* emitted the PageStyleActor as a result of the rule being inserted into the
|
||||
* the stylesheet.
|
||||
*/
|
||||
async addNewRule() {
|
||||
await this.pageStyle.addNewRule(this.element, this.element.pseudoClassLocks);
|
||||
},
|
||||
|
||||
/**
|
||||
* Given the id of the rule and the new declaration name, modifies the existing
|
||||
* declaration name to the new given value.
|
||||
@ -593,6 +612,24 @@ ElementStyle.prototype = {
|
||||
getVariable: function(name) {
|
||||
return this.variables.get(name);
|
||||
},
|
||||
|
||||
/**
|
||||
* Handler for page style events "stylesheet-updated". Refreshes the list of rules on
|
||||
* the page.
|
||||
*/
|
||||
onStyleSheetUpdated: async function() {
|
||||
// Repopulate the element style once the current modifications are done.
|
||||
const promises = [];
|
||||
for (const rule of this.rules) {
|
||||
if (rule._applyingModifications) {
|
||||
promises.push(rule._applyingModifications);
|
||||
}
|
||||
}
|
||||
|
||||
await Promise.all(promises);
|
||||
await this.populate();
|
||||
this._changed();
|
||||
},
|
||||
};
|
||||
|
||||
module.exports = ElementStyle;
|
||||
|
@ -561,7 +561,11 @@ Rule.prototype = {
|
||||
// style attribute.
|
||||
if (this.domRule.type === ELEMENT_STYLE) {
|
||||
this.textProps = newTextProps;
|
||||
this.editor.populate(true);
|
||||
|
||||
if (this.editor) {
|
||||
this.editor.populate(true);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -20,6 +20,7 @@ const {
|
||||
togglePseudoClass,
|
||||
} = require("./actions/pseudo-classes");
|
||||
const {
|
||||
updateAddRuleEnabled,
|
||||
updateHighlightedSelector,
|
||||
updateRules,
|
||||
} = require("./actions/rules");
|
||||
@ -47,10 +48,12 @@ class RulesView {
|
||||
this.store = inspector.store;
|
||||
this.telemetry = inspector.telemetry;
|
||||
this.toolbox = inspector.toolbox;
|
||||
this.isNewRulesView = true;
|
||||
|
||||
this.showUserAgentStyles = Services.prefs.getBoolPref(PREF_UA_STYLES);
|
||||
|
||||
this.onAddClass = this.onAddClass.bind(this);
|
||||
this.onAddRule = this.onAddRule.bind(this);
|
||||
this.onSelection = this.onSelection.bind(this);
|
||||
this.onSetClassState = this.onSetClassState.bind(this);
|
||||
this.onToggleClassPanelExpanded = this.onToggleClassPanelExpanded.bind(this);
|
||||
@ -79,6 +82,7 @@ class RulesView {
|
||||
|
||||
const rulesApp = RulesApp({
|
||||
onAddClass: this.onAddClass,
|
||||
onAddRule: this.onAddRule,
|
||||
onSetClassState: this.onSetClassState,
|
||||
onToggleClassPanelExpanded: this.onToggleClassPanelExpanded,
|
||||
onToggleDeclaration: this.onToggleDeclaration,
|
||||
@ -269,6 +273,13 @@ class RulesView {
|
||||
this.updateClassList();
|
||||
}
|
||||
|
||||
/**
|
||||
* Handler for adding a new CSS rule.
|
||||
*/
|
||||
async onAddRule() {
|
||||
await this.elementStyle.addNewRule();
|
||||
}
|
||||
|
||||
/**
|
||||
* Handler for selection events "detached-front" and "new-node-front" and inspector
|
||||
* sidbar "select" event. Updates the rules view with the selected node if the panel
|
||||
@ -506,6 +517,7 @@ class RulesView {
|
||||
async update(element) {
|
||||
if (!element) {
|
||||
this.store.dispatch(disableAllPseudoClasses());
|
||||
this.store.dispatch(updateAddRuleEnabled(false));
|
||||
this.store.dispatch(updateClasses([]));
|
||||
this.store.dispatch(updateRules([]));
|
||||
return;
|
||||
@ -516,6 +528,9 @@ class RulesView {
|
||||
this.elementStyle.onChanged = this.updateRules;
|
||||
await this.elementStyle.populate();
|
||||
|
||||
const isAddRuleEnabled = this.selection.isElementNode() &&
|
||||
!this.selection.isAnonymousNode();
|
||||
this.store.dispatch(updateAddRuleEnabled(isAddRuleEnabled));
|
||||
this.store.dispatch(setPseudoClassLocks(this.elementStyle.element.pseudoClassLocks));
|
||||
this.updateClassList();
|
||||
this.updateRules();
|
||||
|
@ -5,6 +5,7 @@
|
||||
"use strict";
|
||||
|
||||
const {
|
||||
UPDATE_ADD_RULE_ENABLED,
|
||||
UPDATE_RULES,
|
||||
UPDATE_HIGHLIGHTED_SELECTOR,
|
||||
} = require("../actions/index");
|
||||
@ -12,6 +13,8 @@ const {
|
||||
const INITIAL_RULES = {
|
||||
// The selector of the node that is highlighted by the selector highlighter.
|
||||
highlightedSelector: "",
|
||||
// Whether or not the add new rule button should be enabled.
|
||||
isAddRuleEnabled: false,
|
||||
// Array of CSS rules.
|
||||
rules: [],
|
||||
};
|
||||
@ -89,6 +92,13 @@ function getRuleState(rule) {
|
||||
|
||||
const reducers = {
|
||||
|
||||
[UPDATE_ADD_RULE_ENABLED](rules, { enabled }) {
|
||||
return {
|
||||
...rules,
|
||||
isAddRuleEnabled: enabled,
|
||||
};
|
||||
},
|
||||
|
||||
[UPDATE_HIGHLIGHTED_SELECTOR](rules, { highlightedSelector }) {
|
||||
return {
|
||||
...rules,
|
||||
@ -99,6 +109,7 @@ const reducers = {
|
||||
[UPDATE_RULES](rules, { rules: newRules }) {
|
||||
return {
|
||||
highlightedSelector: rules.highlightedSelector,
|
||||
isAddRuleEnabled: rules.isAddRuleEnabled,
|
||||
rules: newRules.map(rule => getRuleState(rule)),
|
||||
};
|
||||
},
|
||||
|
@ -29,11 +29,6 @@ class RDDProcessImpl final : public ipc::ProcessChild {
|
||||
DISALLOW_COPY_AND_ASSIGN(RDDProcessImpl);
|
||||
|
||||
RDDParent mRDD;
|
||||
|
||||
#if defined(XP_WIN)
|
||||
// This object initializes and configures COM.
|
||||
mozilla::mscom::MainThreadRuntime mCOMRuntime;
|
||||
#endif
|
||||
};
|
||||
|
||||
} // namespace mozilla
|
||||
|
@ -634,15 +634,6 @@ namespace mozilla {
|
||||
namespace ipc {
|
||||
namespace windows {
|
||||
|
||||
static bool ProcessTypeRequiresWinEventHook() {
|
||||
switch (XRE_GetProcessType()) {
|
||||
case GeckoProcessType_GMPlugin:
|
||||
return false;
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
void InitUIThread() {
|
||||
// If we aren't setup before a call to NotifyWorkerThread, we'll hang
|
||||
// on startup.
|
||||
@ -654,7 +645,7 @@ void InitUIThread() {
|
||||
MOZ_ASSERT(gUIThreadId == GetCurrentThreadId(),
|
||||
"Called InitUIThread multiple times on different threads!");
|
||||
|
||||
if (!gWinEventHook && ProcessTypeRequiresWinEventHook()) {
|
||||
if (!gWinEventHook && XRE_Win32kCallsAllowed()) {
|
||||
gWinEventHook = SetWinEventHook(EVENT_OBJECT_CREATE, EVENT_OBJECT_DESTROY,
|
||||
NULL, &WinEventHook, GetCurrentProcessId(),
|
||||
gUIThreadId, WINEVENT_OUTOFCONTEXT);
|
||||
|
@ -1327,95 +1327,95 @@ void Scope::traceChildren(JSTracer* trc) {
|
||||
}
|
||||
}
|
||||
inline void js::GCMarker::eagerlyMarkChildren(Scope* scope) {
|
||||
if (scope->enclosing_) {
|
||||
traverseEdge(scope, scope->enclosing_.get());
|
||||
}
|
||||
if (scope->environmentShape_) {
|
||||
traverseEdge(scope, scope->environmentShape_.get());
|
||||
}
|
||||
TrailingNamesArray* names = nullptr;
|
||||
uint32_t length = 0;
|
||||
switch (scope->kind()) {
|
||||
case ScopeKind::Function: {
|
||||
FunctionScope::Data& data = scope->as<FunctionScope>().data();
|
||||
traverseObjectEdge(scope, data.canonicalFunction);
|
||||
names = &data.trailingNames;
|
||||
length = data.length;
|
||||
break;
|
||||
do {
|
||||
if (scope->environmentShape_) {
|
||||
traverseEdge(scope, scope->environmentShape_.get());
|
||||
}
|
||||
TrailingNamesArray* names = nullptr;
|
||||
uint32_t length = 0;
|
||||
switch (scope->kind()) {
|
||||
case ScopeKind::Function: {
|
||||
FunctionScope::Data& data = scope->as<FunctionScope>().data();
|
||||
traverseObjectEdge(scope, data.canonicalFunction);
|
||||
names = &data.trailingNames;
|
||||
length = data.length;
|
||||
break;
|
||||
}
|
||||
|
||||
case ScopeKind::FunctionBodyVar:
|
||||
case ScopeKind::ParameterExpressionVar: {
|
||||
VarScope::Data& data = scope->as<VarScope>().data();
|
||||
names = &data.trailingNames;
|
||||
length = data.length;
|
||||
break;
|
||||
}
|
||||
case ScopeKind::FunctionBodyVar:
|
||||
case ScopeKind::ParameterExpressionVar: {
|
||||
VarScope::Data& data = scope->as<VarScope>().data();
|
||||
names = &data.trailingNames;
|
||||
length = data.length;
|
||||
break;
|
||||
}
|
||||
|
||||
case ScopeKind::Lexical:
|
||||
case ScopeKind::SimpleCatch:
|
||||
case ScopeKind::Catch:
|
||||
case ScopeKind::NamedLambda:
|
||||
case ScopeKind::StrictNamedLambda: {
|
||||
LexicalScope::Data& data = scope->as<LexicalScope>().data();
|
||||
names = &data.trailingNames;
|
||||
length = data.length;
|
||||
break;
|
||||
}
|
||||
case ScopeKind::Lexical:
|
||||
case ScopeKind::SimpleCatch:
|
||||
case ScopeKind::Catch:
|
||||
case ScopeKind::NamedLambda:
|
||||
case ScopeKind::StrictNamedLambda: {
|
||||
LexicalScope::Data& data = scope->as<LexicalScope>().data();
|
||||
names = &data.trailingNames;
|
||||
length = data.length;
|
||||
break;
|
||||
}
|
||||
|
||||
case ScopeKind::Global:
|
||||
case ScopeKind::NonSyntactic: {
|
||||
GlobalScope::Data& data = scope->as<GlobalScope>().data();
|
||||
names = &data.trailingNames;
|
||||
length = data.length;
|
||||
break;
|
||||
}
|
||||
case ScopeKind::Global:
|
||||
case ScopeKind::NonSyntactic: {
|
||||
GlobalScope::Data& data = scope->as<GlobalScope>().data();
|
||||
names = &data.trailingNames;
|
||||
length = data.length;
|
||||
break;
|
||||
}
|
||||
|
||||
case ScopeKind::Eval:
|
||||
case ScopeKind::StrictEval: {
|
||||
EvalScope::Data& data = scope->as<EvalScope>().data();
|
||||
names = &data.trailingNames;
|
||||
length = data.length;
|
||||
break;
|
||||
}
|
||||
case ScopeKind::Eval:
|
||||
case ScopeKind::StrictEval: {
|
||||
EvalScope::Data& data = scope->as<EvalScope>().data();
|
||||
names = &data.trailingNames;
|
||||
length = data.length;
|
||||
break;
|
||||
}
|
||||
|
||||
case ScopeKind::Module: {
|
||||
ModuleScope::Data& data = scope->as<ModuleScope>().data();
|
||||
traverseObjectEdge(scope, data.module);
|
||||
names = &data.trailingNames;
|
||||
length = data.length;
|
||||
break;
|
||||
}
|
||||
case ScopeKind::Module: {
|
||||
ModuleScope::Data& data = scope->as<ModuleScope>().data();
|
||||
traverseObjectEdge(scope, data.module);
|
||||
names = &data.trailingNames;
|
||||
length = data.length;
|
||||
break;
|
||||
}
|
||||
|
||||
case ScopeKind::With:
|
||||
break;
|
||||
case ScopeKind::With:
|
||||
break;
|
||||
|
||||
case ScopeKind::WasmInstance: {
|
||||
WasmInstanceScope::Data& data = scope->as<WasmInstanceScope>().data();
|
||||
traverseObjectEdge(scope, data.instance);
|
||||
names = &data.trailingNames;
|
||||
length = data.length;
|
||||
break;
|
||||
}
|
||||
case ScopeKind::WasmInstance: {
|
||||
WasmInstanceScope::Data& data = scope->as<WasmInstanceScope>().data();
|
||||
traverseObjectEdge(scope, data.instance);
|
||||
names = &data.trailingNames;
|
||||
length = data.length;
|
||||
break;
|
||||
}
|
||||
|
||||
case ScopeKind::WasmFunction: {
|
||||
WasmFunctionScope::Data& data = scope->as<WasmFunctionScope>().data();
|
||||
names = &data.trailingNames;
|
||||
length = data.length;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (scope->kind_ == ScopeKind::Function) {
|
||||
for (uint32_t i = 0; i < length; i++) {
|
||||
if (JSAtom* name = names->get(i).name()) {
|
||||
traverseStringEdge(scope, name);
|
||||
case ScopeKind::WasmFunction: {
|
||||
WasmFunctionScope::Data& data = scope->as<WasmFunctionScope>().data();
|
||||
names = &data.trailingNames;
|
||||
length = data.length;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (uint32_t i = 0; i < length; i++) {
|
||||
traverseStringEdge(scope, names->get(i).name());
|
||||
if (scope->kind_ == ScopeKind::Function) {
|
||||
for (uint32_t i = 0; i < length; i++) {
|
||||
if (JSAtom* name = names->get(i).name()) {
|
||||
traverseStringEdge(scope, name);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (uint32_t i = 0; i < length; i++) {
|
||||
traverseStringEdge(scope, names->get(i).name());
|
||||
}
|
||||
}
|
||||
}
|
||||
scope = scope->enclosing_;
|
||||
} while (scope && mark(scope));
|
||||
}
|
||||
|
||||
void js::ObjectGroup::traceChildren(JSTracer* trc) {
|
||||
|
@ -12996,10 +12996,9 @@ void CodeGenerator::visitRecompileCheck(LRecompileCheck* ins) {
|
||||
Register tmp = ToRegister(ins->scratch());
|
||||
OutOfLineCode* ool;
|
||||
if (ins->mir()->forceRecompilation()) {
|
||||
ool =
|
||||
oolCallVM(ForcedRecompileFnInfo, ins, ArgList(), StoreRegisterTo(tmp));
|
||||
ool = oolCallVM(ForcedRecompileFnInfo, ins, ArgList(), StoreNothing());
|
||||
} else {
|
||||
ool = oolCallVM(RecompileFnInfo, ins, ArgList(), StoreRegisterTo(tmp));
|
||||
ool = oolCallVM(RecompileFnInfo, ins, ArgList(), StoreNothing());
|
||||
}
|
||||
|
||||
// Check if warm-up counter is high enough.
|
||||
|
@ -210,7 +210,7 @@ struct VMFunction {
|
||||
// Whether this function returns anything more than a boolean flag for
|
||||
// failures.
|
||||
bool returnsData() const {
|
||||
return returnType == Type_Pointer || outParam != Type_Void;
|
||||
return returnType == Type_Object || outParam != Type_Void;
|
||||
}
|
||||
|
||||
ArgProperties argProperties(uint32_t explicitArg) const {
|
||||
|
@ -577,6 +577,10 @@ class ArgSeq<> {
|
||||
ArgSeq() {}
|
||||
|
||||
inline void generate(CodeGeneratorShared* codegen) const {}
|
||||
|
||||
#ifdef DEBUG
|
||||
static constexpr size_t numArgs = 0;
|
||||
#endif
|
||||
};
|
||||
|
||||
template <typename HeadType, typename... TailTypes>
|
||||
@ -597,6 +601,10 @@ class ArgSeq<HeadType, TailTypes...> : public ArgSeq<TailTypes...> {
|
||||
this->ArgSeq<TailTypes...>::generate(codegen);
|
||||
codegen->pushArg(head_);
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
static constexpr size_t numArgs = sizeof...(TailTypes) + 1;
|
||||
#endif
|
||||
};
|
||||
|
||||
template <typename... ArgTypes>
|
||||
@ -702,6 +710,9 @@ inline OutOfLineCode* CodeGeneratorShared::oolCallVM(const VMFunction& fun,
|
||||
const StoreOutputTo& out) {
|
||||
MOZ_ASSERT(lir->mirRaw());
|
||||
MOZ_ASSERT(lir->mirRaw()->isInstruction());
|
||||
MOZ_ASSERT(fun.explicitArgs == args.numArgs);
|
||||
MOZ_ASSERT(fun.returnsData() !=
|
||||
(mozilla::IsSame<StoreOutputTo, StoreNothing>::value));
|
||||
|
||||
OutOfLineCode* ool =
|
||||
new (alloc()) OutOfLineCallVM<ArgSeq, StoreOutputTo>(lir, fun, args, out);
|
||||
|
@ -31,6 +31,7 @@
|
||||
#include "CounterStyleManager.h"
|
||||
#include <algorithm>
|
||||
#include "mozilla/dom/HTMLInputElement.h"
|
||||
#include "nsGridContainerFrame.h"
|
||||
|
||||
#ifdef DEBUG
|
||||
# undef NOISY_VERTICAL_ALIGN
|
||||
@ -1337,12 +1338,12 @@ static bool AreAllEarlierInFlowFramesEmpty(nsIFrame* aFrame,
|
||||
// containing block. The writing-mode of the hypothetical box position will
|
||||
// have the same block direction as the absolute containing block, but may
|
||||
// differ in inline-bidi direction.
|
||||
// In the code below, |aReflowInput->frame| is the absolute containing block,
|
||||
// In the code below, |aCBReflowInput->frame| is the absolute containing block,
|
||||
// while |containingBlock| is the nearest block container of the placeholder
|
||||
// frame, which may be different from the absolute containing block.
|
||||
void ReflowInput::CalculateHypotheticalPosition(
|
||||
nsPresContext* aPresContext, nsPlaceholderFrame* aPlaceholderFrame,
|
||||
const ReflowInput* aReflowInput, nsHypotheticalPosition& aHypotheticalPos,
|
||||
const ReflowInput* aCBReflowInput, nsHypotheticalPosition& aHypotheticalPos,
|
||||
LayoutFrameType aFrameType) const {
|
||||
NS_ASSERTION(mStyleDisplay->mOriginalDisplay != StyleDisplay::None,
|
||||
"mOriginalDisplay has not been properly initialized");
|
||||
@ -1352,7 +1353,7 @@ void ReflowInput::CalculateHypotheticalPosition(
|
||||
nscoord blockIStartContentEdge;
|
||||
// Dummy writing mode for blockContentSize, will be changed as needed by
|
||||
// GetHypotheticalBoxContainer.
|
||||
WritingMode cbwm = aReflowInput->GetWritingMode();
|
||||
WritingMode cbwm = aCBReflowInput->GetWritingMode();
|
||||
LogicalSize blockContentSize(cbwm);
|
||||
nsIFrame* containingBlock = GetHypotheticalBoxContainer(
|
||||
aPlaceholderFrame, blockIStartContentEdge, blockContentSize);
|
||||
@ -1424,7 +1425,7 @@ void ReflowInput::CalculateHypotheticalPosition(
|
||||
// relatively positioned...
|
||||
nsSize containerSize =
|
||||
containingBlock->GetStateBits() & NS_FRAME_IN_REFLOW
|
||||
? aReflowInput->ComputedSizeAsContainerIfConstrained()
|
||||
? aCBReflowInput->ComputedSizeAsContainerIfConstrained()
|
||||
: containingBlock->GetSize();
|
||||
LogicalPoint placeholderOffset(
|
||||
wm, aPlaceholderFrame->GetOffsetToIgnoringScrolling(containingBlock),
|
||||
@ -1539,9 +1540,9 @@ void ReflowInput::CalculateHypotheticalPosition(
|
||||
// placeholder. Convert to the coordinate space of the absolute containing
|
||||
// block.
|
||||
nsPoint cbOffset =
|
||||
containingBlock->GetOffsetToIgnoringScrolling(aReflowInput->mFrame);
|
||||
containingBlock->GetOffsetToIgnoringScrolling(aCBReflowInput->mFrame);
|
||||
|
||||
nsSize reflowSize = aReflowInput->ComputedSizeAsContainerIfConstrained();
|
||||
nsSize reflowSize = aCBReflowInput->ComputedSizeAsContainerIfConstrained();
|
||||
LogicalPoint logCBOffs(wm, cbOffset, reflowSize - containerSize);
|
||||
aHypotheticalPos.mIStart += logCBOffs.I(wm);
|
||||
aHypotheticalPos.mBStart += logCBOffs.B(wm);
|
||||
@ -1549,9 +1550,9 @@ void ReflowInput::CalculateHypotheticalPosition(
|
||||
// The specified offsets are relative to the absolute containing block's
|
||||
// padding edge and our current values are relative to the border edge, so
|
||||
// translate.
|
||||
LogicalMargin border = aReflowInput->ComputedLogicalBorderPadding() -
|
||||
aReflowInput->ComputedLogicalPadding();
|
||||
border = border.ConvertTo(wm, aReflowInput->GetWritingMode());
|
||||
LogicalMargin border = aCBReflowInput->ComputedLogicalBorderPadding() -
|
||||
aCBReflowInput->ComputedLogicalPadding();
|
||||
border = border.ConvertTo(wm, aCBReflowInput->GetWritingMode());
|
||||
aHypotheticalPos.mIStart -= border.IStart(wm);
|
||||
aHypotheticalPos.mBStart -= border.BStart(wm);
|
||||
|
||||
@ -1617,11 +1618,11 @@ void ReflowInput::CalculateHypotheticalPosition(
|
||||
}
|
||||
|
||||
void ReflowInput::InitAbsoluteConstraints(nsPresContext* aPresContext,
|
||||
const ReflowInput* aReflowInput,
|
||||
const ReflowInput* aCBReflowInput,
|
||||
const LogicalSize& aCBSize,
|
||||
LayoutFrameType aFrameType) {
|
||||
WritingMode wm = GetWritingMode();
|
||||
WritingMode cbwm = aReflowInput->GetWritingMode();
|
||||
WritingMode cbwm = aCBReflowInput->GetWritingMode();
|
||||
NS_WARNING_ASSERTION(aCBSize.BSize(cbwm) != NS_AUTOHEIGHT,
|
||||
"containing block bsize must be constrained");
|
||||
|
||||
@ -1663,8 +1664,28 @@ void ReflowInput::InitAbsoluteConstraints(nsPresContext* aPresContext,
|
||||
hypotheticalPos.mIStart = nscoord(0);
|
||||
hypotheticalPos.mBStart = nscoord(0);
|
||||
} else {
|
||||
// XXXmats all this is broken for orthogonal writing-modes: bug 1521988.
|
||||
CalculateHypotheticalPosition(aPresContext, placeholderFrame,
|
||||
aReflowInput, hypotheticalPos, aFrameType);
|
||||
aCBReflowInput, hypotheticalPos,
|
||||
aFrameType);
|
||||
if (aCBReflowInput->mFrame->IsGridContainerFrame()) {
|
||||
// 'hypotheticalPos' is relative to the padding rect of the CB *frame*.
|
||||
// In grid layout the CB is the grid area rectangle, so we translate
|
||||
// 'hypotheticalPos' to be relative that rectangle here.
|
||||
nsRect cb = nsGridContainerFrame::GridItemCB(mFrame);
|
||||
nscoord left(0);
|
||||
nscoord right(0);
|
||||
if (cbwm.IsBidiLTR()) {
|
||||
left = cb.X();
|
||||
} else {
|
||||
right = aCBReflowInput->ComputedWidth() +
|
||||
aCBReflowInput->ComputedPhysicalPadding().LeftRight() -
|
||||
cb.XMost();
|
||||
}
|
||||
LogicalMargin offsets(cbwm, nsMargin(cb.Y(), right, nscoord(0), left));
|
||||
hypotheticalPos.mIStart -= offsets.IStart(cbwm);
|
||||
hypotheticalPos.mBStart -= offsets.BStart(cbwm);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1002,15 +1002,15 @@ struct ReflowInput : public SizeComputationInput {
|
||||
// (for a position:fixed/absolute element) would have been placed if it were
|
||||
// positioned statically. The hypothetical box position will have a writing
|
||||
// mode with the same block direction as the absolute containing block
|
||||
// (aReflowInput->frame), though it may differ in inline direction.
|
||||
// (aCBReflowInput->frame), though it may differ in inline direction.
|
||||
void CalculateHypotheticalPosition(nsPresContext* aPresContext,
|
||||
nsPlaceholderFrame* aPlaceholderFrame,
|
||||
const ReflowInput* aReflowInput,
|
||||
const ReflowInput* aCBReflowInput,
|
||||
nsHypotheticalPosition& aHypotheticalPos,
|
||||
mozilla::LayoutFrameType aFrameType) const;
|
||||
|
||||
void InitAbsoluteConstraints(nsPresContext* aPresContext,
|
||||
const ReflowInput* aReflowInput,
|
||||
const ReflowInput* aCBReflowInput,
|
||||
const mozilla::LogicalSize& aContainingBlockSize,
|
||||
mozilla::LayoutFrameType aFrameType);
|
||||
|
||||
|
@ -729,22 +729,8 @@ void nsAbsoluteContainingBlock::ReflowAbsoluteFrame(
|
||||
border.Size(outerWM).GetPhysicalSize(outerWM));
|
||||
|
||||
// Offset the frame rect by the given origin of the absolute containing block.
|
||||
// If the frame is auto-positioned on both sides of an axis, it will be
|
||||
// positioned based on its containing block and we don't need to offset
|
||||
// (unless the caller demands it (the STATIC_POS_IS_CB_ORIGIN case)).
|
||||
if (aContainingBlock.TopLeft() != nsPoint(0, 0)) {
|
||||
const nsStyleSides& offsets = kidReflowInput.mStylePosition->mOffset;
|
||||
if (!(offsets.GetLeftUnit() == eStyleUnit_Auto &&
|
||||
offsets.GetRightUnit() == eStyleUnit_Auto) ||
|
||||
(rsFlags & ReflowInput::STATIC_POS_IS_CB_ORIGIN)) {
|
||||
r.x += aContainingBlock.x;
|
||||
}
|
||||
if (!(offsets.GetTopUnit() == eStyleUnit_Auto &&
|
||||
offsets.GetBottomUnit() == eStyleUnit_Auto) ||
|
||||
(rsFlags & ReflowInput::STATIC_POS_IS_CB_ORIGIN)) {
|
||||
r.y += aContainingBlock.y;
|
||||
}
|
||||
}
|
||||
r.x += aContainingBlock.x;
|
||||
r.y += aContainingBlock.y;
|
||||
|
||||
aKidFrame->SetRect(r);
|
||||
|
||||
|
@ -501,17 +501,11 @@ VARCACHE_PREF(
|
||||
|
||||
// For area and anchor elements with target=_blank and no rel set to
|
||||
// opener/noopener, this pref sets noopener by default.
|
||||
#ifdef EARLY_BETA_OR_EARLIER
|
||||
#define PREF_VALUE true
|
||||
#else
|
||||
#define PREF_VALUE false
|
||||
#endif
|
||||
VARCACHE_PREF(
|
||||
"dom.targetBlankNoOpener.enabled",
|
||||
dom_targetBlankNoOpener_enabled,
|
||||
bool, PREF_VALUE
|
||||
bool, true
|
||||
)
|
||||
#undef PREF_VALUE
|
||||
|
||||
VARCACHE_PREF(
|
||||
"dom.disable_open_during_load",
|
||||
@ -1957,6 +1951,27 @@ VARCACHE_PREF(
|
||||
bool, false
|
||||
)
|
||||
|
||||
// Malware protection
|
||||
VARCACHE_PREF(
|
||||
"browser.safebrowsing.malware.enabled",
|
||||
browser_safebrowsing_malware_enabled,
|
||||
bool, true
|
||||
)
|
||||
|
||||
// Phishing protection
|
||||
VARCACHE_PREF(
|
||||
"browser.safebrowsing.phishing.enabled",
|
||||
browser_safebrowsing_phishing_enabled,
|
||||
bool, true
|
||||
)
|
||||
|
||||
// Blocked plugin content
|
||||
VARCACHE_PREF(
|
||||
"browser.safebrowsing.blockedURIs.enabled",
|
||||
browser_safebrowsing_blockedURIs_enabled,
|
||||
bool, true
|
||||
)
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// ChannelClassifier prefs
|
||||
//---------------------------------------------------------------------------
|
||||
|
@ -5585,9 +5585,7 @@ pref("urlclassifier.update.timeout_ms", 90000);
|
||||
// Name of the about: page to display Safe Browsing warnings (bug 399233)
|
||||
pref("urlclassifier.alternate_error_page", "blocked");
|
||||
|
||||
// Enable phishing & malware protection.
|
||||
pref("browser.safebrowsing.phishing.enabled", true);
|
||||
pref("browser.safebrowsing.malware.enabled", true);
|
||||
// Enable safe-browsing debugging
|
||||
pref("browser.safebrowsing.debug", false);
|
||||
|
||||
// Allow users to ignore Safe Browsing warnings.
|
||||
@ -5650,7 +5648,6 @@ pref("browser.safebrowsing.provider.mozilla.lists.base", "moz-std");
|
||||
pref("browser.safebrowsing.provider.mozilla.lists.content", "moz-full");
|
||||
|
||||
// The table and global pref for blocking plugin content
|
||||
pref("browser.safebrowsing.blockedURIs.enabled", true);
|
||||
pref("urlclassifier.blockedTable", "test-block-simple,mozplugin-block-digest256");
|
||||
|
||||
// Flash blocking tables
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include "UrlClassifierFeatureFingerprinting.h"
|
||||
#include "UrlClassifierFeatureFlash.h"
|
||||
#include "UrlClassifierFeatureLoginReputation.h"
|
||||
#include "UrlClassifierFeaturePhishingProtection.h"
|
||||
#include "UrlClassifierFeatureTrackingProtection.h"
|
||||
#include "UrlClassifierFeatureTrackingAnnotation.h"
|
||||
#include "UrlClassifierFeatureCustomTables.h"
|
||||
@ -30,6 +31,7 @@ namespace net {
|
||||
UrlClassifierFeatureFingerprinting::MaybeShutdown();
|
||||
UrlClassifierFeatureFlash::MaybeShutdown();
|
||||
UrlClassifierFeatureLoginReputation::MaybeShutdown();
|
||||
UrlClassifierFeaturePhishingProtection::MaybeShutdown();
|
||||
UrlClassifierFeatureTrackingAnnotation::MaybeShutdown();
|
||||
UrlClassifierFeatureTrackingProtection::MaybeShutdown();
|
||||
}
|
||||
@ -77,6 +79,11 @@ namespace net {
|
||||
aFeatures.AppendElements(flashFeatures);
|
||||
}
|
||||
|
||||
/* static */ void UrlClassifierFeatureFactory::GetPhishingProtectionFeatures(
|
||||
nsTArray<RefPtr<nsIUrlClassifierFeature>>& aFeatures) {
|
||||
UrlClassifierFeaturePhishingProtection::MaybeCreate(aFeatures);
|
||||
}
|
||||
|
||||
/* static */
|
||||
nsIUrlClassifierFeature*
|
||||
UrlClassifierFeatureFactory::GetFeatureLoginReputation() {
|
||||
@ -127,6 +134,12 @@ UrlClassifierFeatureFactory::GetFeatureByName(const nsACString& aName) {
|
||||
return feature.forget();
|
||||
}
|
||||
|
||||
// PhishingProtection features
|
||||
feature = UrlClassifierFeaturePhishingProtection::GetIfNameMatches(aName);
|
||||
if (feature) {
|
||||
return feature.forget();
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@ -168,9 +181,18 @@ UrlClassifierFeatureFactory::GetFeatureByName(const nsACString& aName) {
|
||||
}
|
||||
|
||||
// Flash features
|
||||
nsTArray<nsCString> features;
|
||||
UrlClassifierFeatureFlash::GetFeatureNames(features);
|
||||
aArray.AppendElements(features);
|
||||
{
|
||||
nsTArray<nsCString> features;
|
||||
UrlClassifierFeatureFlash::GetFeatureNames(features);
|
||||
aArray.AppendElements(features);
|
||||
}
|
||||
|
||||
// PhishingProtection features
|
||||
{
|
||||
nsTArray<nsCString> features;
|
||||
UrlClassifierFeaturePhishingProtection::GetFeatureNames(features);
|
||||
aArray.AppendElements(features);
|
||||
}
|
||||
}
|
||||
|
||||
/* static */ already_AddRefed<nsIUrlClassifierFeature>
|
||||
|
@ -24,6 +24,9 @@ class UrlClassifierFeatureFactory final {
|
||||
nsIChannel* aChannel,
|
||||
nsTArray<nsCOMPtr<nsIUrlClassifierFeature>>& aFeatures);
|
||||
|
||||
static void GetPhishingProtectionFeatures(
|
||||
nsTArray<RefPtr<nsIUrlClassifierFeature>>& aFeatures);
|
||||
|
||||
static nsIUrlClassifierFeature* GetFeatureLoginReputation();
|
||||
|
||||
static already_AddRefed<nsIUrlClassifierFeature> GetFeatureByName(
|
||||
|
@ -0,0 +1,121 @@
|
||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set ts=8 sts=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 "UrlClassifierFeaturePhishingProtection.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace net {
|
||||
|
||||
struct UrlClassifierFeaturePhishingProtection::PhishingProtectionFeature {
|
||||
const char* mName;
|
||||
const char* mBlacklistPrefTables;
|
||||
bool (*mPref)();
|
||||
|
||||
RefPtr<UrlClassifierFeaturePhishingProtection> mFeature;
|
||||
};
|
||||
|
||||
namespace {
|
||||
|
||||
struct UrlClassifierFeaturePhishingProtection::PhishingProtectionFeature
|
||||
sPhishingProtectionFeaturesMap[] = {
|
||||
{"malware", "urlclassifier.malwareTable",
|
||||
StaticPrefs::browser_safebrowsing_malware_enabled},
|
||||
{"phishing", "urlclassifier.phishTable",
|
||||
StaticPrefs::browser_safebrowsing_phishing_enabled},
|
||||
{"blockedURIs", "urlclassifier.blockedTable",
|
||||
StaticPrefs::browser_safebrowsing_blockedURIs_enabled},
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
UrlClassifierFeaturePhishingProtection::UrlClassifierFeaturePhishingProtection(
|
||||
const UrlClassifierFeaturePhishingProtection::PhishingProtectionFeature&
|
||||
aFeature)
|
||||
: UrlClassifierFeatureBase(
|
||||
nsDependentCString(aFeature.mName),
|
||||
nsDependentCString(aFeature.mBlacklistPrefTables),
|
||||
EmptyCString(), // aPrefWhitelistPrefTbles,
|
||||
EmptyCString(), // aPrefBlacklistHosts
|
||||
EmptyCString(), // aPrefWhitelistHosts
|
||||
EmptyCString(), // aPrefBlacklistTableName
|
||||
EmptyCString(), // aPrefWhitelistTableName
|
||||
EmptyCString()) { // aPrefSkipHosts
|
||||
}
|
||||
|
||||
/* static */ void UrlClassifierFeaturePhishingProtection::GetFeatureNames(
|
||||
nsTArray<nsCString>& aArray) {
|
||||
for (const PhishingProtectionFeature& feature :
|
||||
sPhishingProtectionFeaturesMap) {
|
||||
if (feature.mPref()) {
|
||||
aArray.AppendElement(nsDependentCString(feature.mName));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* static */ void UrlClassifierFeaturePhishingProtection::MaybeInitialize() {
|
||||
for (PhishingProtectionFeature& feature : sPhishingProtectionFeaturesMap) {
|
||||
if (!feature.mFeature && feature.mPref()) {
|
||||
feature.mFeature = new UrlClassifierFeaturePhishingProtection(feature);
|
||||
feature.mFeature->InitializePreferences();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* static */ void UrlClassifierFeaturePhishingProtection::MaybeShutdown() {
|
||||
for (PhishingProtectionFeature& feature : sPhishingProtectionFeaturesMap) {
|
||||
if (feature.mFeature) {
|
||||
feature.mFeature->ShutdownPreferences();
|
||||
feature.mFeature = nullptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* static */ void UrlClassifierFeaturePhishingProtection::MaybeCreate(
|
||||
nsTArray<RefPtr<nsIUrlClassifierFeature>>& aFeatures) {
|
||||
MaybeInitialize();
|
||||
|
||||
for (const PhishingProtectionFeature& feature :
|
||||
sPhishingProtectionFeaturesMap) {
|
||||
if (feature.mPref()) {
|
||||
MOZ_ASSERT(feature.mFeature);
|
||||
aFeatures.AppendElement(feature.mFeature);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* static */ already_AddRefed<nsIUrlClassifierFeature>
|
||||
UrlClassifierFeaturePhishingProtection::GetIfNameMatches(
|
||||
const nsACString& aName) {
|
||||
MaybeInitialize();
|
||||
|
||||
for (const PhishingProtectionFeature& feature :
|
||||
sPhishingProtectionFeaturesMap) {
|
||||
if (feature.mPref() && aName.Equals(feature.mName)) {
|
||||
MOZ_ASSERT(feature.mFeature);
|
||||
nsCOMPtr<nsIUrlClassifierFeature> self = feature.mFeature.get();
|
||||
return self.forget();
|
||||
}
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
UrlClassifierFeaturePhishingProtection::ProcessChannel(nsIChannel* aChannel,
|
||||
const nsACString& aList,
|
||||
bool* aShouldContinue) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
UrlClassifierFeaturePhishingProtection::GetURIByListType(
|
||||
nsIChannel* aChannel, nsIUrlClassifierFeature::listType aListType,
|
||||
nsIURI** aURI) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
} // namespace net
|
||||
} // namespace mozilla
|
@ -0,0 +1,48 @@
|
||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set ts=8 sts=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/. */
|
||||
|
||||
#ifndef mozilla_UrlClassifierFeaturePhishingProtection_h
|
||||
#define mozilla_UrlClassifierFeaturePhishingProtection_h
|
||||
|
||||
#include "UrlClassifierFeatureBase.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace net {
|
||||
|
||||
class UrlClassifierFeaturePhishingProtection final
|
||||
: public UrlClassifierFeatureBase {
|
||||
public:
|
||||
struct PhishingProtectionFeature;
|
||||
|
||||
static void GetFeatureNames(nsTArray<nsCString>& aNames);
|
||||
|
||||
static void MaybeShutdown();
|
||||
|
||||
static void MaybeCreate(
|
||||
nsTArray<RefPtr<nsIUrlClassifierFeature>>& aFeatures);
|
||||
|
||||
static already_AddRefed<nsIUrlClassifierFeature> GetIfNameMatches(
|
||||
const nsACString& aName);
|
||||
|
||||
NS_IMETHOD
|
||||
ProcessChannel(nsIChannel* aChannel, const nsACString& aList,
|
||||
bool* aShouldContinue) override;
|
||||
|
||||
NS_IMETHOD GetURIByListType(nsIChannel* aChannel,
|
||||
nsIUrlClassifierFeature::listType aListType,
|
||||
nsIURI** aURI) override;
|
||||
|
||||
private:
|
||||
explicit UrlClassifierFeaturePhishingProtection(
|
||||
const PhishingProtectionFeature& aFeature);
|
||||
|
||||
static void MaybeInitialize();
|
||||
};
|
||||
|
||||
} // namespace net
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // mozilla_UrlClassifierFeaturePhishingProtection_h
|
@ -28,6 +28,7 @@ UNIFIED_SOURCES += [
|
||||
'UrlClassifierFeatureFingerprinting.cpp',
|
||||
'UrlClassifierFeatureFlash.cpp',
|
||||
'UrlClassifierFeatureLoginReputation.cpp',
|
||||
'UrlClassifierFeaturePhishingProtection.cpp',
|
||||
'UrlClassifierFeatureResult.cpp',
|
||||
'UrlClassifierFeatureTrackingAnnotation.cpp',
|
||||
'UrlClassifierFeatureTrackingProtection.cpp',
|
||||
|
@ -317,6 +317,43 @@ def check_mozglue_order(target, binary):
|
||||
raise RuntimeError('Could not parse readelf output?')
|
||||
|
||||
|
||||
def check_networking(binary):
|
||||
retcode = 0
|
||||
networking_functions = set([
|
||||
# socketpair is not concerning; it is restricted to AF_UNIX
|
||||
"socket", "connect", "accept", "bind", "listen",
|
||||
"getsockname", "getsockopt", "setsockopt",
|
||||
"recv", "recvfrom",
|
||||
"send", "sendto",
|
||||
# We would be concerned by recvmsg and sendmsg; but we believe
|
||||
# they are okay as documented in 1376621#c23
|
||||
"gethostbyname", "gethostbyaddr", "gethostent", "sethostent", "endhostent",
|
||||
"gethostent_r", "gethostbyname2", "gethostbyaddr_r", "gethostbyname_r",
|
||||
"gethostbyname2_r",
|
||||
"getaddrinfo", "getservent", "getservbyname", "getservbyport", "setservent",
|
||||
"getprotoent", "getprotobyname", "getprotobynumber", "setprotoent",
|
||||
"endprotoent"])
|
||||
bad_occurences_names = set()
|
||||
|
||||
try:
|
||||
for sym in at_least_one(iter_symbols(binary)):
|
||||
if sym['addr'] == 0 and sym['name'] in networking_functions:
|
||||
bad_occurences_names.add(sym['name'])
|
||||
except Empty:
|
||||
raise RuntimeError('Could not parse llvm-objdump output?')
|
||||
|
||||
basename = os.path.basename(binary)
|
||||
if bad_occurences_names:
|
||||
s = 'TEST-UNEXPECTED-FAIL | check_networking | {} | Identified {} ' + \
|
||||
'networking function(s) being imported in the rust static library ({})'
|
||||
print(s.format(basename, len(bad_occurences_names),
|
||||
",".join(sorted(bad_occurences_names))),
|
||||
file=sys.stderr)
|
||||
retcode = 1
|
||||
elif buildconfig.substs.get('MOZ_AUTOMATION'):
|
||||
print('TEST-PASS | check_networking | {}'.format(basename))
|
||||
return retcode
|
||||
|
||||
def checks(target, binary):
|
||||
# The clang-plugin is built as target but is really a host binary.
|
||||
# Cheat and pretend we were passed the right argument.
|
||||
@ -362,6 +399,8 @@ def main(args):
|
||||
help='Perform checks for a host binary')
|
||||
parser.add_argument('--target', action='store_true',
|
||||
help='Perform checks for a target binary')
|
||||
parser.add_argument('--networking', action='store_true',
|
||||
help='Perform checks for networking functions')
|
||||
|
||||
parser.add_argument('binary', metavar='PATH',
|
||||
help='Location of the binary to check')
|
||||
@ -373,7 +412,14 @@ def main(args):
|
||||
file=sys.stderr)
|
||||
return 1
|
||||
|
||||
if options.host:
|
||||
if options.networking and options.host:
|
||||
print('--networking is only valid with --target',
|
||||
file=sys.stderr)
|
||||
return 1
|
||||
|
||||
if options.networking:
|
||||
return check_networking(options.binary)
|
||||
elif options.host:
|
||||
return checks(HOST, options.binary)
|
||||
elif options.target:
|
||||
return checks(TARGET, options.binary)
|
||||
|
@ -52,6 +52,7 @@ static UniquePtr<nsString> sUserExtensionsDir;
|
||||
#endif
|
||||
|
||||
// Cached prefs which are needed off main thread.
|
||||
static bool sRddWin32kDisable = false;
|
||||
static bool sGmpWin32kDisable = false;
|
||||
|
||||
static LazyLogModule sSandboxBrokerLog("SandboxBroker");
|
||||
@ -129,6 +130,8 @@ void SandboxBroker::GeckoDependentInitialize() {
|
||||
ClearOnShutdown(&sLaunchErrors);
|
||||
|
||||
// Cache prefs that are needed off main thread.
|
||||
Preferences::AddBoolVarCache(&sRddWin32kDisable,
|
||||
"security.sandbox.rdd.win32k-disable");
|
||||
Preferences::AddBoolVarCache(&sGmpWin32kDisable,
|
||||
"security.sandbox.gmp.win32k-disable");
|
||||
}
|
||||
@ -495,6 +498,11 @@ void SandboxBroker::SetSecurityLevelForContentProcess(int32_t aSandboxLevel,
|
||||
"With these static arguments AddRule should never fail, "
|
||||
"what happened?");
|
||||
} else {
|
||||
// Add rule to allow access to user specific fonts.
|
||||
AddCachedDirRule(mPolicy, sandbox::TargetPolicy::FILES_ALLOW_READONLY,
|
||||
sLocalAppDataDir,
|
||||
NS_LITERAL_STRING("\\Microsoft\\Windows\\Fonts\\*"));
|
||||
|
||||
// Add rule to allow read access to installation directory.
|
||||
AddCachedDirRule(mPolicy, sandbox::TargetPolicy::FILES_ALLOW_READONLY,
|
||||
sBinDir, NS_LITERAL_STRING("\\*"));
|
||||
@ -720,13 +728,21 @@ bool SandboxBroker::SetSecurityLevelForRDDProcess() {
|
||||
sandbox::MITIGATION_BOTTOM_UP_ASLR | sandbox::MITIGATION_HEAP_TERMINATE |
|
||||
sandbox::MITIGATION_SEHOP | sandbox::MITIGATION_EXTENSION_POINT_DISABLE |
|
||||
sandbox::MITIGATION_DEP_NO_ATL_THUNK | sandbox::MITIGATION_DEP |
|
||||
sandbox::MITIGATION_DYNAMIC_CODE_DISABLE |
|
||||
sandbox::MITIGATION_IMAGE_LOAD_PREFER_SYS32;
|
||||
|
||||
if (sRddWin32kDisable) {
|
||||
mitigations |= sandbox::MITIGATION_WIN32K_DISABLE;
|
||||
result =
|
||||
mPolicy->AddRule(sandbox::TargetPolicy::SUBSYS_WIN32K_LOCKDOWN,
|
||||
sandbox::TargetPolicy::FAKE_USER_GDI_INIT, nullptr);
|
||||
SANDBOX_ENSURE_SUCCESS(result, "Failed to set FAKE_USER_GDI_INIT policy.");
|
||||
}
|
||||
|
||||
result = mPolicy->SetProcessMitigations(mitigations);
|
||||
SANDBOX_ENSURE_SUCCESS(result, "Invalid flags for SetProcessMitigations.");
|
||||
|
||||
mitigations = sandbox::MITIGATION_STRICT_HANDLE_CHECKS |
|
||||
sandbox::MITIGATION_DYNAMIC_CODE_DISABLE |
|
||||
sandbox::MITIGATION_DLL_SEARCH_ORDER;
|
||||
|
||||
result = mPolicy->SetDelayedProcessMitigations(mitigations);
|
||||
|
@ -0,0 +1,71 @@
|
||||
<!DOCTYPE html>
|
||||
<html><head>
|
||||
<meta charset="utf-8">
|
||||
<title>CSS Grid Layout Reference: Grid aligned descendants with static position</title>
|
||||
<link rel="author" title="Mats Palmgren" href="mailto:mats@mozilla.com">
|
||||
<style>
|
||||
.grid {
|
||||
position: relative;
|
||||
display: grid;
|
||||
grid: 40px / 40px;
|
||||
border: 2px solid;
|
||||
border-top-width: 5px;
|
||||
border-left-width: 3px;
|
||||
width: 20px;
|
||||
padding: 2px 4px 6px 1px;
|
||||
}
|
||||
.absolute {
|
||||
position: absolute;
|
||||
grid-column: 1 / 2;
|
||||
}
|
||||
.content {
|
||||
float: left;
|
||||
width: 20px;
|
||||
height: 40px;
|
||||
background: green;
|
||||
}
|
||||
.content:nth-child(2) {
|
||||
background: grey;
|
||||
}
|
||||
|
||||
</style></head>
|
||||
<body>
|
||||
There should be no red:
|
||||
|
||||
<div class="grid">
|
||||
<div class="absolute" style="margin-top:2px">
|
||||
<div class="content"></div>
|
||||
<div class="content"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="grid" style="grid-template-columns: 43px">
|
||||
<div class="absolute" style="margin-top:2px; margin-left:3px">
|
||||
<div class="content"></div>
|
||||
<div class="content"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="grid" style="grid-template-columns: 43px">
|
||||
<div class="absolute" style="margin-top:2px; border-left:2px solid black; padding-left:1px">
|
||||
<div class="content"></div>
|
||||
<div class="content"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="grid" style="padding-bottom: 14px">
|
||||
<div class="absolute" style="margin-top:10px">
|
||||
<div class="content"></div>
|
||||
<div class="content"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="grid" style="grid-template-columns: 43px; padding-left:8px">
|
||||
<div class="absolute" style="margin-top:2px; margin-left:3px">
|
||||
<div class="content"></div>
|
||||
<div class="content"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,90 @@
|
||||
<!DOCTYPE html>
|
||||
<html><head>
|
||||
<meta charset="utf-8">
|
||||
<title>CSS Grid Layout Test: Grid aligned descendants with static position</title>
|
||||
<link rel="author" title="Mats Palmgren" href="mailto:mats@mozilla.com">
|
||||
<link rel="help" href="https://drafts.csswg.org/css-grid-1/#abspos" title="Absolute Positioning">
|
||||
<link rel="help" href="https://drafts.csswg.org/css-align-3/#staticpos-rect" title="Appendix A: Static Position Terminology">
|
||||
<link rel="match" href="descendant-static-position-001-ref.html">
|
||||
<meta name="assert" content="This test checks that the position and size of the abs.pos. descendant is correct.">
|
||||
<style>
|
||||
.grid {
|
||||
position: relative;
|
||||
display: grid;
|
||||
grid: 40px / 40px;
|
||||
border: 2px solid;
|
||||
border-top-width: 5px;
|
||||
border-left-width: 3px;
|
||||
width: 20px;
|
||||
padding: 2px 4px 6px 1px;
|
||||
}
|
||||
.grid > div {
|
||||
background: red;
|
||||
background-clip: content-box;
|
||||
}
|
||||
.absolute {
|
||||
position: absolute;
|
||||
background: red;
|
||||
grid-column: 1 / 2;
|
||||
}
|
||||
.content {
|
||||
float: left;
|
||||
width: 20px;
|
||||
height: 40px;
|
||||
background: green;
|
||||
}
|
||||
.content:nth-child(2) {
|
||||
background: grey;
|
||||
}
|
||||
|
||||
</style></head>
|
||||
<body>
|
||||
There should be no red:
|
||||
|
||||
<div class="grid">
|
||||
<div>
|
||||
<div class="absolute">
|
||||
<div class="content"></div>
|
||||
<div class="content"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="grid" style="grid-template-columns: 43px">
|
||||
<div style="padding-left:3px">
|
||||
<div class="absolute">
|
||||
<div class="content"></div>
|
||||
<div class="content"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="grid" style="grid-template-columns: 43px">
|
||||
<div style="border-left:2px solid black; padding-left:1px">
|
||||
<div class="absolute">
|
||||
<div class="content"></div>
|
||||
<div class="content"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="grid" style="padding-top:10px">
|
||||
<div>
|
||||
<div class="absolute">
|
||||
<div class="content"></div>
|
||||
<div class="content"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="grid" style="grid-template-columns: 10px 33px; padding-left:8px">
|
||||
<div style="padding-left:3px">
|
||||
<div class="absolute" style="grid-column: 2 / 3">
|
||||
<div class="content"></div>
|
||||
<div class="content"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,80 @@
|
||||
<!DOCTYPE html>
|
||||
<html><head>
|
||||
<meta charset="utf-8">
|
||||
<title>CSS Grid Layout Reference: Grid aligned descendants with static position (direction: rtl)</title>
|
||||
<link rel="author" title="Mats Palmgren" href="mailto:mats@mozilla.com">
|
||||
<style>
|
||||
.grid {
|
||||
position: relative;
|
||||
display: grid;
|
||||
grid: 40px / 40px;
|
||||
border: 2px solid;
|
||||
border-top-width: 5px;
|
||||
border-left-width: 3px;
|
||||
width: 20px;
|
||||
padding: 2px 4px 6px 1px;
|
||||
direction: rtl;
|
||||
margin-left: 40px;
|
||||
}
|
||||
.absolute {
|
||||
position: absolute;
|
||||
grid-column: 1 / 2;
|
||||
}
|
||||
.content {
|
||||
float: right;
|
||||
width: 20px;
|
||||
height: 40px;
|
||||
background: green;
|
||||
}
|
||||
.content:nth-child(2) {
|
||||
background: grey;
|
||||
}
|
||||
|
||||
</style></head>
|
||||
<body>
|
||||
There should be no red:
|
||||
|
||||
<div class="grid">
|
||||
<div class="absolute" style="margin-top:2px">
|
||||
<div class="content"></div>
|
||||
<div class="content"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="grid" style="grid-template-columns: 43px">
|
||||
<div class="absolute" style="margin-top:2px; margin-left:3px">
|
||||
<div class="content"></div>
|
||||
<div class="content"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="grid" style="grid-template-columns: 43px">
|
||||
<div class="absolute" style="margin-top:2px; border-left:2px solid black; padding-left:1px">
|
||||
<div class="content"></div>
|
||||
<div class="content"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="grid" style="padding-bottom: 14px">
|
||||
<div class="absolute" style="margin-top:10px">
|
||||
<div class="content"></div>
|
||||
<div class="content"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="grid" style="grid-template-columns: 43px; padding-right:8px">
|
||||
<div class="absolute" style="margin-top:2px; margin-left:3px">
|
||||
<div class="content"></div>
|
||||
<div class="content"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="grid" style="grid-template-columns: 43px; padding-right:8px; padding-left:10px">
|
||||
<div class="absolute" style="margin-top:2px;">
|
||||
<div class="content"></div>
|
||||
<div class="content"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,101 @@
|
||||
<!DOCTYPE html>
|
||||
<html><head>
|
||||
<meta charset="utf-8">
|
||||
<title>CSS Grid Layout Test: Grid aligned descendants with static position (direction: rtl)</title>
|
||||
<link rel="author" title="Mats Palmgren" href="mailto:mats@mozilla.com">
|
||||
<link rel="help" href="https://drafts.csswg.org/css-grid-1/#abspos" title="Absolute Positioning">
|
||||
<link rel="help" href="https://drafts.csswg.org/css-align-3/#staticpos-rect" title="Appendix A: Static Position Terminology">
|
||||
<link rel="match" href="descendant-static-position-002-ref.html">
|
||||
<meta name="assert" content="This test checks that the position and size of the abs.pos. descendant is correct.">
|
||||
<style>
|
||||
.grid {
|
||||
position: relative;
|
||||
display: grid;
|
||||
grid: 40px / 40px;
|
||||
border: 2px solid;
|
||||
border-top-width: 5px;
|
||||
border-left-width: 3px;
|
||||
width: 20px;
|
||||
padding: 2px 4px 6px 1px;
|
||||
direction: rtl;
|
||||
margin-left: 40px;
|
||||
}
|
||||
.grid > div {
|
||||
background: red;
|
||||
background-clip: content-box;
|
||||
}
|
||||
.absolute {
|
||||
position: absolute;
|
||||
background: red;
|
||||
grid-column: 1 / 2;
|
||||
}
|
||||
.content {
|
||||
float: right;
|
||||
width: 20px;
|
||||
height: 40px;
|
||||
background: green;
|
||||
}
|
||||
.content:nth-child(2) {
|
||||
background: grey;
|
||||
}
|
||||
|
||||
</style></head>
|
||||
<body>
|
||||
There should be no red:
|
||||
|
||||
<div class="grid">
|
||||
<div>
|
||||
<div class="absolute">
|
||||
<div class="content"></div>
|
||||
<div class="content"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="grid" style="grid-template-columns: 43px">
|
||||
<div style="padding-left:3px">
|
||||
<div class="absolute">
|
||||
<div class="content"></div>
|
||||
<div class="content"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="grid" style="grid-template-columns: 43px">
|
||||
<div style="border-left:2px solid black; padding-left:1px">
|
||||
<div class="absolute">
|
||||
<div class="content"></div>
|
||||
<div class="content"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="grid" style="padding-top:10px">
|
||||
<div>
|
||||
<div class="absolute">
|
||||
<div class="content"></div>
|
||||
<div class="content"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="grid" style="grid-template-columns: 10px 33px; padding-right:8px">
|
||||
<div style="padding-left:3px">
|
||||
<div class="absolute" style="grid-column: 2 / 3">
|
||||
<div class="content"></div>
|
||||
<div class="content"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="grid" style="grid-template-columns: 10px 33px; padding-right:8px; padding-left:10px">
|
||||
<div style="padding-left:3px">
|
||||
<div class="absolute" style="grid-column: 2 / 3">
|
||||
<div class="content"></div>
|
||||
<div class="content"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,72 @@
|
||||
<!DOCTYPE html>
|
||||
<html><head>
|
||||
<meta charset="utf-8">
|
||||
<title>CSS Grid Layout Reference: Grid aligned descendants with static position</title>
|
||||
<link rel="author" title="Mats Palmgren" href="mailto:mats@mozilla.com">
|
||||
<style>
|
||||
.grid {
|
||||
position: relative;
|
||||
display: grid;
|
||||
grid: 40px / 40px;
|
||||
border: 2px solid;
|
||||
border-top-width: 5px;
|
||||
border-left-width: 3px;
|
||||
width: 100px;
|
||||
justify-content: end;
|
||||
padding: 2px 4px 6px 1px;
|
||||
}
|
||||
.absolute {
|
||||
position: absolute;
|
||||
grid-column: 1 / 2;
|
||||
}
|
||||
.content {
|
||||
float: left;
|
||||
width: 20px;
|
||||
height: 40px;
|
||||
background: green;
|
||||
}
|
||||
.content:nth-child(2) {
|
||||
background: grey;
|
||||
}
|
||||
|
||||
</style></head>
|
||||
<body>
|
||||
There should be no red:
|
||||
|
||||
<div class="grid">
|
||||
<div class="absolute" style="margin-top:2px">
|
||||
<div class="content"></div>
|
||||
<div class="content"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="grid" style="grid-template-columns: 43px">
|
||||
<div class="absolute" style="margin-top:2px; margin-left:3px">
|
||||
<div class="content"></div>
|
||||
<div class="content"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="grid" style="grid-template-columns: 43px">
|
||||
<div class="absolute" style="margin-top:2px; border-left:2px solid black; padding-left:1px">
|
||||
<div class="content"></div>
|
||||
<div class="content"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="grid" style="padding-bottom: 14px">
|
||||
<div class="absolute" style="margin-top:10px">
|
||||
<div class="content"></div>
|
||||
<div class="content"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="grid" style="grid-template-columns: 43px; padding-left:8px">
|
||||
<div class="absolute" style="margin-top:2px; margin-left:3px">
|
||||
<div class="content"></div>
|
||||
<div class="content"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,91 @@
|
||||
<!DOCTYPE html>
|
||||
<html><head>
|
||||
<meta charset="utf-8">
|
||||
<title>CSS Grid Layout Test: Grid aligned descendants with static position</title>
|
||||
<link rel="author" title="Mats Palmgren" href="mailto:mats@mozilla.com">
|
||||
<link rel="help" href="https://drafts.csswg.org/css-grid-1/#abspos" title="Absolute Positioning">
|
||||
<link rel="help" href="https://drafts.csswg.org/css-align-3/#staticpos-rect" title="Appendix A: Static Position Terminology">
|
||||
<link rel="match" href="descendant-static-position-003-ref.html">
|
||||
<meta name="assert" content="This test checks that the position and size of the abs.pos. descendant is correct.">
|
||||
<style>
|
||||
.grid {
|
||||
position: relative;
|
||||
display: grid;
|
||||
grid: 40px / 40px;
|
||||
border: 2px solid;
|
||||
border-top-width: 5px;
|
||||
border-left-width: 3px;
|
||||
width: 100px;
|
||||
justify-content: end;
|
||||
padding: 2px 4px 6px 1px;
|
||||
}
|
||||
.grid > div {
|
||||
background: red;
|
||||
background-clip: content-box;
|
||||
}
|
||||
.absolute {
|
||||
position: absolute;
|
||||
background: red;
|
||||
grid-column: 1 / 2;
|
||||
}
|
||||
.content {
|
||||
float: left;
|
||||
width: 20px;
|
||||
height: 40px;
|
||||
background: green;
|
||||
}
|
||||
.content:nth-child(2) {
|
||||
background: grey;
|
||||
}
|
||||
|
||||
</style></head>
|
||||
<body>
|
||||
There should be no red:
|
||||
|
||||
<div class="grid">
|
||||
<div>
|
||||
<div class="absolute">
|
||||
<div class="content"></div>
|
||||
<div class="content"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="grid" style="grid-template-columns: 43px">
|
||||
<div style="padding-left:3px">
|
||||
<div class="absolute">
|
||||
<div class="content"></div>
|
||||
<div class="content"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="grid" style="grid-template-columns: 43px">
|
||||
<div style="border-left:2px solid black; padding-left:1px">
|
||||
<div class="absolute">
|
||||
<div class="content"></div>
|
||||
<div class="content"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="grid" style="padding-top:10px">
|
||||
<div>
|
||||
<div class="absolute">
|
||||
<div class="content"></div>
|
||||
<div class="content"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="grid" style="grid-template-columns: 10px 33px; padding-left:8px">
|
||||
<div style="padding-left:3px">
|
||||
<div class="absolute" style="grid-column: 2 / 3">
|
||||
<div class="content"></div>
|
||||
<div class="content"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,81 @@
|
||||
<!DOCTYPE html>
|
||||
<html><head>
|
||||
<meta charset="utf-8">
|
||||
<title>CSS Grid Layout Reference: Grid aligned descendants with static position (direction: rtl)</title>
|
||||
<link rel="author" title="Mats Palmgren" href="mailto:mats@mozilla.com">
|
||||
<style>
|
||||
.grid {
|
||||
position: relative;
|
||||
display: grid;
|
||||
grid: 40px / 40px;
|
||||
border: 2px solid;
|
||||
border-top-width: 5px;
|
||||
border-left-width: 3px;
|
||||
width: 100px;
|
||||
justify-content: center;
|
||||
padding: 2px 4px 6px 1px;
|
||||
direction: rtl;
|
||||
margin-left: 40px;
|
||||
}
|
||||
.absolute {
|
||||
position: absolute;
|
||||
grid-column: 1 / 2;
|
||||
}
|
||||
.content {
|
||||
float: right;
|
||||
width: 20px;
|
||||
height: 40px;
|
||||
background: green;
|
||||
}
|
||||
.content:nth-child(2) {
|
||||
background: grey;
|
||||
}
|
||||
|
||||
</style></head>
|
||||
<body>
|
||||
There should be no red:
|
||||
|
||||
<div class="grid">
|
||||
<div class="absolute" style="margin-top:2px">
|
||||
<div class="content"></div>
|
||||
<div class="content"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="grid" style="grid-template-columns: 43px">
|
||||
<div class="absolute" style="margin-top:2px; margin-left:3px">
|
||||
<div class="content"></div>
|
||||
<div class="content"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="grid" style="grid-template-columns: 43px">
|
||||
<div class="absolute" style="margin-top:2px; border-left:2px solid black; padding-left:1px">
|
||||
<div class="content"></div>
|
||||
<div class="content"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="grid" style="padding-bottom: 14px">
|
||||
<div class="absolute" style="margin-top:10px">
|
||||
<div class="content"></div>
|
||||
<div class="content"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="grid" style="grid-template-columns: 43px; padding-right:8px">
|
||||
<div class="absolute" style="margin-top:2px; margin-left:3px">
|
||||
<div class="content"></div>
|
||||
<div class="content"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="grid" style="grid-template-columns: 43px; padding-right:8px; padding-left:10px">
|
||||
<div class="absolute" style="margin-top:2px;">
|
||||
<div class="content"></div>
|
||||
<div class="content"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,102 @@
|
||||
<!DOCTYPE html>
|
||||
<html><head>
|
||||
<meta charset="utf-8">
|
||||
<title>CSS Grid Layout Test: Grid aligned descendants with static position (direction: rtl)</title>
|
||||
<link rel="author" title="Mats Palmgren" href="mailto:mats@mozilla.com">
|
||||
<link rel="help" href="https://drafts.csswg.org/css-grid-1/#abspos" title="Absolute Positioning">
|
||||
<link rel="help" href="https://drafts.csswg.org/css-align-3/#staticpos-rect" title="Appendix A: Static Position Terminology">
|
||||
<link rel="match" href="descendant-static-position-004-ref.html">
|
||||
<meta name="assert" content="This test checks that the position and size of the abs.pos. descendant is correct.">
|
||||
<style>
|
||||
.grid {
|
||||
position: relative;
|
||||
display: grid;
|
||||
grid: 40px / 40px;
|
||||
border: 2px solid;
|
||||
border-top-width: 5px;
|
||||
border-left-width: 3px;
|
||||
width: 100px;
|
||||
justify-content: center;
|
||||
padding: 2px 4px 6px 1px;
|
||||
direction: rtl;
|
||||
margin-left: 40px;
|
||||
}
|
||||
.grid > div {
|
||||
background: red;
|
||||
background-clip: content-box;
|
||||
}
|
||||
.absolute {
|
||||
position: absolute;
|
||||
background: red;
|
||||
grid-column: 1 / 2;
|
||||
}
|
||||
.content {
|
||||
float: right;
|
||||
width: 20px;
|
||||
height: 40px;
|
||||
background: green;
|
||||
}
|
||||
.content:nth-child(2) {
|
||||
background: grey;
|
||||
}
|
||||
|
||||
</style></head>
|
||||
<body>
|
||||
There should be no red:
|
||||
|
||||
<div class="grid">
|
||||
<div>
|
||||
<div class="absolute">
|
||||
<div class="content"></div>
|
||||
<div class="content"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="grid" style="grid-template-columns: 43px">
|
||||
<div style="padding-left:3px">
|
||||
<div class="absolute">
|
||||
<div class="content"></div>
|
||||
<div class="content"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="grid" style="grid-template-columns: 43px">
|
||||
<div style="border-left:2px solid black; padding-left:1px">
|
||||
<div class="absolute">
|
||||
<div class="content"></div>
|
||||
<div class="content"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="grid" style="padding-top:10px">
|
||||
<div>
|
||||
<div class="absolute">
|
||||
<div class="content"></div>
|
||||
<div class="content"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="grid" style="grid-template-columns: 10px 33px; padding-right:8px">
|
||||
<div style="padding-left:3px">
|
||||
<div class="absolute" style="grid-column: 2 / 3">
|
||||
<div class="content"></div>
|
||||
<div class="content"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="grid" style="grid-template-columns: 10px 33px; padding-right:8px; padding-left:10px">
|
||||
<div style="padding-left:3px">
|
||||
<div class="absolute" style="grid-column: 2 / 3">
|
||||
<div class="content"></div>
|
||||
<div class="content"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -545,7 +545,16 @@ Readability.prototype = {
|
||||
replacement.readability = node.readability;
|
||||
|
||||
for (var i = 0; i < node.attributes.length; i++) {
|
||||
replacement.setAttribute(node.attributes[i].name, node.attributes[i].value);
|
||||
try {
|
||||
replacement.setAttribute(node.attributes[i].name, node.attributes[i].value);
|
||||
} catch (ex) {
|
||||
/* it's possible for setAttribute() to throw if the attribute name
|
||||
* isn't a valid XML Name. Such attributes can however be parsed from
|
||||
* source in HTML docs, see https://github.com/whatwg/html/issues/4275,
|
||||
* so we can hit them here and then throw. We don't care about such
|
||||
* attributes so we ignore them.
|
||||
*/
|
||||
}
|
||||
}
|
||||
return replacement;
|
||||
},
|
||||
@ -1220,6 +1229,9 @@ Readability.prototype = {
|
||||
var elementName = element.getAttribute("name");
|
||||
var elementProperty = element.getAttribute("property");
|
||||
var content = element.getAttribute("content");
|
||||
if (!content) {
|
||||
return;
|
||||
}
|
||||
var matches = null;
|
||||
var name = null;
|
||||
|
||||
|
@ -404,30 +404,6 @@ void Classifier::TableRequest(nsACString& aResult) {
|
||||
mIsTableRequestResultOutdated = false;
|
||||
}
|
||||
|
||||
nsresult Classifier::CheckURI(const nsACString& aSpec,
|
||||
const nsTArray<nsCString>& aTables,
|
||||
LookupResultArray& aResults) {
|
||||
Telemetry::AutoTimer<Telemetry::URLCLASSIFIER_CL_CHECK_TIME> timer;
|
||||
|
||||
// Get the set of fragments based on the url. This is necessary because we
|
||||
// only look up at most 5 URLs per aSpec, even if aSpec has more than 5
|
||||
// components.
|
||||
nsTArray<nsCString> fragments;
|
||||
nsresult rv = LookupCache::GetLookupFragments(aSpec, &fragments);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
LookupCacheArray cacheArray;
|
||||
for (const nsCString& table : aTables) {
|
||||
LookupResultArray results;
|
||||
rv = CheckURIFragments(fragments, table, results);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
aResults.AppendElements(results);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult Classifier::CheckURIFragments(
|
||||
const nsTArray<nsCString>& aSpecFragments, const nsACString& aTable,
|
||||
LookupResultArray& aResults) {
|
||||
|
@ -56,12 +56,6 @@ class Classifier {
|
||||
*/
|
||||
nsresult ActiveTables(nsTArray<nsCString>& aTables) const;
|
||||
|
||||
/**
|
||||
* Check a URL against the specified tables.
|
||||
*/
|
||||
nsresult CheckURI(const nsACString& aSpec, const nsTArray<nsCString>& tables,
|
||||
LookupResultArray& aResults);
|
||||
|
||||
/**
|
||||
* Check URL fragments against a specified table.
|
||||
* The fragments should be generated by |LookupCache::GetLookupFragments|
|
||||
|
@ -93,11 +93,9 @@ nsresult TablesToResponse(const nsACString& tables) {
|
||||
} // namespace safebrowsing
|
||||
} // namespace mozilla
|
||||
|
||||
namespace {
|
||||
|
||||
// This class holds a list of features, their tables, and it stores the lookup
|
||||
// results.
|
||||
class FeatureHolder final {
|
||||
class nsUrlClassifierDBService::FeatureHolder final {
|
||||
public:
|
||||
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(FeatureHolder);
|
||||
|
||||
@ -107,7 +105,8 @@ class FeatureHolder final {
|
||||
|
||||
class TableData {
|
||||
public:
|
||||
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(FeatureHolder::TableData);
|
||||
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(
|
||||
nsUrlClassifierDBService::FeatureHolder::TableData);
|
||||
|
||||
explicit TableData(const nsACString& aTable) : mTable(aTable) {}
|
||||
|
||||
@ -158,6 +157,10 @@ class FeatureHolder final {
|
||||
MOZ_ASSERT(!NS_IsMainThread());
|
||||
MOZ_ASSERT(aWorker);
|
||||
|
||||
mozilla::Telemetry::AutoTimer<
|
||||
mozilla::Telemetry::URLCLASSIFIER_CL_CHECK_TIME>
|
||||
timer;
|
||||
|
||||
// Get the set of fragments based on the url. This is necessary because we
|
||||
// only look up at most 5 URLs per aSpec, even if aSpec has more than 5
|
||||
// components.
|
||||
@ -206,6 +209,20 @@ class FeatureHolder final {
|
||||
}
|
||||
}
|
||||
|
||||
mozilla::UniquePtr<LookupResultArray> GetTableResults() const {
|
||||
mozilla::UniquePtr<LookupResultArray> results =
|
||||
mozilla::MakeUnique<LookupResultArray>();
|
||||
if (NS_WARN_IF(!results)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
for (TableData* tableData : mTableData) {
|
||||
results->AppendElements(tableData->mResults);
|
||||
}
|
||||
|
||||
return results;
|
||||
}
|
||||
|
||||
private:
|
||||
explicit FeatureHolder(nsIURI* aURI) : mURI(aURI) {
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
@ -237,8 +254,6 @@ class FeatureHolder final {
|
||||
nsTArray<RefPtr<TableData>> mTableData;
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::safebrowsing;
|
||||
|
||||
@ -294,20 +309,24 @@ nsresult nsUrlClassifierDBServiceWorker::Init(
|
||||
}
|
||||
|
||||
nsresult nsUrlClassifierDBServiceWorker::QueueLookup(
|
||||
const nsACString& spec, const nsACString& tables,
|
||||
nsIUrlClassifierLookupCallback* callback) {
|
||||
const nsACString& aKey,
|
||||
nsUrlClassifierDBService::FeatureHolder* aFeatureHolder,
|
||||
nsIUrlClassifierLookupCallback* aCallback) {
|
||||
MOZ_ASSERT(aFeatureHolder);
|
||||
MOZ_ASSERT(aCallback);
|
||||
|
||||
MutexAutoLock lock(mPendingLookupLock);
|
||||
if (gShuttingDownThread) {
|
||||
return NS_ERROR_ABORT;
|
||||
}
|
||||
|
||||
PendingLookup* lookup = mPendingLookups.AppendElement(fallible);
|
||||
if (!lookup) return NS_ERROR_OUT_OF_MEMORY;
|
||||
if (NS_WARN_IF(!lookup)) return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
lookup->mStartTime = TimeStamp::Now();
|
||||
lookup->mKey = spec;
|
||||
lookup->mCallback = callback;
|
||||
lookup->mTables = tables;
|
||||
lookup->mKey = aKey;
|
||||
lookup->mCallback = aCallback;
|
||||
lookup->mFeatureHolder = aFeatureHolder;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
@ -338,31 +357,6 @@ nsresult nsUrlClassifierDBServiceWorker::DoSingleLocalLookupWithURIFragments(
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult nsUrlClassifierDBServiceWorker::DoLocalLookupWithURI(
|
||||
const nsACString& aSpec, const nsTArray<nsCString>& aTables,
|
||||
LookupResultArray& aResults) {
|
||||
if (gShuttingDownThread) {
|
||||
return NS_ERROR_ABORT;
|
||||
}
|
||||
|
||||
MOZ_ASSERT(
|
||||
!NS_IsMainThread(),
|
||||
"DoSingleLocalLookupWithURIFragments must be on background thread");
|
||||
|
||||
// Bail if we haven't been initialized on the background thread.
|
||||
if (!mClassifier) {
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
|
||||
nsresult rv = mClassifier->CheckURI(aSpec, aTables, aResults);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
LOG(("Found %zu results.", aResults.Length()));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* Lookup up a key in the database is a two step process:
|
||||
*
|
||||
@ -375,7 +369,8 @@ nsresult nsUrlClassifierDBServiceWorker::DoLocalLookupWithURI(
|
||||
* "Simplified Regular Expression Lookup" section of the protocol doc.
|
||||
*/
|
||||
nsresult nsUrlClassifierDBServiceWorker::DoLookup(
|
||||
const nsACString& spec, const nsACString& tables,
|
||||
const nsACString& spec,
|
||||
nsUrlClassifierDBService::FeatureHolder* aFeatureHolder,
|
||||
nsIUrlClassifierLookupCallback* c) {
|
||||
if (gShuttingDownThread) {
|
||||
c->LookupComplete(nullptr);
|
||||
@ -387,25 +382,8 @@ nsresult nsUrlClassifierDBServiceWorker::DoLookup(
|
||||
clockStart = PR_IntervalNow();
|
||||
}
|
||||
|
||||
UniquePtr<LookupResultArray> results = MakeUnique<LookupResultArray>();
|
||||
if (!results) {
|
||||
c->LookupComplete(nullptr);
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
nsTArray<nsCString> tableArray;
|
||||
Classifier::SplitTables(tables, tableArray);
|
||||
|
||||
nsresult rv = DoLocalLookupWithURI(spec, tableArray, *results);
|
||||
if (NS_FAILED(rv)) {
|
||||
MOZ_ASSERT(
|
||||
results->IsEmpty(),
|
||||
"DoLocalLookupWithURI() should not return any results if it fails.");
|
||||
c->LookupComplete(nullptr);
|
||||
return rv;
|
||||
}
|
||||
|
||||
LOG(("Found %zu results.", results->Length()));
|
||||
nsresult rv = aFeatureHolder->DoLocalLookup(spec, this);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (LOG_ENABLED()) {
|
||||
PRIntervalTime clockEnd = PR_IntervalNow();
|
||||
@ -413,6 +391,14 @@ nsresult nsUrlClassifierDBServiceWorker::DoLookup(
|
||||
PR_IntervalToMilliseconds(clockEnd - clockStart)));
|
||||
}
|
||||
|
||||
UniquePtr<LookupResultArray> results = aFeatureHolder->GetTableResults();
|
||||
if (NS_WARN_IF(!results)) {
|
||||
c->LookupComplete(nullptr);
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
LOG(("Found %zu results.", results->Length()));
|
||||
|
||||
for (const RefPtr<const LookupResult> lookupResult : *results) {
|
||||
if (!lookupResult->Confirmed() &&
|
||||
mDBService->CanComplete(lookupResult->mTableName)) {
|
||||
@ -442,7 +428,7 @@ nsresult nsUrlClassifierDBServiceWorker::HandlePendingLookups() {
|
||||
mPendingLookups.RemoveElementAt(0);
|
||||
{
|
||||
MutexAutoUnlock unlock(mPendingLookupLock);
|
||||
DoLookup(lookup.mKey, lookup.mTables, lookup.mCallback);
|
||||
DoLookup(lookup.mKey, lookup.mFeatureHolder, lookup.mCallback);
|
||||
}
|
||||
double lookupTime = (TimeStamp::Now() - lookup.mStartTime).ToMilliseconds();
|
||||
Telemetry::Accumulate(Telemetry::URLCLASSIFIER_LOOKUP_TIME_2,
|
||||
@ -1617,72 +1603,15 @@ NS_INTERFACE_MAP_END
|
||||
return sUrlClassifierDBService;
|
||||
}
|
||||
|
||||
nsUrlClassifierDBService::nsUrlClassifierDBService()
|
||||
: mCheckMalware(CHECK_MALWARE_DEFAULT),
|
||||
mCheckPhishing(CHECK_PHISHING_DEFAULT),
|
||||
mCheckBlockedURIs(CHECK_BLOCKED_DEFAULT),
|
||||
mInUpdate(false) {}
|
||||
nsUrlClassifierDBService::nsUrlClassifierDBService() : mInUpdate(false) {}
|
||||
|
||||
nsUrlClassifierDBService::~nsUrlClassifierDBService() {
|
||||
sUrlClassifierDBService = nullptr;
|
||||
}
|
||||
|
||||
void AppendTables(const nsCString& aTables, nsCString& outTables) {
|
||||
if (!aTables.IsEmpty()) {
|
||||
if (!outTables.IsEmpty()) {
|
||||
outTables.Append(',');
|
||||
}
|
||||
outTables.Append(aTables);
|
||||
}
|
||||
}
|
||||
|
||||
nsresult nsUrlClassifierDBService::ReadTablesFromPrefs() {
|
||||
mCheckMalware =
|
||||
Preferences::GetBool(CHECK_MALWARE_PREF, CHECK_MALWARE_DEFAULT);
|
||||
mCheckPhishing =
|
||||
Preferences::GetBool(CHECK_PHISHING_PREF, CHECK_PHISHING_DEFAULT);
|
||||
mCheckBlockedURIs =
|
||||
Preferences::GetBool(CHECK_BLOCKED_PREF, CHECK_BLOCKED_DEFAULT);
|
||||
|
||||
nsAutoCString allTables;
|
||||
nsresult nsUrlClassifierDBService::ReadDisallowCompletionsTablesFromPrefs() {
|
||||
nsAutoCString tables;
|
||||
|
||||
mBaseTables.Truncate();
|
||||
|
||||
Preferences::GetCString(PHISH_TABLE_PREF, allTables);
|
||||
if (mCheckPhishing) {
|
||||
AppendTables(allTables, mBaseTables);
|
||||
}
|
||||
|
||||
Preferences::GetCString(MALWARE_TABLE_PREF, tables);
|
||||
AppendTables(tables, allTables);
|
||||
if (mCheckMalware) {
|
||||
AppendTables(tables, mBaseTables);
|
||||
}
|
||||
|
||||
Preferences::GetCString(BLOCKED_TABLE_PREF, tables);
|
||||
AppendTables(tables, allTables);
|
||||
if (mCheckBlockedURIs) {
|
||||
AppendTables(tables, mBaseTables);
|
||||
}
|
||||
|
||||
Preferences::GetCString(DOWNLOAD_BLOCK_TABLE_PREF, tables);
|
||||
AppendTables(tables, allTables);
|
||||
|
||||
Preferences::GetCString(DOWNLOAD_ALLOW_TABLE_PREF, tables);
|
||||
AppendTables(tables, allTables);
|
||||
|
||||
Preferences::GetCString(PASSWORD_ALLOW_TABLE_PREF, tables);
|
||||
AppendTables(tables, allTables);
|
||||
|
||||
Preferences::GetCString(TRACKING_TABLE_PREF, tables);
|
||||
AppendTables(tables, allTables);
|
||||
|
||||
Preferences::GetCString(TRACKING_WHITELIST_TABLE_PREF, tables);
|
||||
AppendTables(tables, allTables);
|
||||
|
||||
Classifier::SplitTables(allTables, mGethashTables);
|
||||
|
||||
Preferences::GetCString(DISALLOW_COMPLETION_TABLE_PREF, tables);
|
||||
Classifier::SplitTables(tables, mDisallowCompletionsTables);
|
||||
|
||||
@ -1718,7 +1647,7 @@ nsresult nsUrlClassifierDBService::Init() {
|
||||
|
||||
sGethashNoise =
|
||||
Preferences::GetUint(GETHASH_NOISE_PREF, GETHASH_NOISE_DEFAULT);
|
||||
ReadTablesFromPrefs();
|
||||
ReadDisallowCompletionsTablesFromPrefs();
|
||||
nsresult rv;
|
||||
|
||||
{
|
||||
@ -1771,16 +1700,9 @@ nsresult nsUrlClassifierDBService::Init() {
|
||||
observerService->AddObserver(this, "quit-application", false);
|
||||
observerService->AddObserver(this, "profile-before-change", false);
|
||||
|
||||
// XXX: Do we *really* need to be able to change all of these at runtime?
|
||||
// Note: These observers should only be added when everything else above has
|
||||
// succeeded. Failing to do so can cause long shutdown times in certain
|
||||
// situations. See Bug 1247798 and Bug 1244803.
|
||||
Preferences::AddUintVarCache(&sGethashNoise, GETHASH_NOISE_PREF,
|
||||
GETHASH_NOISE_DEFAULT);
|
||||
|
||||
for (uint8_t i = 0; i < kObservedPrefs.Length(); i++) {
|
||||
Preferences::AddStrongObserver(this, kObservedPrefs[i]);
|
||||
}
|
||||
Preferences::AddStrongObserver(this, DISALLOW_COMPLETION_TABLE_PREF);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
@ -1789,8 +1711,14 @@ nsresult nsUrlClassifierDBService::Init() {
|
||||
NS_IMETHODIMP
|
||||
nsUrlClassifierDBService::Classify(nsIPrincipal* aPrincipal,
|
||||
nsIEventTarget* aEventTarget,
|
||||
nsIURIClassifierCallback* c, bool* result) {
|
||||
nsIURIClassifierCallback* c, bool* aResult) {
|
||||
NS_ENSURE_ARG(aPrincipal);
|
||||
NS_ENSURE_ARG(aResult);
|
||||
|
||||
if (nsContentUtils::IsSystemPrincipal(aPrincipal)) {
|
||||
*aResult = false;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
if (XRE_IsContentProcess()) {
|
||||
using namespace mozilla::dom;
|
||||
@ -1799,7 +1727,7 @@ nsUrlClassifierDBService::Classify(nsIPrincipal* aPrincipal,
|
||||
MOZ_ASSERT(content);
|
||||
|
||||
auto actor = static_cast<URLClassifierChild*>(
|
||||
content->AllocPURLClassifierChild(IPC::Principal(aPrincipal), result));
|
||||
content->AllocPURLClassifierChild(IPC::Principal(aPrincipal), aResult));
|
||||
MOZ_ASSERT(actor);
|
||||
|
||||
if (aEventTarget) {
|
||||
@ -1813,8 +1741,8 @@ nsUrlClassifierDBService::Classify(nsIPrincipal* aPrincipal,
|
||||
content->SetEventTargetForActor(actor, systemGroupEventTarget);
|
||||
}
|
||||
if (!content->SendPURLClassifierConstructor(
|
||||
actor, IPC::Principal(aPrincipal), result)) {
|
||||
*result = false;
|
||||
actor, IPC::Principal(aPrincipal), aResult)) {
|
||||
*aResult = false;
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
@ -1824,24 +1752,63 @@ nsUrlClassifierDBService::Classify(nsIPrincipal* aPrincipal,
|
||||
|
||||
NS_ENSURE_TRUE(gDbBackgroundThread, NS_ERROR_NOT_INITIALIZED);
|
||||
|
||||
if (!(mCheckMalware || mCheckPhishing || mCheckBlockedURIs)) {
|
||||
*result = false;
|
||||
nsCOMPtr<nsIPermissionManager> permissionManager =
|
||||
services::GetPermissionManager();
|
||||
if (NS_WARN_IF(!permissionManager)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
uint32_t perm;
|
||||
nsresult rv = permissionManager->TestPermissionFromPrincipal(
|
||||
aPrincipal, "safe-browsing", &perm);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (perm == nsIPermissionManager::ALLOW_ACTION) {
|
||||
*aResult = false;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsTArray<RefPtr<nsIUrlClassifierFeature>> features;
|
||||
mozilla::net::UrlClassifierFeatureFactory::GetPhishingProtectionFeatures(
|
||||
features);
|
||||
if (features.IsEmpty()) {
|
||||
*aResult = false;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
rv = aPrincipal->GetURI(getter_AddRefs(uri));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
NS_ENSURE_TRUE(uri, NS_ERROR_FAILURE);
|
||||
|
||||
// Let's keep the features alive and release them on the correct thread.
|
||||
RefPtr<FeatureHolder> holder =
|
||||
FeatureHolder::Create(uri, features, nsIUrlClassifierFeature::blacklist);
|
||||
if (NS_WARN_IF(!holder)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
uri = NS_GetInnermostURI(uri);
|
||||
NS_ENSURE_TRUE(uri, NS_ERROR_FAILURE);
|
||||
|
||||
nsAutoCString key;
|
||||
// Canonicalize the url
|
||||
nsCOMPtr<nsIUrlClassifierUtils> utilsService =
|
||||
do_GetService(NS_URLCLASSIFIERUTILS_CONTRACTID);
|
||||
rv = utilsService->GetKeyForURI(uri, key);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
RefPtr<nsUrlClassifierClassifyCallback> callback =
|
||||
new (fallible) nsUrlClassifierClassifyCallback(c);
|
||||
|
||||
if (!callback) return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
nsresult rv = LookupURI(aPrincipal, mBaseTables, callback, false, result);
|
||||
if (rv == NS_ERROR_MALFORMED_URI) {
|
||||
*result = false;
|
||||
// The URI had no hostname, don't try to classify it.
|
||||
return NS_OK;
|
||||
if (NS_WARN_IF(!callback)) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
// The rest is done async.
|
||||
rv = LookupURI(key, holder, callback);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
*aResult = true;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -2071,28 +2038,35 @@ nsUrlClassifierDBService::Lookup(nsIPrincipal* aPrincipal,
|
||||
nsIUrlClassifierCallback* c) {
|
||||
NS_ENSURE_TRUE(gDbBackgroundThread, NS_ERROR_NOT_INITIALIZED);
|
||||
|
||||
bool dummy;
|
||||
return LookupURI(aPrincipal, tables, c, true, &dummy);
|
||||
}
|
||||
|
||||
nsresult nsUrlClassifierDBService::LookupURI(nsIPrincipal* aPrincipal,
|
||||
const nsACString& tables,
|
||||
nsIUrlClassifierCallback* c,
|
||||
bool forceLookup,
|
||||
bool* didLookup) {
|
||||
NS_ENSURE_TRUE(gDbBackgroundThread, NS_ERROR_NOT_INITIALIZED);
|
||||
NS_ENSURE_ARG(aPrincipal);
|
||||
|
||||
if (nsContentUtils::IsSystemPrincipal(aPrincipal)) {
|
||||
*didLookup = false;
|
||||
// FIXME: we don't call 'c' here!
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsTArray<nsCString> tableArray;
|
||||
Classifier::SplitTables(tables, tableArray);
|
||||
|
||||
nsCOMPtr<nsIUrlClassifierFeature> feature;
|
||||
nsresult rv =
|
||||
CreateFeatureWithTables(NS_LITERAL_CSTRING("lookup"), tableArray,
|
||||
nsTArray<nsCString>(), getter_AddRefs(feature));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
nsresult rv = aPrincipal->GetURI(getter_AddRefs(uri));
|
||||
rv = aPrincipal->GetURI(getter_AddRefs(uri));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
NS_ENSURE_TRUE(uri, NS_ERROR_FAILURE);
|
||||
|
||||
nsTArray<RefPtr<nsIUrlClassifierFeature>> features;
|
||||
features.AppendElement(feature.get());
|
||||
|
||||
// Let's keep the features alive and release them on the correct thread.
|
||||
RefPtr<FeatureHolder> holder =
|
||||
FeatureHolder::Create(uri, features, nsIUrlClassifierFeature::blacklist);
|
||||
if (NS_WARN_IF(!holder)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
uri = NS_GetInnermostURI(uri);
|
||||
NS_ENSURE_TRUE(uri, NS_ERROR_FAILURE);
|
||||
|
||||
@ -2101,44 +2075,31 @@ nsresult nsUrlClassifierDBService::LookupURI(nsIPrincipal* aPrincipal,
|
||||
nsCOMPtr<nsIUrlClassifierUtils> utilsService =
|
||||
do_GetService(NS_URLCLASSIFIERUTILS_CONTRACTID);
|
||||
rv = utilsService->GetKeyForURI(uri, key);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (forceLookup) {
|
||||
*didLookup = true;
|
||||
} else {
|
||||
nsCOMPtr<nsIPermissionManager> permissionManager =
|
||||
services::GetPermissionManager();
|
||||
if (NS_WARN_IF(!permissionManager)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
return LookupURI(key, holder, c);
|
||||
}
|
||||
|
||||
uint32_t perm;
|
||||
rv = permissionManager->TestPermissionFromPrincipal(aPrincipal,
|
||||
"safe-browsing", &perm);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
nsresult nsUrlClassifierDBService::LookupURI(
|
||||
const nsACString& aKey, FeatureHolder* aHolder,
|
||||
nsIUrlClassifierCallback* aCallback) {
|
||||
MOZ_ASSERT(aHolder);
|
||||
MOZ_ASSERT(aCallback);
|
||||
|
||||
bool clean = (perm == nsIPermissionManager::ALLOW_ACTION);
|
||||
*didLookup = !clean;
|
||||
if (clean) {
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
NS_ENSURE_TRUE(gDbBackgroundThread, NS_ERROR_NOT_INITIALIZED);
|
||||
|
||||
// Create an nsUrlClassifierLookupCallback object. This object will
|
||||
// take care of confirming partial hash matches if necessary before
|
||||
// calling the client's callback.
|
||||
nsCOMPtr<nsIUrlClassifierLookupCallback> callback =
|
||||
new (fallible) nsUrlClassifierLookupCallback(this, c);
|
||||
if (!callback) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
new nsUrlClassifierLookupCallback(this, aCallback);
|
||||
|
||||
nsCOMPtr<nsIUrlClassifierLookupCallback> proxyCallback =
|
||||
new UrlClassifierLookupCallbackProxy(callback);
|
||||
|
||||
// Queue this lookup and call the lookup function to flush the queue if
|
||||
// necessary.
|
||||
rv = mWorker->QueueLookup(key, tables, proxyCallback);
|
||||
nsresult rv = mWorker->QueueLookup(aKey, aHolder, proxyCallback);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// This seems to just call HandlePendingLookups.
|
||||
@ -2307,8 +2268,7 @@ nsresult nsUrlClassifierDBService::CacheCompletions(
|
||||
}
|
||||
|
||||
bool nsUrlClassifierDBService::CanComplete(const nsACString& aTableName) {
|
||||
return mGethashTables.Contains(aTableName) &&
|
||||
!mDisallowCompletionsTables.Contains(aTableName);
|
||||
return !mDisallowCompletionsTables.Contains(aTableName);
|
||||
}
|
||||
|
||||
bool nsUrlClassifierDBService::GetCompleter(
|
||||
@ -2332,14 +2292,7 @@ NS_IMETHODIMP
|
||||
nsUrlClassifierDBService::Observe(nsISupports* aSubject, const char* aTopic,
|
||||
const char16_t* aData) {
|
||||
if (!strcmp(aTopic, NS_PREFBRANCH_PREFCHANGE_TOPIC_ID)) {
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIPrefBranch> prefs(do_QueryInterface(aSubject, &rv));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
Unused << prefs;
|
||||
|
||||
if (kObservedPrefs.Contains(NS_ConvertUTF16toUTF8(aData))) {
|
||||
ReadTablesFromPrefs();
|
||||
}
|
||||
ReadDisallowCompletionsTablesFromPrefs();
|
||||
} else if (!strcmp(aTopic, "quit-application")) {
|
||||
// Tell the update thread to finish as soon as possible.
|
||||
gShuttingDownThread = true;
|
||||
@ -2389,9 +2342,7 @@ nsresult nsUrlClassifierDBService::Shutdown() {
|
||||
|
||||
nsCOMPtr<nsIPrefBranch> prefs = do_GetService(NS_PREFSERVICE_CONTRACTID);
|
||||
if (prefs) {
|
||||
for (uint8_t i = 0; i < kObservedPrefs.Length(); i++) {
|
||||
prefs->RemoveObserver(kObservedPrefs[i], this);
|
||||
}
|
||||
prefs->RemoveObserver(DISALLOW_COMPLETION_TABLE_PREF, this);
|
||||
}
|
||||
|
||||
// 1. Synchronize with worker thread and update thread by
|
||||
|
@ -43,26 +43,8 @@
|
||||
// The hash length of a complete hash entry.
|
||||
#define COMPLETE_LENGTH 32
|
||||
|
||||
// Prefs for implementing nsIURIClassifier to block page loads
|
||||
#define CHECK_MALWARE_PREF "browser.safebrowsing.malware.enabled"
|
||||
#define CHECK_MALWARE_DEFAULT false
|
||||
|
||||
#define CHECK_PHISHING_PREF "browser.safebrowsing.phishing.enabled"
|
||||
#define CHECK_PHISHING_DEFAULT false
|
||||
|
||||
#define CHECK_BLOCKED_PREF "browser.safebrowsing.blockedURIs.enabled"
|
||||
#define CHECK_BLOCKED_DEFAULT false
|
||||
|
||||
// Comma-separated lists
|
||||
#define MALWARE_TABLE_PREF "urlclassifier.malwareTable"
|
||||
#define PHISH_TABLE_PREF "urlclassifier.phishTable"
|
||||
#define TRACKING_TABLE_PREF "urlclassifier.trackingTable"
|
||||
#define TRACKING_WHITELIST_TABLE_PREF "urlclassifier.trackingWhitelistTable"
|
||||
#define BLOCKED_TABLE_PREF "urlclassifier.blockedTable"
|
||||
#define DOWNLOAD_BLOCK_TABLE_PREF "urlclassifier.downloadBlockTable"
|
||||
#define DOWNLOAD_ALLOW_TABLE_PREF "urlclassifier.downloadAllowTable"
|
||||
#define DISALLOW_COMPLETION_TABLE_PREF "urlclassifier.disallow_completions"
|
||||
#define PASSWORD_ALLOW_TABLE_PREF "urlclassifier.passwordAllowTable"
|
||||
|
||||
using namespace mozilla::safebrowsing;
|
||||
|
||||
@ -96,6 +78,8 @@ class nsUrlClassifierDBService final : public nsIUrlClassifierDBService,
|
||||
friend class mozilla::net::AsyncUrlChannelClassifier;
|
||||
|
||||
public:
|
||||
class FeatureHolder;
|
||||
|
||||
// This is thread safe. It throws an exception if the thread is busy.
|
||||
nsUrlClassifierDBService();
|
||||
|
||||
@ -126,28 +110,14 @@ class nsUrlClassifierDBService final : public nsIUrlClassifierDBService,
|
||||
// it, please contact a safebrowsing/URL-Classifier peer.
|
||||
static nsUrlClassifierDBServiceWorker* GetWorker();
|
||||
|
||||
const nsTArray<nsCString> kObservedPrefs = {
|
||||
NS_LITERAL_CSTRING(CHECK_MALWARE_PREF),
|
||||
NS_LITERAL_CSTRING(CHECK_PHISHING_PREF),
|
||||
NS_LITERAL_CSTRING(CHECK_BLOCKED_PREF),
|
||||
NS_LITERAL_CSTRING(MALWARE_TABLE_PREF),
|
||||
NS_LITERAL_CSTRING(PHISH_TABLE_PREF),
|
||||
NS_LITERAL_CSTRING(TRACKING_TABLE_PREF),
|
||||
NS_LITERAL_CSTRING(TRACKING_WHITELIST_TABLE_PREF),
|
||||
NS_LITERAL_CSTRING(BLOCKED_TABLE_PREF),
|
||||
NS_LITERAL_CSTRING(DOWNLOAD_BLOCK_TABLE_PREF),
|
||||
NS_LITERAL_CSTRING(DOWNLOAD_ALLOW_TABLE_PREF),
|
||||
NS_LITERAL_CSTRING(DISALLOW_COMPLETION_TABLE_PREF)};
|
||||
|
||||
// No subclassing
|
||||
~nsUrlClassifierDBService();
|
||||
|
||||
// Disallow copy constructor
|
||||
nsUrlClassifierDBService(nsUrlClassifierDBService&);
|
||||
|
||||
nsresult LookupURI(nsIPrincipal* aPrincipal, const nsACString& tables,
|
||||
nsIUrlClassifierCallback* c, bool forceCheck,
|
||||
bool* didCheck);
|
||||
nsresult LookupURI(const nsACString& aKey, FeatureHolder* aHolder,
|
||||
nsIUrlClassifierCallback* c);
|
||||
|
||||
// Post an event to worker thread to release objects when receive
|
||||
// 'quit-application'
|
||||
@ -156,7 +126,7 @@ class nsUrlClassifierDBService final : public nsIUrlClassifierDBService,
|
||||
// Close db connection and join the background thread if it exists.
|
||||
nsresult Shutdown();
|
||||
|
||||
nsresult ReadTablesFromPrefs();
|
||||
nsresult ReadDisallowCompletionsTablesFromPrefs();
|
||||
|
||||
// This method checks if the classification can be done just using
|
||||
// preferences. It returns true if the operation has been completed.
|
||||
@ -171,33 +141,15 @@ class nsUrlClassifierDBService final : public nsIUrlClassifierDBService,
|
||||
nsInterfaceHashtable<nsCStringHashKey, nsIUrlClassifierHashCompleter>
|
||||
mCompleters;
|
||||
|
||||
// TRUE if the nsURIClassifier implementation should check for malware
|
||||
// uris on document loads.
|
||||
bool mCheckMalware;
|
||||
|
||||
// TRUE if the nsURIClassifier implementation should check for phishing
|
||||
// uris on document loads.
|
||||
bool mCheckPhishing;
|
||||
|
||||
// TRUE if the nsURIClassifier implementation should check for blocked
|
||||
// uris on document loads.
|
||||
bool mCheckBlockedURIs;
|
||||
|
||||
// TRUE if a BeginUpdate() has been called without an accompanying
|
||||
// CancelUpdate()/FinishUpdate(). This is used to prevent competing
|
||||
// updates, not to determine whether an update is still being
|
||||
// processed.
|
||||
bool mInUpdate;
|
||||
|
||||
// The list of tables that can use the default hash completer object.
|
||||
nsTArray<nsCString> mGethashTables;
|
||||
|
||||
// The list of tables that should never be hash completed.
|
||||
nsTArray<nsCString> mDisallowCompletionsTables;
|
||||
|
||||
// Comma-separated list of tables to use in lookups.
|
||||
nsCString mBaseTables;
|
||||
|
||||
// Thread that we do the updates on.
|
||||
static nsIThread* gDbBackgroundThread;
|
||||
};
|
||||
@ -213,9 +165,9 @@ class nsUrlClassifierDBServiceWorker final : public nsIUrlClassifierDBService {
|
||||
nsUrlClassifierDBService* aDBService);
|
||||
|
||||
// Queue a lookup for the worker to perform, called in the main thread.
|
||||
// tables is a comma-separated list of tables to query
|
||||
nsresult QueueLookup(const nsACString& lookupKey, const nsACString& tables,
|
||||
nsIUrlClassifierLookupCallback* callback);
|
||||
nsresult QueueLookup(const nsACString& aLookupKey,
|
||||
nsUrlClassifierDBService::FeatureHolder* aFeatureHolder,
|
||||
nsIUrlClassifierLookupCallback* aLallback);
|
||||
|
||||
// Handle any queued-up lookups. We call this function during long-running
|
||||
// update operations to prevent lookups from blocking for too long.
|
||||
@ -226,9 +178,6 @@ class nsUrlClassifierDBServiceWorker final : public nsIUrlClassifierDBService {
|
||||
nsresult DoSingleLocalLookupWithURIFragments(
|
||||
const nsTArray<nsCString>& aSpecFragments, const nsACString& aTable,
|
||||
LookupResultArray& aResults);
|
||||
nsresult DoLocalLookupWithURI(const nsACString& aSpec,
|
||||
const nsTArray<nsCString>& aTables,
|
||||
LookupResultArray& aResults);
|
||||
|
||||
// Open the DB connection
|
||||
nsresult GCC_MANGLING_WORKAROUND OpenDb();
|
||||
@ -275,7 +224,8 @@ class nsUrlClassifierDBServiceWorker final : public nsIUrlClassifierDBService {
|
||||
void ResetUpdate();
|
||||
|
||||
// Perform a classifier lookup for a given url.
|
||||
nsresult DoLookup(const nsACString& spec, const nsACString& tables,
|
||||
nsresult DoLookup(const nsACString& spec,
|
||||
nsUrlClassifierDBService::FeatureHolder* aFeatureHolder,
|
||||
nsIUrlClassifierLookupCallback* c);
|
||||
|
||||
nsresult AddNoise(const Prefix aPrefix, const nsCString tableName,
|
||||
@ -319,7 +269,7 @@ class nsUrlClassifierDBServiceWorker final : public nsIUrlClassifierDBService {
|
||||
public:
|
||||
mozilla::TimeStamp mStartTime;
|
||||
nsCString mKey;
|
||||
nsCString mTables;
|
||||
RefPtr<nsUrlClassifierDBService::FeatureHolder> mFeatureHolder;
|
||||
nsCOMPtr<nsIUrlClassifierLookupCallback> mCallback;
|
||||
};
|
||||
|
||||
|
@ -102,29 +102,6 @@ UrlClassifierDBServiceWorkerProxy::FinishStream() {
|
||||
return DispatchToWorkerThread(r);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
UrlClassifierDBServiceWorkerProxy::DoLocalLookupRunnable::Run() {
|
||||
mTarget->DoLocalLookupWithURI(mSpec, mTables, mResults);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult UrlClassifierDBServiceWorkerProxy::DoLocalLookupWithURI(
|
||||
const nsACString& spec, const nsTArray<nsCString>& tables,
|
||||
LookupResultArray& results) const
|
||||
|
||||
{
|
||||
// Run synchronously on background thread. NS_DISPATCH_SYNC does *not* do
|
||||
// what we want -- it continues processing events on the main thread loop
|
||||
// before the Dispatch returns.
|
||||
nsCOMPtr<nsIRunnable> r =
|
||||
new DoLocalLookupRunnable(mTarget, spec, tables, results);
|
||||
nsIThread* t = nsUrlClassifierDBService::BackgroundThread();
|
||||
if (!t) return NS_ERROR_FAILURE;
|
||||
|
||||
mozilla::SyncRunnable::DispatchToThread(t, r);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
UrlClassifierDBServiceWorkerProxy::FinishUpdate() {
|
||||
nsCOMPtr<nsIRunnable> r =
|
||||
|
@ -132,27 +132,6 @@ class UrlClassifierDBServiceWorkerProxy final
|
||||
const mozilla::safebrowsing::ConstCacheResultArray mEntries;
|
||||
};
|
||||
|
||||
class DoLocalLookupRunnable : public mozilla::Runnable {
|
||||
public:
|
||||
DoLocalLookupRunnable(nsUrlClassifierDBServiceWorker* aTarget,
|
||||
const nsACString& spec,
|
||||
const nsTArray<nsCString>& tables,
|
||||
mozilla::safebrowsing::LookupResultArray& results)
|
||||
: mozilla::Runnable(
|
||||
"UrlClassifierDBServiceWorkerProxy::DoLocalLookupRunnable"),
|
||||
mTarget(aTarget),
|
||||
mSpec(spec),
|
||||
mTables(tables),
|
||||
mResults(results) {}
|
||||
|
||||
NS_DECL_NSIRUNNABLE
|
||||
private:
|
||||
const RefPtr<nsUrlClassifierDBServiceWorker> mTarget;
|
||||
const nsCString mSpec;
|
||||
const nsTArray<nsCString> mTables;
|
||||
mozilla::safebrowsing::LookupResultArray& mResults;
|
||||
};
|
||||
|
||||
class ClearLastResultsRunnable : public mozilla::Runnable {
|
||||
public:
|
||||
explicit ClearLastResultsRunnable(nsUrlClassifierDBServiceWorker* aTarget)
|
||||
@ -205,10 +184,6 @@ class UrlClassifierDBServiceWorkerProxy final
|
||||
};
|
||||
|
||||
public:
|
||||
nsresult DoLocalLookupWithURI(
|
||||
const nsACString& spec, const nsTArray<nsCString>& tables,
|
||||
mozilla::safebrowsing::LookupResultArray& results) const;
|
||||
|
||||
nsresult OpenDb() const;
|
||||
nsresult CloseDb() const;
|
||||
nsresult PreShutdown() const;
|
||||
|
@ -12,6 +12,7 @@
|
||||
|
||||
#include "mozilla/dom/PBrowserChild.h"
|
||||
#include "mozilla/dom/ContentChild.h"
|
||||
#include "mozilla/dom/PWindowGlobalChild.h"
|
||||
#include "mozilla/layers/CompositorBridgeChild.h"
|
||||
|
||||
namespace mozilla {
|
||||
@ -122,6 +123,22 @@ static bool HandleMessageInMiddleman(ipc::Side aSide,
|
||||
return true;
|
||||
}
|
||||
|
||||
// PWindowGlobal messages could be going to actors in either process.
|
||||
// Receive them here if there is an actor with the right routing ID.
|
||||
if (type >= dom::PWindowGlobal::PWindowGlobalStart &&
|
||||
type <= dom::PWindowGlobal::PWindowGlobalEnd) {
|
||||
dom::ContentChild* contentChild = dom::ContentChild::GetSingleton();
|
||||
|
||||
ipc::IProtocol* actor = contentChild->Lookup(aMessage.routing_id());
|
||||
if (actor) {
|
||||
ipc::IProtocol::Result r =
|
||||
contentChild->PContentChild::OnMessageReceived(aMessage);
|
||||
MOZ_RELEASE_ASSERT(r == ipc::IProtocol::MsgProcessed);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -4717,7 +4717,7 @@ bool XRE_IsE10sParentProcess() {
|
||||
#undef GECKO_PROCESS_TYPE
|
||||
|
||||
bool XRE_UseNativeEventProcessing() {
|
||||
#ifdef XP_MACOSX
|
||||
#if defined(XP_MACOSX) || defined(XP_WIN)
|
||||
if (XRE_IsRDDProcess() || XRE_IsSocketProcess()) {
|
||||
return false;
|
||||
}
|
||||
@ -4737,6 +4737,18 @@ bool XRE_UseNativeEventProcessing() {
|
||||
return true;
|
||||
}
|
||||
|
||||
#if defined(XP_WIN)
|
||||
bool XRE_Win32kCallsAllowed() {
|
||||
switch (XRE_GetProcessType()) {
|
||||
case GeckoProcessType_GMPlugin:
|
||||
case GeckoProcessType_RDD:
|
||||
return false;
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// If you add anything to this enum, please update about:support to reflect it
|
||||
enum {
|
||||
kE10sEnabledByUser = 0,
|
||||
|
@ -323,9 +323,11 @@ nsresult nsAppShell::Init() {
|
||||
|
||||
mozilla::ipc::windows::InitUIThread();
|
||||
|
||||
sTaskbarButtonCreatedMsg = ::RegisterWindowMessageW(kTaskbarButtonEventId);
|
||||
NS_ASSERTION(sTaskbarButtonCreatedMsg,
|
||||
"Could not register taskbar button creation message");
|
||||
if (XRE_Win32kCallsAllowed()) {
|
||||
sTaskbarButtonCreatedMsg = ::RegisterWindowMessageW(kTaskbarButtonEventId);
|
||||
NS_ASSERTION(sTaskbarButtonCreatedMsg,
|
||||
"Could not register taskbar button creation message");
|
||||
}
|
||||
|
||||
// The hidden message window is used for interrupting the processing of native
|
||||
// events, so that we can process gecko events. Therefore, we only need it if
|
||||
@ -354,7 +356,7 @@ nsresult nsAppShell::Init() {
|
||||
mEventWnd = CreateWindowW(kWindowClass, L"nsAppShell:EventWindow", 0, 0, 0,
|
||||
10, 10, HWND_MESSAGE, nullptr, module, nullptr);
|
||||
NS_ENSURE_STATE(mEventWnd);
|
||||
} else {
|
||||
} else if (XRE_IsContentProcess()) {
|
||||
// We're not generally processing native events, but still using GDI and we
|
||||
// still have some internal windows, e.g. from calling CoInitializeEx.
|
||||
// So we use a class that will do a single event pump where previously we
|
||||
|
@ -451,6 +451,14 @@ XRE_API(bool, XRE_IsSocketProcess, ())
|
||||
*/
|
||||
XRE_API(bool, XRE_UseNativeEventProcessing, ())
|
||||
|
||||
#if defined(XP_WIN)
|
||||
/**
|
||||
* @returns true if win32k calls are allowed in this process type, false if
|
||||
* win32k is (or should be) disabled.
|
||||
*/
|
||||
XRE_API(bool, XRE_Win32kCallsAllowed, ())
|
||||
#endif
|
||||
|
||||
typedef void (*MainFunction)(void* aData);
|
||||
|
||||
XRE_API(nsresult, XRE_InitParentProcess,
|
||||
|
Loading…
Reference in New Issue
Block a user