mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-11 10:08:41 +00:00
Merge inbound to mozilla-central. a=merge
This commit is contained in:
commit
9801931bda
@ -77,6 +77,10 @@ browser/base/content/newtab/**
|
||||
# Test files that are really json not js, and don't need to be linted.
|
||||
browser/components/sessionstore/test/unit/data/sessionstore_valid.js
|
||||
browser/components/sessionstore/test/unit/data/sessionstore_invalid.js
|
||||
# This file is split into two in order to keep it as a valid json file
|
||||
# for documentation purposes (policies.json) but to be accessed by the
|
||||
# code as a .jsm (schema.jsm)
|
||||
browser/components/enterprisepolicies/schemas/schema.jsm
|
||||
# generated & special files in cld2
|
||||
browser/components/translation/cld2/**
|
||||
# Screenshots and Follow-on search are imported as a system add-on and have
|
||||
|
358
browser/components/enterprisepolicies/EnterprisePolicies.js
Normal file
358
browser/components/enterprisepolicies/EnterprisePolicies.js
Normal file
@ -0,0 +1,358 @@
|
||||
/* 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/. */
|
||||
|
||||
const Ci = Components.interfaces;
|
||||
const Cc = Components.classes;
|
||||
const Cr = Components.results;
|
||||
const Cu = Components.utils;
|
||||
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
Cu.import("resource://gre/modules/AppConstants.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetters(this, {
|
||||
NetUtil: "resource://gre/modules/NetUtil.jsm",
|
||||
Policies: "resource:///modules/policies/Policies.jsm",
|
||||
PoliciesValidator: "resource:///modules/policies/PoliciesValidator.jsm",
|
||||
});
|
||||
|
||||
// This is the file that will be searched for in the
|
||||
// ${InstallDir}/distribution folder.
|
||||
const POLICIES_FILENAME = "policies.json";
|
||||
|
||||
// For easy testing, modify the helpers/sample.json file,
|
||||
// and set PREF_ALTERNATE_PATH in firefox.js as:
|
||||
// /your/repo/browser/components/enterprisepolicies/helpers/sample.json
|
||||
const PREF_ALTERNATE_PATH = "browser.policies.alternatePath";
|
||||
|
||||
// This pref is meant to be temporary: it will only be used while we're
|
||||
// testing this feature without rolling it out officially. When the
|
||||
// policy engine is released, this pref should be removed.
|
||||
const PREF_ENABLED = "browser.policies.enabled";
|
||||
const PREF_LOGLEVEL = "browser.policies.loglevel";
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "log", () => {
|
||||
let { ConsoleAPI } = Cu.import("resource://gre/modules/Console.jsm", {});
|
||||
return new ConsoleAPI({
|
||||
prefix: "Enterprise Policies",
|
||||
// tip: set maxLogLevel to "debug" and use log.debug() to create detailed
|
||||
// messages during development. See LOG_LEVELS in Console.jsm for details.
|
||||
maxLogLevel: "error",
|
||||
maxLogLevelPref: PREF_LOGLEVEL,
|
||||
});
|
||||
});
|
||||
|
||||
// ==== Start XPCOM Boilerplate ==== \\
|
||||
|
||||
// Factory object
|
||||
const EnterprisePoliciesFactory = {
|
||||
_instance: null,
|
||||
createInstance: function BGSF_createInstance(outer, iid) {
|
||||
if (outer != null)
|
||||
throw Components.results.NS_ERROR_NO_AGGREGATION;
|
||||
return this._instance == null ?
|
||||
this._instance = new EnterprisePoliciesManager() : this._instance;
|
||||
}
|
||||
};
|
||||
|
||||
// ==== End XPCOM Boilerplate ==== //
|
||||
|
||||
// Constructor
|
||||
function EnterprisePoliciesManager() {
|
||||
Services.obs.addObserver(this, "profile-after-change", true);
|
||||
Services.obs.addObserver(this, "final-ui-startup", true);
|
||||
Services.obs.addObserver(this, "sessionstore-windows-restored", true);
|
||||
Services.obs.addObserver(this, "EnterprisePolicies:Restart", true);
|
||||
}
|
||||
|
||||
EnterprisePoliciesManager.prototype = {
|
||||
// for XPCOM
|
||||
classID: Components.ID("{ea4e1414-779b-458b-9d1f-d18e8efbc145}"),
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver,
|
||||
Ci.nsISupportsWeakReference,
|
||||
Ci.nsIEnterprisePolicies]),
|
||||
|
||||
// redefine the default factory for XPCOMUtils
|
||||
_xpcom_factory: EnterprisePoliciesFactory,
|
||||
|
||||
_initialize() {
|
||||
if (!Services.prefs.getBoolPref(PREF_ENABLED, false)) {
|
||||
this.status = Ci.nsIEnterprisePolicies.INACTIVE;
|
||||
return;
|
||||
}
|
||||
|
||||
this._file = new JSONFileReader(getConfigurationFile());
|
||||
this._file.readData();
|
||||
|
||||
if (!this._file.exists) {
|
||||
this.status = Ci.nsIEnterprisePolicies.INACTIVE;
|
||||
return;
|
||||
}
|
||||
|
||||
if (this._file.failed) {
|
||||
this.status = Ci.nsIEnterprisePolicies.FAILED;
|
||||
return;
|
||||
}
|
||||
|
||||
this.status = Ci.nsIEnterprisePolicies.ACTIVE;
|
||||
this._activatePolicies();
|
||||
},
|
||||
|
||||
_activatePolicies() {
|
||||
let { schema } = Cu.import("resource:///modules/policies/schema.jsm", {});
|
||||
let json = this._file.json;
|
||||
|
||||
for (let policyName of Object.keys(json.policies)) {
|
||||
let policySchema = schema.properties[policyName];
|
||||
let policyParameters = json.policies[policyName];
|
||||
|
||||
if (!policySchema) {
|
||||
log.error(`Unknown policy: ${policyName}`);
|
||||
continue;
|
||||
}
|
||||
|
||||
let [parametersAreValid, parsedParameters] =
|
||||
PoliciesValidator.validateAndParseParameters(policyParameters,
|
||||
policySchema);
|
||||
|
||||
if (!parametersAreValid) {
|
||||
log.error(`Invalid parameters specified for ${policyName}.`);
|
||||
continue;
|
||||
}
|
||||
|
||||
let policyImpl = Policies[policyName];
|
||||
|
||||
for (let timing of Object.keys(this._callbacks)) {
|
||||
let policyCallback = policyImpl["on" + timing];
|
||||
if (policyCallback) {
|
||||
this._schedulePolicyCallback(
|
||||
timing,
|
||||
policyCallback.bind(null,
|
||||
this, /* the EnterprisePoliciesManager */
|
||||
parsedParameters));
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
_callbacks: {
|
||||
BeforeAddons: [],
|
||||
ProfileAfterChange: [],
|
||||
BeforeUIStartup: [],
|
||||
AllWindowsRestored: [],
|
||||
},
|
||||
|
||||
_schedulePolicyCallback(timing, callback) {
|
||||
this._callbacks[timing].push(callback);
|
||||
},
|
||||
|
||||
_runPoliciesCallbacks(timing) {
|
||||
let callbacks = this._callbacks[timing];
|
||||
while (callbacks.length > 0) {
|
||||
let callback = callbacks.shift();
|
||||
try {
|
||||
callback();
|
||||
} catch (ex) {
|
||||
log.error("Error running ", callback, `for ${timing}:`, ex);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
async _restart() {
|
||||
if (!Cu.isInAutomation) {
|
||||
return;
|
||||
}
|
||||
|
||||
DisallowedFeatures = {};
|
||||
|
||||
this._status = Ci.nsIEnterprisePolicies.UNINITIALIZED;
|
||||
for (let timing of Object.keys(this._callbacks)) {
|
||||
this._callbacks[timing] = [];
|
||||
}
|
||||
delete Services.ppmm.initialProcessData.policies;
|
||||
Services.ppmm.broadcastAsyncMessage("EnterprisePolicies:Restart", null);
|
||||
|
||||
let { PromiseUtils } = Cu.import("resource://gre/modules/PromiseUtils.jsm",
|
||||
{});
|
||||
|
||||
// Simulate the startup process. This step-by-step is a bit ugly but it
|
||||
// tries to emulate the same behavior as of a normal startup.
|
||||
|
||||
await PromiseUtils.idleDispatch(() => {
|
||||
this.observe(null, "policies-startup", null);
|
||||
});
|
||||
|
||||
await PromiseUtils.idleDispatch(() => {
|
||||
this.observe(null, "profile-after-change", null);
|
||||
});
|
||||
|
||||
await PromiseUtils.idleDispatch(() => {
|
||||
this.observe(null, "final-ui-startup", null);
|
||||
});
|
||||
|
||||
await PromiseUtils.idleDispatch(() => {
|
||||
this.observe(null, "sessionstore-windows-restored", null);
|
||||
});
|
||||
},
|
||||
|
||||
// nsIObserver implementation
|
||||
observe: function BG_observe(subject, topic, data) {
|
||||
switch (topic) {
|
||||
case "policies-startup":
|
||||
this._initialize();
|
||||
this._runPoliciesCallbacks("BeforeAddons");
|
||||
break;
|
||||
|
||||
case "profile-after-change":
|
||||
// Before the first set of policy callbacks runs, we must
|
||||
// initialize the service.
|
||||
this._runPoliciesCallbacks("ProfileAfterChange");
|
||||
break;
|
||||
|
||||
case "final-ui-startup":
|
||||
this._runPoliciesCallbacks("BeforeUIStartup");
|
||||
break;
|
||||
|
||||
case "sessionstore-windows-restored":
|
||||
this._runPoliciesCallbacks("AllWindowsRestored");
|
||||
|
||||
// After the last set of policy callbacks ran, notify the test observer.
|
||||
Services.obs.notifyObservers(null,
|
||||
"EnterprisePolicies:AllPoliciesApplied");
|
||||
break;
|
||||
|
||||
case "EnterprisePolicies:Restart":
|
||||
this._restart().then(null, Cu.reportError);
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
||||
disallowFeature(feature, neededOnContentProcess = false) {
|
||||
DisallowedFeatures[feature] = true;
|
||||
|
||||
// NOTE: For optimization purposes, only features marked as needed
|
||||
// on content process will be passed onto the child processes.
|
||||
if (neededOnContentProcess) {
|
||||
Services.ppmm.initialProcessData.policies
|
||||
.disallowedFeatures.push(feature);
|
||||
|
||||
if (Services.ppmm.childCount > 1) {
|
||||
// If there has been a content process already initialized, let's
|
||||
// broadcast the newly disallowed feature.
|
||||
Services.ppmm.broadcastAsyncMessage(
|
||||
"EnterprisePolicies:DisallowFeature", {feature}
|
||||
);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
// ------------------------------
|
||||
// public nsIEnterprisePolicies members
|
||||
// ------------------------------
|
||||
|
||||
_status: Ci.nsIEnterprisePolicies.UNINITIALIZED,
|
||||
|
||||
set status(val) {
|
||||
this._status = val;
|
||||
if (val != Ci.nsIEnterprisePolicies.INACTIVE) {
|
||||
Services.ppmm.initialProcessData.policies = {
|
||||
status: val,
|
||||
disallowedFeatures: [],
|
||||
};
|
||||
}
|
||||
return val;
|
||||
},
|
||||
|
||||
get status() {
|
||||
return this._status;
|
||||
},
|
||||
|
||||
isAllowed: function BG_sanitize(feature) {
|
||||
return !(feature in DisallowedFeatures);
|
||||
},
|
||||
};
|
||||
|
||||
let DisallowedFeatures = {};
|
||||
|
||||
function JSONFileReader(file) {
|
||||
this._file = file;
|
||||
this._data = {
|
||||
exists: null,
|
||||
failed: false,
|
||||
json: null,
|
||||
};
|
||||
}
|
||||
|
||||
JSONFileReader.prototype = {
|
||||
get exists() {
|
||||
if (this._data.exists === null) {
|
||||
this.readData();
|
||||
}
|
||||
|
||||
return this._data.exists;
|
||||
},
|
||||
|
||||
get failed() {
|
||||
return this._data.failed;
|
||||
},
|
||||
|
||||
get json() {
|
||||
if (this._data.failed) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (this._data.json === null) {
|
||||
this.readData();
|
||||
}
|
||||
|
||||
return this._data.json;
|
||||
},
|
||||
|
||||
readData() {
|
||||
try {
|
||||
let data = Cu.readUTF8File(this._file);
|
||||
if (data) {
|
||||
this._data.exists = true;
|
||||
this._data.json = JSON.parse(data);
|
||||
} else {
|
||||
this._data.exists = false;
|
||||
}
|
||||
} catch (ex) {
|
||||
if (ex instanceof Components.Exception &&
|
||||
ex.result == Cr.NS_ERROR_FILE_NOT_FOUND) {
|
||||
this._data.exists = false;
|
||||
} else if (ex instanceof SyntaxError) {
|
||||
log.error("Error parsing JSON file");
|
||||
this._data.failed = true;
|
||||
} else {
|
||||
log.error("Error reading file");
|
||||
this._data.failed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
function getConfigurationFile() {
|
||||
let configFile = Services.dirsvc.get("XREAppDist", Ci.nsIFile);
|
||||
configFile.append(POLICIES_FILENAME);
|
||||
|
||||
let prefType = Services.prefs.getPrefType(PREF_ALTERNATE_PATH);
|
||||
|
||||
if ((prefType == Services.prefs.PREF_STRING) && !configFile.exists()) {
|
||||
// We only want to use the alternate file path if the file on the install
|
||||
// folder doesn't exist. Otherwise it'd be possible for a user to override
|
||||
// the admin-provided policies by changing the user-controlled prefs.
|
||||
// This pref is only meant for tests, so it's fine to use this extra
|
||||
// synchronous configFile.exists() above.
|
||||
configFile = Cc["@mozilla.org/file/local;1"]
|
||||
.createInstance(Ci.nsIFile);
|
||||
let alternatePath = Services.prefs.getStringPref(PREF_ALTERNATE_PATH);
|
||||
configFile.initWithPath(alternatePath);
|
||||
}
|
||||
|
||||
return configFile;
|
||||
}
|
||||
|
||||
var components = [EnterprisePoliciesManager];
|
||||
this.NSGetFactory = XPCOMUtils.generateNSGetFactory(components);
|
@ -0,0 +1,5 @@
|
||||
component {ea4e1414-779b-458b-9d1f-d18e8efbc145} EnterprisePolicies.js process=main
|
||||
contract @mozilla.org/browser/enterprisepolicies;1 {ea4e1414-779b-458b-9d1f-d18e8efbc145} process=main
|
||||
|
||||
component {dc6358f8-d167-4566-bf5b-4350b5e6a7a2} EnterprisePoliciesContent.js process=content
|
||||
contract @mozilla.org/browser/enterprisepolicies;1 {dc6358f8-d167-4566-bf5b-4350b5e6a7a2} process=content
|
@ -0,0 +1,91 @@
|
||||
/* 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/. */
|
||||
|
||||
const Ci = Components.interfaces;
|
||||
const Cc = Components.classes;
|
||||
const Cr = Components.results;
|
||||
const Cu = Components.utils;
|
||||
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
const PREF_LOGLEVEL = "browser.policies.loglevel";
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "log", () => {
|
||||
let { ConsoleAPI } = Cu.import("resource://gre/modules/Console.jsm", {});
|
||||
return new ConsoleAPI({
|
||||
prefix: "Enterprise Policies Child",
|
||||
// tip: set maxLogLevel to "debug" and use log.debug() to create detailed
|
||||
// messages during development. See LOG_LEVELS in Console.jsm for details.
|
||||
maxLogLevel: "error",
|
||||
maxLogLevelPref: PREF_LOGLEVEL,
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
// ==== Start XPCOM Boilerplate ==== \\
|
||||
|
||||
// Factory object
|
||||
const EnterprisePoliciesFactory = {
|
||||
_instance: null,
|
||||
createInstance: function BGSF_createInstance(outer, iid) {
|
||||
if (outer != null)
|
||||
throw Components.results.NS_ERROR_NO_AGGREGATION;
|
||||
return this._instance == null ?
|
||||
this._instance = new EnterprisePoliciesManagerContent() : this._instance;
|
||||
}
|
||||
};
|
||||
|
||||
// ==== End XPCOM Boilerplate ==== //
|
||||
|
||||
|
||||
function EnterprisePoliciesManagerContent() {
|
||||
let policies = Services.cpmm.initialProcessData.policies;
|
||||
if (policies) {
|
||||
this._status = policies.status;
|
||||
// make a copy of the array so that we can keep adding to it
|
||||
// in a way that is not confusing.
|
||||
this._disallowedFeatures = policies.disallowedFeatures.slice();
|
||||
}
|
||||
|
||||
Services.cpmm.addMessageListener("EnterprisePolicies:DisallowFeature", this);
|
||||
Services.cpmm.addMessageListener("EnterprisePolicies:Restart", this);
|
||||
}
|
||||
|
||||
EnterprisePoliciesManagerContent.prototype = {
|
||||
// for XPCOM
|
||||
classID: Components.ID("{dc6358f8-d167-4566-bf5b-4350b5e6a7a2}"),
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsIMessageListener,
|
||||
Ci.nsIEnterprisePolicies]),
|
||||
|
||||
// redefine the default factory for XPCOMUtils
|
||||
_xpcom_factory: EnterprisePoliciesFactory,
|
||||
|
||||
_status: Ci.nsIEnterprisePolicies.INACTIVE,
|
||||
|
||||
_disallowedFeatures: [],
|
||||
|
||||
receiveMessage({name, data}) {
|
||||
switch (name) {
|
||||
case "EnterprisePolicies:DisallowFeature":
|
||||
this._disallowedFeatures.push(data.feature);
|
||||
break;
|
||||
|
||||
case "EnterprisePolicies:Restart":
|
||||
this._disallowedFeatures = [];
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
||||
get status() {
|
||||
return this._status;
|
||||
},
|
||||
|
||||
isAllowed(feature) {
|
||||
return !this._disallowedFeatures.includes(feature);
|
||||
}
|
||||
};
|
||||
|
||||
var components = [EnterprisePoliciesManagerContent];
|
||||
this.NSGetFactory = XPCOMUtils.generateNSGetFactory(components);
|
38
browser/components/enterprisepolicies/Policies.jsm
Normal file
38
browser/components/enterprisepolicies/Policies.jsm
Normal file
@ -0,0 +1,38 @@
|
||||
/* 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/. */
|
||||
|
||||
"use strict";
|
||||
|
||||
const Ci = Components.interfaces;
|
||||
const Cc = Components.classes;
|
||||
const Cr = Components.results;
|
||||
const Cu = Components.utils;
|
||||
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
const PREF_LOGLEVEL = "browser.policies.loglevel";
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "log", () => {
|
||||
let { ConsoleAPI } = Cu.import("resource://gre/modules/Console.jsm", {});
|
||||
return new ConsoleAPI({
|
||||
prefix: "Policies.jsm",
|
||||
// tip: set maxLogLevel to "debug" and use log.debug() to create detailed
|
||||
// messages during development. See LOG_LEVELS in Console.jsm for details.
|
||||
maxLogLevel: "error",
|
||||
maxLogLevelPref: PREF_LOGLEVEL,
|
||||
});
|
||||
});
|
||||
|
||||
this.EXPORTED_SYMBOLS = ["Policies"];
|
||||
|
||||
this.Policies = {
|
||||
"block_about_config": {
|
||||
onBeforeUIStartup(manager, param) {
|
||||
if (param == true) {
|
||||
manager.disallowFeature("about:config", true);
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
148
browser/components/enterprisepolicies/PoliciesValidator.jsm
Normal file
148
browser/components/enterprisepolicies/PoliciesValidator.jsm
Normal file
@ -0,0 +1,148 @@
|
||||
/* 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/. */
|
||||
|
||||
"use strict";
|
||||
|
||||
const Ci = Components.interfaces;
|
||||
const Cc = Components.classes;
|
||||
const Cr = Components.results;
|
||||
const Cu = Components.utils;
|
||||
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
const PREF_LOGLEVEL = "browser.policies.loglevel";
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "log", () => {
|
||||
let { ConsoleAPI } = Cu.import("resource://gre/modules/Console.jsm", {});
|
||||
return new ConsoleAPI({
|
||||
prefix: "PoliciesValidator.jsm",
|
||||
// tip: set maxLogLevel to "debug" and use log.debug() to create detailed
|
||||
// messages during development. See LOG_LEVELS in Console.jsm for details.
|
||||
maxLogLevel: "error",
|
||||
maxLogLevelPref: PREF_LOGLEVEL,
|
||||
});
|
||||
});
|
||||
|
||||
this.EXPORTED_SYMBOLS = ["PoliciesValidator"];
|
||||
|
||||
this.PoliciesValidator = {
|
||||
validateAndParseParameters(param, properties) {
|
||||
return validateAndParseParamRecursive(param, properties);
|
||||
}
|
||||
};
|
||||
|
||||
function validateAndParseParamRecursive(param, properties) {
|
||||
if (properties.enum) {
|
||||
if (properties.enum.includes(param)) {
|
||||
return [true, param];
|
||||
}
|
||||
return [false, null];
|
||||
}
|
||||
|
||||
log.debug(`checking @${param}@ for type ${properties.type}`);
|
||||
switch (properties.type) {
|
||||
case "boolean":
|
||||
case "number":
|
||||
case "integer":
|
||||
case "string":
|
||||
case "URL":
|
||||
case "origin":
|
||||
return validateAndParseSimpleParam(param, properties.type);
|
||||
|
||||
case "array":
|
||||
if (!Array.isArray(param)) {
|
||||
log.error("Array expected but not received");
|
||||
return [false, null];
|
||||
}
|
||||
|
||||
let parsedArray = [];
|
||||
for (let item of param) {
|
||||
log.debug(`in array, checking @${item}@ for type ${properties.items.type}`);
|
||||
let [valid, parsedValue] = validateAndParseParamRecursive(item, properties.items);
|
||||
if (!valid) {
|
||||
return [false, null];
|
||||
}
|
||||
|
||||
parsedArray.push(parsedValue);
|
||||
}
|
||||
|
||||
return [true, parsedArray];
|
||||
|
||||
case "object": {
|
||||
if (typeof(param) != "object") {
|
||||
log.error("Object expected but not received");
|
||||
return [false, null];
|
||||
}
|
||||
|
||||
let parsedObj = {};
|
||||
for (let property of Object.keys(properties.properties)) {
|
||||
log.debug(`in object, for property ${property} checking @${param[property]}@ for type ${properties.properties[property].type}`);
|
||||
let [valid, parsedValue] = validateAndParseParamRecursive(param[property], properties.properties[property]);
|
||||
if (!valid) {
|
||||
return [false, null];
|
||||
}
|
||||
|
||||
parsedObj[property] = parsedValue;
|
||||
}
|
||||
|
||||
return [true, parsedObj];
|
||||
}
|
||||
}
|
||||
|
||||
return [false, null];
|
||||
}
|
||||
|
||||
function validateAndParseSimpleParam(param, type) {
|
||||
let valid = false;
|
||||
let parsedParam = param;
|
||||
|
||||
switch (type) {
|
||||
case "boolean":
|
||||
case "number":
|
||||
case "string":
|
||||
valid = (typeof(param) == type);
|
||||
break;
|
||||
|
||||
// integer is an alias to "number" that some JSON schema tools use
|
||||
case "integer":
|
||||
valid = (typeof(param) == "number");
|
||||
break;
|
||||
|
||||
case "origin":
|
||||
if (typeof(param) != "string") {
|
||||
break;
|
||||
}
|
||||
|
||||
try {
|
||||
parsedParam = Services.io.newURI(param);
|
||||
|
||||
let pathQueryRef = parsedParam.pathQueryRef;
|
||||
// Make sure that "origin" types won't accept full URLs.
|
||||
if (pathQueryRef != "/" && pathQueryRef != "") {
|
||||
valid = false;
|
||||
} else {
|
||||
valid = true;
|
||||
}
|
||||
} catch (ex) {
|
||||
valid = false;
|
||||
}
|
||||
break;
|
||||
|
||||
case "URL":
|
||||
if (typeof(param) != "string") {
|
||||
break;
|
||||
}
|
||||
|
||||
try {
|
||||
parsedParam = Services.io.newURI(param);
|
||||
valid = true;
|
||||
} catch (ex) {
|
||||
valid = false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return [valid, parsedParam];
|
||||
}
|
8
browser/components/enterprisepolicies/helpers/moz.build
Normal file
8
browser/components/enterprisepolicies/helpers/moz.build
Normal file
@ -0,0 +1,8 @@
|
||||
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
|
||||
# vim: set filetype=python:
|
||||
# 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/.
|
||||
|
||||
with Files("**"):
|
||||
BUG_COMPONENT = ("Firefox", "Enterprise Policies")
|
18
browser/components/enterprisepolicies/helpers/sample.json
Normal file
18
browser/components/enterprisepolicies/helpers/sample.json
Normal file
@ -0,0 +1,18 @@
|
||||
{
|
||||
"policies": {
|
||||
"block_about_config": true,
|
||||
"dont_check_default_browser": true,
|
||||
|
||||
"flash_plugin": {
|
||||
"allow": [
|
||||
"https://www.example.com"
|
||||
],
|
||||
|
||||
"block": [
|
||||
"https://www.example.org"
|
||||
]
|
||||
},
|
||||
|
||||
"block_about_profiles": true
|
||||
}
|
||||
}
|
30
browser/components/enterprisepolicies/moz.build
Normal file
30
browser/components/enterprisepolicies/moz.build
Normal file
@ -0,0 +1,30 @@
|
||||
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
|
||||
# vim: set filetype=python:
|
||||
# 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/.
|
||||
|
||||
with Files("**"):
|
||||
BUG_COMPONENT = ("Firefox", "Enterprise Policies")
|
||||
|
||||
DIRS += [
|
||||
'helpers',
|
||||
'schemas',
|
||||
]
|
||||
|
||||
TEST_DIRS += [
|
||||
'tests'
|
||||
]
|
||||
|
||||
EXTRA_COMPONENTS += [
|
||||
'EnterprisePolicies.js',
|
||||
'EnterprisePolicies.manifest',
|
||||
'EnterprisePoliciesContent.js',
|
||||
]
|
||||
|
||||
EXTRA_JS_MODULES.policies += [
|
||||
'Policies.jsm',
|
||||
'PoliciesValidator.jsm',
|
||||
]
|
||||
|
||||
FINAL_LIBRARY = 'browsercomps'
|
@ -0,0 +1,10 @@
|
||||
{
|
||||
"$schema": "http://json-schema.org/draft-04/schema#",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"policies": {
|
||||
"$ref": "policies.json"
|
||||
}
|
||||
},
|
||||
"required": ["policies"]
|
||||
}
|
12
browser/components/enterprisepolicies/schemas/moz.build
Normal file
12
browser/components/enterprisepolicies/schemas/moz.build
Normal file
@ -0,0 +1,12 @@
|
||||
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
|
||||
# vim: set filetype=python:
|
||||
# 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/.
|
||||
|
||||
with Files("**"):
|
||||
BUG_COMPONENT = ("Firefox", "Enterprise Policies")
|
||||
|
||||
EXTRA_PP_JS_MODULES.policies += [
|
||||
'schema.jsm',
|
||||
]
|
@ -0,0 +1,13 @@
|
||||
{
|
||||
"$schema": "http://json-schema.org/draft-04/schema#",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"block_about_config": {
|
||||
"description": "Blocks access to the about:config page.",
|
||||
"first_available": "60.0",
|
||||
|
||||
"type": "boolean",
|
||||
"enum": [true]
|
||||
}
|
||||
}
|
||||
}
|
10
browser/components/enterprisepolicies/schemas/schema.jsm
Normal file
10
browser/components/enterprisepolicies/schemas/schema.jsm
Normal file
@ -0,0 +1,10 @@
|
||||
/* 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/. */
|
||||
|
||||
"use strict";
|
||||
|
||||
this.EXPORTED_SYMBOLS = ["schema"];
|
||||
|
||||
this.schema =
|
||||
#include policies-schema.json
|
@ -0,0 +1,7 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = {
|
||||
"extends": [
|
||||
"plugin:mozilla/browser-test"
|
||||
]
|
||||
};
|
@ -0,0 +1,11 @@
|
||||
[DEFAULT]
|
||||
prefs =
|
||||
browser.policies.enabled=true
|
||||
support-files =
|
||||
head.js
|
||||
config_simple_policies.json
|
||||
config_broken_json.json
|
||||
|
||||
[browser_policies_broken_json.js]
|
||||
[browser_policies_simple_policies.js]
|
||||
[browser_policies_validate_and_parse_API.js]
|
@ -0,0 +1,15 @@
|
||||
/* 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/. */
|
||||
|
||||
"use strict";
|
||||
|
||||
add_task(async function test_clean_slate() {
|
||||
await startWithCleanSlate();
|
||||
});
|
||||
|
||||
add_task(async function test_broken_json() {
|
||||
await setupPolicyEngineWithJson("config_broken_json.json");
|
||||
|
||||
is(Services.policies.status, Ci.nsIEnterprisePolicies.FAILED, "Engine was correctly set to the error state");
|
||||
});
|
@ -0,0 +1,101 @@
|
||||
/* 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/. */
|
||||
|
||||
"use strict";
|
||||
|
||||
add_task(async function test_clean_slate() {
|
||||
await startWithCleanSlate();
|
||||
});
|
||||
|
||||
add_task(async function test_simple_policies() {
|
||||
await ContentTask.spawn(gBrowser.selectedBrowser, null, async function() {
|
||||
// Initialize the service in the content process, in case it hasn't
|
||||
// already started.
|
||||
Services.policies;
|
||||
});
|
||||
|
||||
let { Policies } = Cu.import("resource:///modules/policies/Policies.jsm", {});
|
||||
|
||||
let policy0Ran = false, policy1Ran = false, policy2Ran = false, policy3Ran = false;
|
||||
|
||||
// Implement functions to handle the four simple policies that will be added
|
||||
// to the schema.
|
||||
Policies.simple_policy0 = {
|
||||
onProfileAfterChange(manager, param) {
|
||||
is(param, true, "Param matches what was passed in config file");
|
||||
policy0Ran = true;
|
||||
}
|
||||
};
|
||||
|
||||
Policies.simple_policy1 = {
|
||||
onProfileAfterChange(manager, param) {
|
||||
is(param, true, "Param matches what was passed in config file");
|
||||
manager.disallowFeature("feature1", /* needed in content process */ true);
|
||||
policy1Ran = true;
|
||||
}
|
||||
};
|
||||
|
||||
Policies.simple_policy2 = {
|
||||
onBeforeUIStartup(manager, param) {
|
||||
is(param, true, "Param matches what was passed in config file");
|
||||
manager.disallowFeature("feature2", /* needed in content process */ false);
|
||||
policy2Ran = true;
|
||||
}
|
||||
};
|
||||
|
||||
Policies.simple_policy3 = {
|
||||
onAllWindowsRestored(manager, param) {
|
||||
is(param, false, "Param matches what was passed in config file");
|
||||
policy3Ran = true;
|
||||
}
|
||||
};
|
||||
|
||||
await setupPolicyEngineWithJson(
|
||||
"config_simple_policies.json",
|
||||
/* custom schema */
|
||||
{
|
||||
properties: {
|
||||
"simple_policy0": {
|
||||
"type": "boolean"
|
||||
},
|
||||
|
||||
"simple_policy1": {
|
||||
"type": "boolean"
|
||||
},
|
||||
|
||||
"simple_policy2": {
|
||||
"type": "boolean"
|
||||
},
|
||||
|
||||
"simple_policy3": {
|
||||
"type": "boolean"
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
is(Services.policies.status, Ci.nsIEnterprisePolicies.ACTIVE, "Engine is active");
|
||||
is(Services.policies.isAllowed("feature1"), false, "Dummy feature was disallowed");
|
||||
is(Services.policies.isAllowed("feature2"), false, "Dummy feature was disallowed");
|
||||
|
||||
ok(policy0Ran, "Policy 0 ran correctly through BeforeAddons");
|
||||
ok(policy1Ran, "Policy 1 ran correctly through onProfileAfterChange");
|
||||
ok(policy2Ran, "Policy 2 ran correctly through onBeforeUIStartup");
|
||||
ok(policy3Ran, "Policy 3 ran correctly through onAllWindowsRestored");
|
||||
|
||||
await ContentTask.spawn(gBrowser.selectedBrowser, null, async function() {
|
||||
if (Services.appinfo.processType == Services.appinfo.PROCESS_TYPE_CONTENT) {
|
||||
is(Services.policies.isAllowed("feature1"), false, "Correctly disallowed in the content process");
|
||||
// Feature 2 wasn't explictly marked as needed in the content process, so it is not marked
|
||||
// as disallowed there.
|
||||
is(Services.policies.isAllowed("feature2"), true, "Correctly missing in the content process");
|
||||
}
|
||||
});
|
||||
|
||||
delete Policies.simple_policy0;
|
||||
delete Policies.simple_policy1;
|
||||
delete Policies.simple_policy2;
|
||||
delete Policies.simple_policy3;
|
||||
});
|
@ -0,0 +1,231 @@
|
||||
/* 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/. */
|
||||
|
||||
"use strict";
|
||||
|
||||
/* This file will test the parameters parsing and validation directly through
|
||||
the PoliciesValidator API.
|
||||
*/
|
||||
|
||||
const { PoliciesValidator } = Cu.import("resource:///modules/policies/PoliciesValidator.jsm", {});
|
||||
|
||||
add_task(async function test_boolean_values() {
|
||||
let schema = {
|
||||
type: "boolean"
|
||||
};
|
||||
|
||||
let valid, parsed;
|
||||
[valid, parsed] = PoliciesValidator.validateAndParseParameters(true, schema);
|
||||
ok(valid && parsed === true, "Parsed boolean value correctly");
|
||||
|
||||
[valid, parsed] = PoliciesValidator.validateAndParseParameters(false, schema);
|
||||
ok(valid && parsed === false, "Parsed boolean value correctly");
|
||||
|
||||
// Invalid values:
|
||||
ok(!PoliciesValidator.validateAndParseParameters("0", schema)[0], "No type coercion");
|
||||
ok(!PoliciesValidator.validateAndParseParameters("true", schema)[0], "No type coercion");
|
||||
ok(!PoliciesValidator.validateAndParseParameters(undefined, schema)[0], "Invalid value");
|
||||
ok(!PoliciesValidator.validateAndParseParameters({}, schema)[0], "Invalid value");
|
||||
ok(!PoliciesValidator.validateAndParseParameters(null, schema)[0], "Invalid value");
|
||||
});
|
||||
|
||||
add_task(async function test_number_values() {
|
||||
let schema = {
|
||||
type: "number"
|
||||
};
|
||||
|
||||
let valid, parsed;
|
||||
[valid, parsed] = PoliciesValidator.validateAndParseParameters(1, schema);
|
||||
ok(valid && parsed === 1, "Parsed number value correctly");
|
||||
|
||||
// Invalid values:
|
||||
ok(!PoliciesValidator.validateAndParseParameters("1", schema)[0], "No type coercion");
|
||||
ok(!PoliciesValidator.validateAndParseParameters(true, schema)[0], "Invalid value");
|
||||
ok(!PoliciesValidator.validateAndParseParameters({}, schema)[0], "Invalid value");
|
||||
ok(!PoliciesValidator.validateAndParseParameters(null, schema)[0], "Invalid value");
|
||||
});
|
||||
|
||||
add_task(async function test_integer_values() {
|
||||
// Integer is an alias for number
|
||||
let schema = {
|
||||
type: "integer"
|
||||
};
|
||||
|
||||
let valid, parsed;
|
||||
[valid, parsed] = PoliciesValidator.validateAndParseParameters(1, schema);
|
||||
ok(valid && parsed == 1, "Parsed integer value correctly");
|
||||
|
||||
// Invalid values:
|
||||
ok(!PoliciesValidator.validateAndParseParameters("1", schema)[0], "No type coercion");
|
||||
ok(!PoliciesValidator.validateAndParseParameters(true, schema)[0], "Invalid value");
|
||||
ok(!PoliciesValidator.validateAndParseParameters({}, schema)[0], "Invalid value");
|
||||
ok(!PoliciesValidator.validateAndParseParameters(null, schema)[0], "Invalid value");
|
||||
});
|
||||
|
||||
add_task(async function test_string_values() {
|
||||
let schema = {
|
||||
type: "string"
|
||||
};
|
||||
|
||||
let valid, parsed;
|
||||
[valid, parsed] = PoliciesValidator.validateAndParseParameters("foobar", schema);
|
||||
ok(valid && parsed == "foobar", "Parsed string value correctly");
|
||||
|
||||
// Invalid values:
|
||||
ok(!PoliciesValidator.validateAndParseParameters(1, schema)[0], "No type coercion");
|
||||
ok(!PoliciesValidator.validateAndParseParameters(true, schema)[0], "No type coercion");
|
||||
ok(!PoliciesValidator.validateAndParseParameters(undefined, schema)[0], "Invalid value");
|
||||
ok(!PoliciesValidator.validateAndParseParameters({}, schema)[0], "Invalid value");
|
||||
ok(!PoliciesValidator.validateAndParseParameters(null, schema)[0], "Invalid value");
|
||||
});
|
||||
|
||||
add_task(async function test_URL_values() {
|
||||
let schema = {
|
||||
type: "URL"
|
||||
};
|
||||
|
||||
let valid, parsed;
|
||||
[valid, parsed] = PoliciesValidator.validateAndParseParameters("https://www.example.com/foo#bar", schema);
|
||||
ok(valid, "URL is valid");
|
||||
ok(parsed instanceof Ci.nsIURI, "parsed is a nsIURI");
|
||||
is(parsed.prePath, "https://www.example.com", "prePath is correct");
|
||||
is(parsed.pathQueryRef, "/foo#bar", "pathQueryRef is correct");
|
||||
|
||||
// Invalid values:
|
||||
ok(!PoliciesValidator.validateAndParseParameters("www.example.com", schema)[0], "Scheme is required for URL");
|
||||
ok(!PoliciesValidator.validateAndParseParameters("https://:!$%", schema)[0], "Invalid URL");
|
||||
ok(!PoliciesValidator.validateAndParseParameters({}, schema)[0], "Invalid value");
|
||||
});
|
||||
|
||||
add_task(async function test_origin_values() {
|
||||
// Origin is a URL that doesn't contain a path/query string (i.e., it's only scheme + host + port)
|
||||
let schema = {
|
||||
type: "origin"
|
||||
};
|
||||
|
||||
let valid, parsed;
|
||||
[valid, parsed] = PoliciesValidator.validateAndParseParameters("https://www.example.com", schema);
|
||||
ok(valid, "Origin is valid");
|
||||
ok(parsed instanceof Ci.nsIURI, "parsed is a nsIURI");
|
||||
is(parsed.prePath, "https://www.example.com", "prePath is correct");
|
||||
is(parsed.pathQueryRef, "/", "pathQueryRef is corect");
|
||||
|
||||
// Invalid values:
|
||||
ok(!PoliciesValidator.validateAndParseParameters("https://www.example.com/foobar", schema)[0], "Origin cannot contain a path part");
|
||||
ok(!PoliciesValidator.validateAndParseParameters("https://:!$%", schema)[0], "Invalid origin");
|
||||
ok(!PoliciesValidator.validateAndParseParameters({}, schema)[0], "Invalid value");
|
||||
});
|
||||
|
||||
add_task(async function test_array_values() {
|
||||
// The types inside an array object must all be the same
|
||||
let schema = {
|
||||
type: "array",
|
||||
items: {
|
||||
type: "number"
|
||||
}
|
||||
};
|
||||
|
||||
let valid, parsed;
|
||||
[valid, parsed] = PoliciesValidator.validateAndParseParameters([1, 2, 3], schema);
|
||||
ok(valid, "Array is valid");
|
||||
ok(Array.isArray(parsed), "parsed is an array");
|
||||
is(parsed.length, 3, "array is correct");
|
||||
|
||||
// An empty array is also valid
|
||||
[valid, parsed] = PoliciesValidator.validateAndParseParameters([], schema);
|
||||
ok(valid, "Array is valid");
|
||||
ok(Array.isArray(parsed), "parsed is an array");
|
||||
is(parsed.length, 0, "array is correct");
|
||||
|
||||
// Invalid values:
|
||||
ok(!PoliciesValidator.validateAndParseParameters([1, true, 3], schema)[0], "Mixed types");
|
||||
ok(!PoliciesValidator.validateAndParseParameters(2, schema)[0], "Type is correct but not in an array");
|
||||
ok(!PoliciesValidator.validateAndParseParameters({}, schema)[0], "Object is not an array");
|
||||
});
|
||||
|
||||
add_task(async function test_object_values() {
|
||||
let schema = {
|
||||
type: "object",
|
||||
properties: {
|
||||
url: {
|
||||
type: "URL"
|
||||
},
|
||||
title: {
|
||||
type: "string"
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
let valid, parsed;
|
||||
[valid, parsed] = PoliciesValidator.validateAndParseParameters(
|
||||
{
|
||||
url: "https://www.example.com/foo#bar",
|
||||
title: "Foo",
|
||||
alias: "Bar"
|
||||
},
|
||||
schema);
|
||||
|
||||
ok(valid, "Object is valid");
|
||||
ok(typeof(parsed) == "object", "parsed in an object");
|
||||
ok(parsed.url instanceof Ci.nsIURI, "types inside the object are also parsed");
|
||||
is(parsed.url.spec, "https://www.example.com/foo#bar", "URL was correctly parsed");
|
||||
is(parsed.title, "Foo", "title was correctly parsed");
|
||||
is(parsed.alias, undefined, "property not described in the schema is not present in the parsed object");
|
||||
|
||||
// Invalid values:
|
||||
ok(!PoliciesValidator.validateAndParseParameters(
|
||||
{
|
||||
url: "https://www.example.com/foo#bar",
|
||||
title: 3,
|
||||
},
|
||||
schema)[0], "Mismatched type for title");
|
||||
|
||||
ok(!PoliciesValidator.validateAndParseParameters(
|
||||
{
|
||||
url: "www.example.com",
|
||||
title: 3,
|
||||
},
|
||||
schema)[0], "Invalid URL inside the object");
|
||||
});
|
||||
|
||||
add_task(async function test_array_of_objects() {
|
||||
// This schema is used, for example, for bookmarks
|
||||
let schema = {
|
||||
type: "array",
|
||||
items: {
|
||||
type: "object",
|
||||
properties: {
|
||||
url: {
|
||||
type: "URL",
|
||||
},
|
||||
title: {
|
||||
type: "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
let valid, parsed;
|
||||
[valid, parsed] = PoliciesValidator.validateAndParseParameters(
|
||||
[{
|
||||
url: "https://www.example.com/bookmark1",
|
||||
title: "Foo",
|
||||
},
|
||||
{
|
||||
url: "https://www.example.com/bookmark2",
|
||||
title: "Bar",
|
||||
}],
|
||||
schema);
|
||||
|
||||
ok(valid, "Array is valid");
|
||||
is(parsed.length, 2, "Correct number of items");
|
||||
|
||||
ok(typeof(parsed[0]) == "object" && typeof(parsed[1]) == "object", "Correct objects inside array");
|
||||
|
||||
is(parsed[0].url.spec, "https://www.example.com/bookmark1", "Correct URL for bookmark 1");
|
||||
is(parsed[1].url.spec, "https://www.example.com/bookmark2", "Correct URL for bookmark 2");
|
||||
|
||||
is(parsed[0].title, "Foo", "Correct title for bookmark 1");
|
||||
is(parsed[1].title, "Bar", "Correct title for bookmark 2");
|
||||
});
|
@ -0,0 +1,3 @@
|
||||
{
|
||||
"policies
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
{
|
||||
"policies": {
|
||||
"simple_policy0": true,
|
||||
"simple_policy1": true,
|
||||
"simple_policy2": true,
|
||||
"simple_policy3": false
|
||||
}
|
||||
}
|
34
browser/components/enterprisepolicies/tests/browser/head.js
Normal file
34
browser/components/enterprisepolicies/tests/browser/head.js
Normal file
@ -0,0 +1,34 @@
|
||||
/* 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/. */
|
||||
|
||||
"use strict";
|
||||
|
||||
async function setupPolicyEngineWithJson(jsonName, customSchema) {
|
||||
let filePath = getTestFilePath(jsonName ? jsonName : "non-existing-file.json");
|
||||
Services.prefs.setStringPref("browser.policies.alternatePath", filePath);
|
||||
|
||||
let resolve = null;
|
||||
let promise = new Promise((r) => resolve = r);
|
||||
|
||||
Services.obs.addObserver(function observer() {
|
||||
Services.obs.removeObserver(observer, "EnterprisePolicies:AllPoliciesApplied");
|
||||
resolve();
|
||||
}, "EnterprisePolicies:AllPoliciesApplied");
|
||||
|
||||
// Clear any previously used custom schema
|
||||
Cu.unload("resource:///modules/policies/schema.jsm");
|
||||
|
||||
if (customSchema) {
|
||||
let schemaModule = Cu.import("resource:///modules/policies/schema.jsm", {});
|
||||
schemaModule.schema = customSchema;
|
||||
}
|
||||
|
||||
Services.obs.notifyObservers(null, "EnterprisePolicies:Restart");
|
||||
return promise;
|
||||
}
|
||||
|
||||
async function startWithCleanSlate() {
|
||||
await setupPolicyEngineWithJson("");
|
||||
is(Services.policies.status, Ci.nsIEnterprisePolicies.INACTIVE, "Engine is inactive");
|
||||
}
|
12
browser/components/enterprisepolicies/tests/moz.build
Normal file
12
browser/components/enterprisepolicies/tests/moz.build
Normal file
@ -0,0 +1,12 @@
|
||||
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
|
||||
# vim: set filetype=python:
|
||||
# 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/.
|
||||
|
||||
with Files("**"):
|
||||
BUG_COMPONENT = ("Firefox", "General")
|
||||
|
||||
BROWSER_CHROME_MANIFESTS += [
|
||||
'browser/browser.ini'
|
||||
]
|
@ -38,6 +38,7 @@ DIRS += [
|
||||
'customizableui',
|
||||
'dirprovider',
|
||||
'downloads',
|
||||
'enterprisepolicies',
|
||||
'extensions',
|
||||
'feeds',
|
||||
'migration',
|
||||
|
@ -16,6 +16,8 @@ support-files =
|
||||
[browser_bookmark_folder_moveability.js]
|
||||
skip-if = (os == 'win' && ccov) # Bug 1423667
|
||||
[browser_bookmarklet_windowOpen.js]
|
||||
[browser_bookmarks_change_title.js]
|
||||
skip-if = (os == 'win' && ccov) # Bug 1423667
|
||||
[browser_bookmarks_sidebar_search.js]
|
||||
skip-if = (os == 'win' && ccov) # Bug 1423667
|
||||
support-files =
|
||||
|
@ -0,0 +1,157 @@
|
||||
/**
|
||||
* Tests that the title of a bookmark can be changed from the bookmark star, toolbar, and sidebar.
|
||||
*/
|
||||
"use strict";
|
||||
|
||||
const TEST_URL = "about:buildconfig";
|
||||
const titleAfterFirstUpdate = "BookmarkStar title";
|
||||
|
||||
function getToolbarNodeForItemGuid(aItemGuid) {
|
||||
var children = document.getElementById("PlacesToolbarItems").childNodes;
|
||||
for (let child of children) {
|
||||
if (aItemGuid == child._placesNode.bookmarkGuid) {
|
||||
return child;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
// Setup.
|
||||
add_task(async function setup() {
|
||||
let toolbar = document.getElementById("PersonalToolbar");
|
||||
let wasCollapsed = toolbar.collapsed;
|
||||
|
||||
// Uncollapse the personal toolbar if needed.
|
||||
if (wasCollapsed) {
|
||||
await promiseSetToolbarVisibility(toolbar, true);
|
||||
}
|
||||
|
||||
registerCleanupFunction(async () => {
|
||||
// Collapse the personal toolbar if needed.
|
||||
if (wasCollapsed) {
|
||||
await promiseSetToolbarVisibility(toolbar, false);
|
||||
}
|
||||
await PlacesUtils.bookmarks.eraseEverything();
|
||||
});
|
||||
});
|
||||
|
||||
add_task(async function test_change_title_from_BookmarkStar() {
|
||||
let originalBm = await PlacesUtils.bookmarks.insert({
|
||||
parentGuid: PlacesUtils.bookmarks.unfiledGuid,
|
||||
url: TEST_URL,
|
||||
title: "Before Edit"
|
||||
});
|
||||
|
||||
let tab = await BrowserTestUtils.openNewForegroundTab({
|
||||
gBrowser,
|
||||
opening: TEST_URL,
|
||||
waitForStateStop: true
|
||||
});
|
||||
|
||||
registerCleanupFunction(async () => {
|
||||
await BrowserTestUtils.removeTab(tab);
|
||||
});
|
||||
|
||||
let bookmarkPanel = document.getElementById("editBookmarkPanel");
|
||||
let shownPromise = promisePopupShown(bookmarkPanel);
|
||||
|
||||
let bookmarkStar = BookmarkingUI.star;
|
||||
bookmarkStar.click();
|
||||
|
||||
await shownPromise;
|
||||
|
||||
let bookmarkPanelTitle = document.getElementById("editBookmarkPanelTitle");
|
||||
Assert.equal(bookmarkPanelTitle.value, gNavigatorBundle.getString("editBookmarkPanel.editBookmarkTitle"), "Bookmark title is correct");
|
||||
|
||||
let promiseNotification = PlacesTestUtils.waitForNotification("onItemChanged",
|
||||
(id, property, isAnno, val) => property == "title" && val == titleAfterFirstUpdate);
|
||||
|
||||
// Update the bookmark's title.
|
||||
await fillBookmarkTextField("editBMPanel_namePicker", titleAfterFirstUpdate, window);
|
||||
|
||||
let doneButton = document.getElementById("editBookmarkPanelDoneButton");
|
||||
doneButton.click();
|
||||
await promiseNotification;
|
||||
|
||||
let updatedBm = await PlacesUtils.bookmarks.fetch(originalBm.guid);
|
||||
Assert.equal(updatedBm.title, titleAfterFirstUpdate, "Should have updated the bookmark title in the database");
|
||||
});
|
||||
|
||||
add_task(async function test_change_title_from_Toolbar() {
|
||||
let toolbarBookmark = await PlacesUtils.bookmarks.insert({
|
||||
parentGuid: PlacesUtils.bookmarks.toolbarGuid,
|
||||
title: titleAfterFirstUpdate,
|
||||
url: TEST_URL
|
||||
});
|
||||
|
||||
let toolbarNode = getToolbarNodeForItemGuid(toolbarBookmark.guid);
|
||||
|
||||
await withBookmarksDialog(
|
||||
false,
|
||||
async function openPropertiesDialog() {
|
||||
let placesContext = document.getElementById("placesContext");
|
||||
let promisePopup = BrowserTestUtils.waitForEvent(placesContext, "popupshown");
|
||||
EventUtils.synthesizeMouseAtCenter(toolbarNode, {
|
||||
button: 2,
|
||||
type: "contextmenu"
|
||||
});
|
||||
await promisePopup;
|
||||
|
||||
let properties = document.getElementById("placesContext_show:info");
|
||||
EventUtils.synthesizeMouseAtCenter(properties, {});
|
||||
},
|
||||
async function test(dialogWin) {
|
||||
let namepicker = dialogWin.document.getElementById("editBMPanel_namePicker");
|
||||
Assert.equal(namepicker.value, titleAfterFirstUpdate, "Name field is correct before update.");
|
||||
|
||||
let promiseTitleChange = PlacesTestUtils.waitForNotification("onItemChanged",
|
||||
(id, prop, isAnno, val) => prop == "title" && val == "Toolbar title");
|
||||
|
||||
// Update the bookmark's title.
|
||||
fillBookmarkTextField("editBMPanel_namePicker", "Toolbar title", dialogWin, false);
|
||||
|
||||
// Confirm and close the dialog.
|
||||
EventUtils.synthesizeKey("VK_RETURN", {}, dialogWin);
|
||||
await promiseTitleChange;
|
||||
|
||||
let updatedBm = await PlacesUtils.bookmarks.fetch(toolbarBookmark.guid);
|
||||
Assert.equal(updatedBm.title, "Toolbar title", "Should have updated the bookmark title in the database");
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
add_task(async function test_change_title_from_Sidebar() {
|
||||
let bookmarks = [];
|
||||
await PlacesUtils.bookmarks.fetch({ url: TEST_URL }, bm => bookmarks.push(bm));
|
||||
|
||||
await withSidebarTree("bookmarks", async function(tree) {
|
||||
tree.selectItems([bookmarks[0].guid]);
|
||||
|
||||
await withBookmarksDialog(
|
||||
false,
|
||||
function openPropertiesDialog() {
|
||||
tree.controller.doCommand("placesCmd_show:info");
|
||||
},
|
||||
async function test(dialogWin) {
|
||||
let namepicker = dialogWin.document.getElementById("editBMPanel_namePicker");
|
||||
Assert.equal(namepicker.value, "Toolbar title", "Name field is correct before update.");
|
||||
|
||||
let promiseTitleChange = PlacesTestUtils.waitForNotification("onItemChanged",
|
||||
(id, prop, isAnno, val) => prop == "title" && val == "Sidebar Title");
|
||||
|
||||
// Update the bookmark's title.
|
||||
fillBookmarkTextField("editBMPanel_namePicker", "Sidebar Title", dialogWin, false);
|
||||
|
||||
// Confirm and close the dialog.
|
||||
EventUtils.synthesizeKey("VK_RETURN", {}, dialogWin);
|
||||
await promiseTitleChange;
|
||||
|
||||
// Get updated bookmarks, check the new title.
|
||||
bookmarks = [];
|
||||
await PlacesUtils.bookmarks.fetch({ url: TEST_URL }, bm => bookmarks.push(bm));
|
||||
Assert.equal(bookmarks[0].title, "Sidebar Title", "Should have updated the bookmark title in the database");
|
||||
Assert.equal(bookmarks.length, 2, "Two bookmarks should exist");
|
||||
}
|
||||
);
|
||||
});
|
||||
});
|
@ -229,6 +229,7 @@
|
||||
@RESPATH@/components/dom_presentation.xpt
|
||||
@RESPATH@/components/downloads.xpt
|
||||
@RESPATH@/components/editor.xpt
|
||||
@RESPATH@/components/enterprisepolicies.xpt
|
||||
@RESPATH@/components/extensions.xpt
|
||||
@RESPATH@/components/exthandler.xpt
|
||||
@RESPATH@/components/fastfind.xpt
|
||||
@ -379,6 +380,9 @@
|
||||
@RESPATH@/browser/components/browser-newtab.xpt
|
||||
@RESPATH@/browser/components/aboutNewTabService.js
|
||||
@RESPATH@/browser/components/NewTabComponents.manifest
|
||||
@RESPATH@/browser/components/EnterprisePolicies.js
|
||||
@RESPATH@/browser/components/EnterprisePoliciesContent.js
|
||||
@RESPATH@/browser/components/EnterprisePolicies.manifest
|
||||
@RESPATH@/components/Downloads.manifest
|
||||
@RESPATH@/components/DownloadLegacy.js
|
||||
@RESPATH@/components/thumbnails.xpt
|
||||
|
@ -203,8 +203,8 @@ ElementEditor.prototype = {
|
||||
let attribute = node.closest(".attreditor");
|
||||
if (attribute) {
|
||||
type = "attribute";
|
||||
name = attribute.querySelector(".attr-name").textContent;
|
||||
value = attribute.querySelector(".attr-value").textContent;
|
||||
name = attribute.dataset.attr;
|
||||
value = attribute.dataset.value;
|
||||
}
|
||||
|
||||
return {type, name, value, el: node};
|
||||
|
@ -13,6 +13,7 @@ add_task(function* () {
|
||||
|
||||
yield testAddAttribute();
|
||||
yield testCopyAttributeValue();
|
||||
yield testCopyLongAttributeValue();
|
||||
yield testEditAttribute();
|
||||
yield testRemoveAttribute();
|
||||
|
||||
@ -44,6 +45,23 @@ add_task(function* () {
|
||||
yield waitForClipboardPromise(() => copyAttributeValue.click(), "the");
|
||||
}
|
||||
|
||||
function* testCopyLongAttributeValue() {
|
||||
info("Testing 'Copy Attribute Value' copies very long attribute values");
|
||||
let copyAttributeValue = getMenuItem("node-menu-copy-attribute");
|
||||
let longAttribute = "#01234567890123456789012345678901234567890123456789" +
|
||||
"12345678901234567890123456789012345678901234567890123456789012345678901" +
|
||||
"23456789012345678901234567890123456789012345678901234567890123456789012" +
|
||||
"34567890123456789012345678901234567890123456789012345678901234567890123";
|
||||
|
||||
inspector.nodeMenuTriggerInfo = {
|
||||
type: "attribute",
|
||||
name: "data-edit",
|
||||
value: longAttribute
|
||||
};
|
||||
|
||||
yield waitForClipboardPromise(() => copyAttributeValue.click(), longAttribute);
|
||||
}
|
||||
|
||||
function* testEditAttribute() {
|
||||
info("Testing 'Edit Attribute' menu item");
|
||||
let editAttribute = getMenuItem("node-menu-edit-attribute");
|
||||
|
@ -23,7 +23,10 @@
|
||||
</div>
|
||||
<p id="console-var">Paragraph for testing console variables</p>
|
||||
<p id="console-var-multi">Paragraph for testing multiple console variables</p>
|
||||
<p id="attributes" data-copy="the" data-edit="original" data-remove="thing">Attributes are going to be changed here</p>
|
||||
|
||||
|
||||
<p id="attributes" data-copy="the" data-long-copy="#01234567890123456789012345678901234567890123456789123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123" data-edit="original" data-remove="thing">Attributes are going to be changed here</p>
|
||||
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -36,11 +36,14 @@ support-files =
|
||||
sourcemap-css/contained.css
|
||||
sourcemap-css/sourcemaps.css
|
||||
sourcemap-css/sourcemaps.css.map
|
||||
# add nosniff header to test against Bug 1330383
|
||||
sourcemap-css/sourcemaps.css.map^headers^
|
||||
sourcemap-css/media-rules.css
|
||||
sourcemap-css/media-rules.css.map
|
||||
sourcemap-css/test-bootstrap-scss.css
|
||||
sourcemap-css/test-stylus.css
|
||||
sourcemap-sass/sourcemaps.scss
|
||||
# add nosniff header to test against Bug 1330383
|
||||
sourcemap-sass/sourcemaps.scss^headers^
|
||||
sourcemap-sass/media-rules.scss
|
||||
sourcemap-styl/test-stylus.styl
|
||||
|
@ -0,0 +1,2 @@
|
||||
X-Content-Type-Options: nosniff
|
||||
Content-Type: text/plain
|
@ -173,9 +173,7 @@ Navigator::~Navigator()
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(Navigator)
|
||||
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMNavigator)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMNavigator)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIMozNavigatorNetwork)
|
||||
NS_INTERFACE_MAP_ENTRY(nsISupports)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTING_ADDREF(Navigator)
|
||||
@ -278,10 +276,6 @@ Navigator::Invalidate()
|
||||
}
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
// Navigator::nsIDOMNavigator
|
||||
//*****************************************************************************
|
||||
|
||||
void
|
||||
Navigator::GetUserAgent(nsAString& aUserAgent, CallerType aCallerType,
|
||||
ErrorResult& aRv) const
|
||||
@ -310,20 +304,26 @@ Navigator::GetUserAgent(nsAString& aUserAgent, CallerType aCallerType,
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
Navigator::GetAppCodeName(nsAString& aAppCodeName)
|
||||
void
|
||||
Navigator::GetAppCodeName(nsAString& aAppCodeName, ErrorResult& aRv)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
nsCOMPtr<nsIHttpProtocolHandler>
|
||||
service(do_GetService(NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX "http", &rv));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
aRv.Throw(rv);
|
||||
return;
|
||||
}
|
||||
|
||||
nsAutoCString appName;
|
||||
rv = service->GetAppName(appName);
|
||||
CopyASCIItoUTF16(appName, aAppCodeName);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
aRv.Throw(rv);
|
||||
return;
|
||||
}
|
||||
|
||||
return rv;
|
||||
CopyASCIItoUTF16(appName, aAppCodeName);
|
||||
}
|
||||
|
||||
void
|
||||
@ -407,7 +407,7 @@ Navigator::GetAcceptLanguages(nsTArray<nsString>& aLanguages)
|
||||
* See RFC 2616, Section 15.1.4 "Privacy Issues Connected to Accept Headers" for
|
||||
* the reasons why.
|
||||
*/
|
||||
NS_IMETHODIMP
|
||||
void
|
||||
Navigator::GetLanguage(nsAString& aLanguage)
|
||||
{
|
||||
nsTArray<nsString> languages;
|
||||
@ -417,8 +417,6 @@ Navigator::GetLanguage(nsAString& aLanguage)
|
||||
} else {
|
||||
aLanguage.Truncate();
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
@ -481,33 +479,29 @@ Navigator::GetOscpu(nsAString& aOSCPU, CallerType aCallerType,
|
||||
CopyASCIItoUTF16(oscpu, aOSCPU);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
void
|
||||
Navigator::GetVendor(nsAString& aVendor)
|
||||
{
|
||||
aVendor.Truncate();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
void
|
||||
Navigator::GetVendorSub(nsAString& aVendorSub)
|
||||
{
|
||||
aVendorSub.Truncate();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
void
|
||||
Navigator::GetProduct(nsAString& aProduct)
|
||||
{
|
||||
aProduct.AssignLiteral("Gecko");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
void
|
||||
Navigator::GetProductSub(nsAString& aProductSub)
|
||||
{
|
||||
// Legacy build ID hardcoded for backward compatibility (bug 776376)
|
||||
aProductSub.AssignLiteral(LEGACY_BUILD_ID);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsMimeTypeArray*
|
||||
@ -660,7 +654,7 @@ Navigator::GetBuildID(nsAString& aBuildID, CallerType aCallerType,
|
||||
AppendASCIItoUTF16(buildID, aBuildID);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
void
|
||||
Navigator::GetDoNotTrack(nsAString &aResult)
|
||||
{
|
||||
bool doNotTrack = nsContentUtils::DoNotTrackEnabled();
|
||||
@ -674,8 +668,6 @@ Navigator::GetDoNotTrack(nsAString &aResult)
|
||||
} else {
|
||||
aResult.AssignLiteral("unspecified");
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
bool
|
||||
@ -1488,16 +1480,11 @@ Navigator::RequestVRPresentation(VRDisplay& aDisplay)
|
||||
win->DispatchVRDisplayActivate(aDisplay.DisplayId(), VRDisplayEventReason::Requested);
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
// Navigator::nsIMozNavigatorNetwork
|
||||
//*****************************************************************************
|
||||
|
||||
NS_IMETHODIMP
|
||||
Navigator::GetProperties(nsINetworkProperties** aProperties)
|
||||
nsINetworkProperties*
|
||||
Navigator::GetNetworkProperties()
|
||||
{
|
||||
ErrorResult rv;
|
||||
NS_IF_ADDREF(*aProperties = GetConnection(rv));
|
||||
return NS_OK;
|
||||
IgnoredErrorResult rv;
|
||||
return GetConnection(rv);
|
||||
}
|
||||
|
||||
network::Connection*
|
||||
|
@ -12,8 +12,6 @@
|
||||
#include "mozilla/dom/Fetch.h"
|
||||
#include "mozilla/dom/Nullable.h"
|
||||
#include "mozilla/ErrorResult.h"
|
||||
#include "nsIDOMNavigator.h"
|
||||
#include "nsIMozNavigatorNetwork.h"
|
||||
#include "nsWrapperCache.h"
|
||||
#include "nsHashKeys.h"
|
||||
#include "nsInterfaceHashtable.h"
|
||||
@ -26,6 +24,7 @@ class nsPluginArray;
|
||||
class nsMimeTypeArray;
|
||||
class nsPIDOMWindowInner;
|
||||
class nsIDOMNavigatorSystemMessages;
|
||||
class nsINetworkProperties;
|
||||
class nsIPrincipal;
|
||||
class nsIURI;
|
||||
|
||||
@ -80,18 +79,14 @@ namespace time {
|
||||
class TimeManager;
|
||||
} // namespace time
|
||||
|
||||
class Navigator final : public nsIDOMNavigator
|
||||
, public nsIMozNavigatorNetwork
|
||||
class Navigator final : public nsISupports
|
||||
, public nsWrapperCache
|
||||
{
|
||||
public:
|
||||
explicit Navigator(nsPIDOMWindowInner* aInnerWindow);
|
||||
|
||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_AMBIGUOUS(Navigator,
|
||||
nsIDOMNavigator)
|
||||
NS_DECL_NSIDOMNAVIGATOR
|
||||
NS_DECL_NSIMOZNAVIGATORNETWORK
|
||||
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(Navigator)
|
||||
|
||||
static void Init();
|
||||
|
||||
@ -115,8 +110,8 @@ public:
|
||||
*/
|
||||
void OnNavigation();
|
||||
|
||||
// The XPCOM GetProduct is OK
|
||||
// The XPCOM GetLanguage is OK
|
||||
void GetProduct(nsAString& aProduct);
|
||||
void GetLanguage(nsAString& aLanguage);
|
||||
void GetAppName(nsAString& aAppName, CallerType aCallerType) const;
|
||||
void GetAppVersion(nsAString& aAppName, CallerType aCallerType,
|
||||
ErrorResult& aRv) const;
|
||||
@ -132,7 +127,7 @@ public:
|
||||
nsMimeTypeArray* GetMimeTypes(ErrorResult& aRv);
|
||||
nsPluginArray* GetPlugins(ErrorResult& aRv);
|
||||
Permissions* GetPermissions(ErrorResult& aRv);
|
||||
// The XPCOM GetDoNotTrack is ok
|
||||
void GetDoNotTrack(nsAString& aResult);
|
||||
Geolocation* GetGeolocation(ErrorResult& aRv);
|
||||
Promise* GetBattery(ErrorResult& aRv);
|
||||
|
||||
@ -156,15 +151,12 @@ public:
|
||||
bool Vibrate(const nsTArray<uint32_t>& aDuration);
|
||||
void SetVibrationPermission(bool aPermitted, bool aPersistent);
|
||||
uint32_t MaxTouchPoints();
|
||||
void GetAppCodeName(nsString& aAppCodeName, ErrorResult& aRv)
|
||||
{
|
||||
aRv = GetAppCodeName(aAppCodeName);
|
||||
}
|
||||
void GetAppCodeName(nsAString& aAppCodeName, ErrorResult& aRv);
|
||||
void GetOscpu(nsAString& aOscpu, CallerType aCallerType,
|
||||
ErrorResult& aRv) const;
|
||||
// The XPCOM GetVendor is OK
|
||||
// The XPCOM GetVendorSub is OK
|
||||
// The XPCOM GetProductSub is OK
|
||||
void GetVendorSub(nsAString& aVendorSub);
|
||||
void GetVendor(nsAString& aVendor);
|
||||
void GetProductSub(nsAString& aProductSub);
|
||||
bool CookieEnabled();
|
||||
void GetBuildID(nsAString& aBuildID, CallerType aCallerType,
|
||||
ErrorResult& aRv) const;
|
||||
@ -189,6 +181,7 @@ public:
|
||||
bool IsWebVRContentDetected() const;
|
||||
bool IsWebVRContentPresenting() const;
|
||||
void RequestVRPresentation(VRDisplay& aDisplay);
|
||||
nsINetworkProperties* GetNetworkProperties();
|
||||
#ifdef MOZ_TIME_MANAGER
|
||||
time::TimeManager* GetMozTime(ErrorResult& aRv);
|
||||
#endif // MOZ_TIME_MANAGER
|
||||
|
@ -2255,7 +2255,7 @@ nsGlobalWindowInner::Self()
|
||||
}
|
||||
|
||||
Navigator*
|
||||
nsGlobalWindowInner::Navigator()
|
||||
nsPIDOMWindowInner::Navigator()
|
||||
{
|
||||
if (!mNavigator) {
|
||||
mNavigator = new mozilla::dom::Navigator(this);
|
||||
@ -2264,12 +2264,6 @@ nsGlobalWindowInner::Navigator()
|
||||
return mNavigator;
|
||||
}
|
||||
|
||||
nsIDOMNavigator*
|
||||
nsGlobalWindowInner::GetNavigator()
|
||||
{
|
||||
return Navigator();
|
||||
}
|
||||
|
||||
nsScreen*
|
||||
nsGlobalWindowInner::GetScreen(ErrorResult& aError)
|
||||
{
|
||||
@ -4295,15 +4289,14 @@ nsGlobalWindowInner::ConvertDialogOptions(const nsAString& aOptions,
|
||||
}
|
||||
}
|
||||
|
||||
nsresult
|
||||
void
|
||||
nsGlobalWindowInner::UpdateCommands(const nsAString& anAction,
|
||||
nsISelection* aSel,
|
||||
int16_t aReason)
|
||||
{
|
||||
if (GetOuterWindowInternal()) {
|
||||
return GetOuterWindowInternal()->UpdateCommands(anAction, aSel, aReason);
|
||||
GetOuterWindowInternal()->UpdateCommands(anAction, aSel, aReason);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
Selection*
|
||||
|
@ -113,7 +113,6 @@ class IncrementalRunnable;
|
||||
class IntlUtils;
|
||||
class Location;
|
||||
class MediaQueryList;
|
||||
class Navigator;
|
||||
class OwningExternalOrWindowProxy;
|
||||
class Promise;
|
||||
class PostMessageEvent;
|
||||
@ -676,8 +675,6 @@ public:
|
||||
const nsAString& aName,
|
||||
const nsAString& aOptions,
|
||||
mozilla::ErrorResult& aError);
|
||||
mozilla::dom::Navigator* Navigator();
|
||||
nsIDOMNavigator* GetNavigator() override;
|
||||
nsIDOMOfflineResourceList* GetApplicationCache(mozilla::ErrorResult& aError);
|
||||
already_AddRefed<nsIDOMOfflineResourceList> GetApplicationCache() override;
|
||||
|
||||
@ -899,7 +896,7 @@ public:
|
||||
const nsAString& aOptions,
|
||||
const mozilla::dom::Sequence<JS::Value>& aExtraArgument,
|
||||
mozilla::ErrorResult& aError);
|
||||
nsresult UpdateCommands(const nsAString& anAction, nsISelection* aSel, int16_t aReason) override;
|
||||
void UpdateCommands(const nsAString& anAction, nsISelection* aSel, int16_t aReason);
|
||||
|
||||
void GetContent(JSContext* aCx,
|
||||
JS::MutableHandle<JSObject*> aRetval,
|
||||
@ -1346,7 +1343,6 @@ protected:
|
||||
nsRefPtrHashtable<nsUint32HashKey, mozilla::dom::Gamepad> mGamepads;
|
||||
bool mHasSeenGamepadInput;
|
||||
|
||||
RefPtr<mozilla::dom::Navigator> mNavigator;
|
||||
RefPtr<nsScreen> mScreen;
|
||||
|
||||
RefPtr<mozilla::dom::BarProp> mMenubar;
|
||||
|
@ -2603,10 +2603,10 @@ nsPIDOMWindowOuter::SetFrameElementInternal(Element* aFrameElement)
|
||||
mFrameElement = aFrameElement;
|
||||
}
|
||||
|
||||
nsIDOMNavigator*
|
||||
Navigator*
|
||||
nsGlobalWindowOuter::GetNavigator()
|
||||
{
|
||||
FORWARD_TO_INNER(GetNavigator, (), nullptr);
|
||||
FORWARD_TO_INNER(Navigator, (), nullptr);
|
||||
}
|
||||
|
||||
nsIDOMScreen*
|
||||
@ -6364,7 +6364,7 @@ public:
|
||||
};
|
||||
} // anonymous namespace
|
||||
|
||||
nsresult
|
||||
void
|
||||
nsGlobalWindowOuter::UpdateCommands(const nsAString& anAction,
|
||||
nsISelection* aSel,
|
||||
int16_t aReason)
|
||||
@ -6377,13 +6377,14 @@ nsGlobalWindowOuter::UpdateCommands(const nsAString& anAction,
|
||||
nsContentUtils::AddScriptRunner(
|
||||
new ChildCommandDispatcher(root, child, anAction));
|
||||
}
|
||||
return NS_OK;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
nsPIDOMWindowOuter *rootWindow = GetPrivateRoot();
|
||||
if (!rootWindow)
|
||||
return NS_OK;
|
||||
if (!rootWindow) {
|
||||
return;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDOMXULDocument> xulDoc =
|
||||
do_QueryInterface(rootWindow->GetExtantDoc());
|
||||
@ -6399,8 +6400,6 @@ nsGlobalWindowOuter::UpdateCommands(const nsAString& anAction,
|
||||
anAction));
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
Selection*
|
||||
|
@ -608,7 +608,7 @@ public:
|
||||
nsIDocShellLoadInfo* aLoadInfo,
|
||||
bool aForceNoOpener,
|
||||
nsPIDOMWindowOuter **_retval) override;
|
||||
nsIDOMNavigator* GetNavigator() override;
|
||||
mozilla::dom::Navigator* GetNavigator() override;
|
||||
|
||||
#if defined(MOZ_WIDGET_ANDROID)
|
||||
int16_t Orientation(mozilla::dom::CallerType aCallerType) const;
|
||||
@ -686,7 +686,7 @@ public:
|
||||
const nsAString& aOptions,
|
||||
nsISupports* aExtraArgument,
|
||||
nsPIDOMWindowOuter** _retval) override;
|
||||
nsresult UpdateCommands(const nsAString& anAction, nsISelection* aSel, int16_t aReason) override;
|
||||
void UpdateCommands(const nsAString& anAction, nsISelection* aSel, int16_t aReason) override;
|
||||
|
||||
already_AddRefed<nsPIDOMWindowOuter>
|
||||
GetContentInternal(mozilla::ErrorResult& aError,
|
||||
|
@ -8,12 +8,11 @@
|
||||
|
||||
#include "mozilla/dom/MimeTypeArrayBinding.h"
|
||||
#include "mozilla/dom/MimeTypeBinding.h"
|
||||
#include "nsIDOMNavigator.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
#include "nsPluginArray.h"
|
||||
#include "nsIMIMEService.h"
|
||||
#include "nsIMIMEInfo.h"
|
||||
#include "Navigator.h"
|
||||
#include "mozilla/dom/Navigator.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsPluginTags.h"
|
||||
@ -173,15 +172,10 @@ nsMimeTypeArray::EnsurePluginMimeTypes()
|
||||
return;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDOMNavigator> navigator = mWindow->GetNavigator();
|
||||
RefPtr<Navigator> navigator = mWindow->Navigator();
|
||||
|
||||
if (!navigator) {
|
||||
return;
|
||||
}
|
||||
|
||||
ErrorResult rv;
|
||||
nsPluginArray *pluginArray =
|
||||
static_cast<Navigator*>(navigator.get())->GetPlugins(rv);
|
||||
IgnoredErrorResult rv;
|
||||
nsPluginArray *pluginArray = navigator->GetPlugins(rv);
|
||||
if (!pluginArray) {
|
||||
return;
|
||||
}
|
||||
|
@ -51,6 +51,7 @@ class ClientState;
|
||||
class DocGroup;
|
||||
class TabGroup;
|
||||
class Element;
|
||||
class Navigator;
|
||||
class Performance;
|
||||
class ServiceWorkerDescriptor;
|
||||
class ServiceWorkerRegistration;
|
||||
@ -589,7 +590,7 @@ public:
|
||||
}
|
||||
|
||||
virtual nsIDOMScreen* GetScreen() = 0;
|
||||
virtual nsIDOMNavigator* GetNavigator() = 0;
|
||||
mozilla::dom::Navigator* Navigator();
|
||||
virtual mozilla::dom::Location* GetLocation() = 0;
|
||||
|
||||
virtual nsresult GetControllers(nsIControllers** aControllers) = 0;
|
||||
@ -612,8 +613,6 @@ public:
|
||||
virtual nsresult Focus() = 0;
|
||||
virtual nsresult Close() = 0;
|
||||
|
||||
virtual nsresult UpdateCommands(const nsAString& anAction, nsISelection* aSel, int16_t aReason) = 0;
|
||||
|
||||
mozilla::dom::DocGroup* GetDocGroup() const;
|
||||
virtual nsISerialEventTarget*
|
||||
EventTargetFor(mozilla::TaskCategory aCategory) const = 0;
|
||||
@ -647,6 +646,8 @@ protected:
|
||||
RefPtr<mozilla::dom::Performance> mPerformance;
|
||||
mozilla::UniquePtr<mozilla::dom::TimeoutManager> mTimeoutManager;
|
||||
|
||||
RefPtr<mozilla::dom::Navigator> mNavigator;
|
||||
|
||||
typedef nsRefPtrHashtable<nsStringHashKey,
|
||||
mozilla::dom::ServiceWorkerRegistration>
|
||||
ServiceWorkerRegistrationTable;
|
||||
@ -1098,7 +1099,7 @@ public:
|
||||
// XXX(nika): These feel like they should be inner window only, but they're
|
||||
// called on the outer window.
|
||||
virtual nsIDOMScreen* GetScreen() = 0;
|
||||
virtual nsIDOMNavigator* GetNavigator() = 0;
|
||||
virtual mozilla::dom::Navigator* GetNavigator() = 0;
|
||||
virtual mozilla::dom::Location* GetLocation() = 0;
|
||||
|
||||
virtual nsresult GetPrompter(nsIPrompt** aPrompt) = 0;
|
||||
@ -1135,7 +1136,7 @@ public:
|
||||
|
||||
virtual nsresult MoveBy(int32_t aXDif, int32_t aYDif) = 0;
|
||||
|
||||
virtual nsresult UpdateCommands(const nsAString& anAction, nsISelection* aSel, int16_t aReason) = 0;
|
||||
virtual void UpdateCommands(const nsAString& anAction, nsISelection* aSel, int16_t aReason) = 0;
|
||||
|
||||
mozilla::dom::DocGroup* GetDocGroup() const;
|
||||
virtual nsISerialEventTarget*
|
||||
|
@ -170,13 +170,8 @@ nsPluginArray::Refresh(bool aReloadDocuments)
|
||||
mPlugins.Clear();
|
||||
mCTPPlugins.Clear();
|
||||
|
||||
nsCOMPtr<nsIDOMNavigator> navigator = mWindow->GetNavigator();
|
||||
|
||||
if (!navigator) {
|
||||
return;
|
||||
}
|
||||
|
||||
static_cast<mozilla::dom::Navigator*>(navigator.get())->RefreshMIMEArray();
|
||||
RefPtr<Navigator> navigator = mWindow->Navigator();
|
||||
navigator->RefreshMIMEArray();
|
||||
|
||||
nsCOMPtr<nsIWebNavigation> webNav = do_GetInterface(mWindow);
|
||||
if (aReloadDocuments && webNav) {
|
||||
|
@ -601,6 +601,14 @@ public:
|
||||
nullptr);
|
||||
}
|
||||
|
||||
// But starting a process can failure for any number of reasons. Reject the
|
||||
// promise if we could not.
|
||||
if (!targetProcess) {
|
||||
mPromise->Reject(NS_ERROR_ABORT, __func__);
|
||||
mPromise = nullptr;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
ClientOpenWindowOpParent* actor =
|
||||
new ClientOpenWindowOpParent(mArgs, mPromise);
|
||||
|
||||
|
@ -401,11 +401,7 @@ ClientSource::SetController(const ServiceWorkerDescriptor& aServiceWorker)
|
||||
RefPtr<ServiceWorkerContainer> swc;
|
||||
nsPIDOMWindowInner* window = GetInnerWindow();
|
||||
if (window) {
|
||||
RefPtr<Navigator> navigator =
|
||||
static_cast<Navigator*>(window->GetNavigator());
|
||||
if (navigator) {
|
||||
swc = navigator->ServiceWorker();
|
||||
}
|
||||
swc = window->Navigator()->ServiceWorker();
|
||||
}
|
||||
|
||||
// TODO: Also self.navigator.serviceWorker on workers when its exposed there
|
||||
@ -514,11 +510,7 @@ ClientSource::PostMessage(const ClientPostMessageArgs& aArgs)
|
||||
nsPIDOMWindowInner* window = GetInnerWindow();
|
||||
if (window) {
|
||||
globalObject = do_QueryInterface(window);
|
||||
RefPtr<Navigator> navigator =
|
||||
static_cast<Navigator*>(window->GetNavigator());
|
||||
if (navigator) {
|
||||
target = navigator->ServiceWorker();
|
||||
}
|
||||
target = window->Navigator()->ServiceWorker();
|
||||
}
|
||||
|
||||
if (NS_WARN_IF(!target)) {
|
||||
|
@ -1127,7 +1127,8 @@ nsTextInputListener::UpdateTextInputCommands(const nsAString& commandsToUpdate,
|
||||
nsPIDOMWindowOuter *domWindow = doc->GetWindow();
|
||||
NS_ENSURE_TRUE(domWindow, NS_ERROR_FAILURE);
|
||||
|
||||
return domWindow->UpdateCommands(commandsToUpdate, sel, reason);
|
||||
domWindow->UpdateCommands(commandsToUpdate, sel, reason);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// END nsTextInputListener
|
||||
|
@ -42,7 +42,6 @@ class DOMException;
|
||||
// Base
|
||||
interface nsIDOMWindow;
|
||||
interface nsIDOMWindowCollection;
|
||||
interface nsIDOMNavigator;
|
||||
interface nsIDOMScreen;
|
||||
|
||||
// Events
|
||||
|
@ -23,7 +23,6 @@ XPIDL_SOURCES += [
|
||||
'nsIDOMGlobalPropertyInitializer.idl',
|
||||
'nsIDOMHistory.idl',
|
||||
'nsIDOMModalContentWindow.idl',
|
||||
'nsIDOMNavigator.idl',
|
||||
'nsIDOMScreen.idl',
|
||||
'nsIDOMWindow.idl',
|
||||
'nsIDOMWindowCollection.idl',
|
||||
|
@ -1,20 +0,0 @@
|
||||
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "domstubs.idl"
|
||||
|
||||
interface nsIIdleObserver;
|
||||
|
||||
[uuid(f1101fbb-d119-4cb8-845b-6bbae8a151c7)]
|
||||
interface nsIDOMNavigator : nsISupports
|
||||
{
|
||||
readonly attribute DOMString appCodeName;
|
||||
readonly attribute DOMString language;
|
||||
readonly attribute DOMString vendor;
|
||||
readonly attribute DOMString vendorSub;
|
||||
readonly attribute DOMString product;
|
||||
readonly attribute DOMString productSub;
|
||||
readonly attribute DOMString doNotTrack;
|
||||
};
|
@ -1989,6 +1989,11 @@ ContentParent::LaunchSubprocess(ProcessPriority aInitialPriority /* = PROCESS_PR
|
||||
{
|
||||
AUTO_PROFILER_LABEL("ContentParent::LaunchSubprocess", OTHER);
|
||||
|
||||
if (!ContentProcessManager::GetSingleton()) {
|
||||
// Shutdown has begun, we shouldn't spawn any more child processes.
|
||||
return false;
|
||||
}
|
||||
|
||||
std::vector<std::string> extraArgs;
|
||||
extraArgs.push_back("-childID");
|
||||
char idStr[21];
|
||||
|
@ -5,7 +5,6 @@
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
XPIDL_SOURCES += [
|
||||
'nsIMozNavigatorNetwork.idl',
|
||||
'nsITCPSocketCallback.idl',
|
||||
'nsIUDPSocketChild.idl',
|
||||
]
|
||||
|
@ -1,13 +0,0 @@
|
||||
/* 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 "nsISupports.idl"
|
||||
|
||||
interface nsINetworkProperties;
|
||||
|
||||
[uuid(7956523b-631e-4f80-94a5-3883bcfd6bf3)]
|
||||
interface nsIMozNavigatorNetwork : nsISupports
|
||||
{
|
||||
readonly attribute nsINetworkProperties properties;
|
||||
};
|
@ -37,7 +37,7 @@ Navigator implements NavigatorStorage;
|
||||
[NoInterfaceObject, Exposed=(Window,Worker)]
|
||||
interface NavigatorID {
|
||||
// WebKit/Blink/Trident/Presto support this (hardcoded "Mozilla").
|
||||
[Constant, Cached]
|
||||
[Constant, Cached, Throws]
|
||||
readonly attribute DOMString appCodeName; // constant "Mozilla"
|
||||
[Constant, Cached, NeedsCallerType]
|
||||
readonly attribute DOMString appName;
|
||||
@ -169,7 +169,6 @@ callback interface MozIdleObserver {
|
||||
void onactive();
|
||||
};
|
||||
|
||||
// nsIDOMNavigator
|
||||
partial interface Navigator {
|
||||
[Throws, Constant, Cached, NeedsCallerType]
|
||||
readonly attribute DOMString oscpu;
|
||||
|
@ -50,7 +50,7 @@ public:
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void GetAppCodeName(nsString& aAppCodeName) const
|
||||
void GetAppCodeName(nsString& aAppCodeName, ErrorResult& /* unused */) const
|
||||
{
|
||||
aAppCodeName.AssignLiteral("Mozilla");
|
||||
}
|
||||
|
@ -1483,6 +1483,19 @@ CompositorBridgeParent::NewCompositor(const nsTArray<LayersBackend>& aBackendHin
|
||||
#endif
|
||||
}
|
||||
nsCString failureReason;
|
||||
|
||||
// Some software GPU emulation implementations will happily try to create
|
||||
// unreasonably big surfaces and then fail in awful ways.
|
||||
// Let's at least limit this to the default max texture size we use for content,
|
||||
// anything larger than that will fail to render on the content side anyway.
|
||||
// We can revisit this value and make it even tighter if need be.
|
||||
const int max_fb_size = 32767;
|
||||
const LayoutDeviceIntSize size = mWidget->GetClientSize();
|
||||
if (size.width > max_fb_size || size.height > max_fb_size) {
|
||||
failureReason = "FEATURE_FAILURE_MAX_FRAMEBUFFER_SIZE";
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
MOZ_ASSERT(!gfxVars::UseWebRender() || aBackendHints[i] == LayersBackend::LAYERS_BASIC);
|
||||
if (compositor && compositor->Initialize(&failureReason)) {
|
||||
if (failureReason.IsEmpty()){
|
||||
|
@ -4,6 +4,7 @@
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "mozilla/intl/WordBreaker.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
|
||||
using mozilla::intl::WordBreaker;
|
||||
using mozilla::intl::WordBreakClass;
|
||||
@ -47,13 +48,18 @@ bool WordBreaker::BreakInBetween(
|
||||
/* static */ WordBreakClass
|
||||
WordBreaker::GetClass(char16_t c)
|
||||
{
|
||||
// The pref is cached on first call; changes will require a browser restart.
|
||||
static bool sStopAtUnderscore =
|
||||
Preferences::GetBool("layout.word_select.stop_at_underscore", false);
|
||||
|
||||
// begin of the hack
|
||||
|
||||
if (IS_ALPHABETICAL_SCRIPT(c)) {
|
||||
if(IS_ASCII(c)) {
|
||||
if(ASCII_IS_SPACE(c)) {
|
||||
return kWbClassSpace;
|
||||
} else if(ASCII_IS_ALPHA(c) || ASCII_IS_DIGIT(c) || c == '_') {
|
||||
} else if(ASCII_IS_ALPHA(c) || ASCII_IS_DIGIT(c) ||
|
||||
(c == '_' && !sStopAtUnderscore)) {
|
||||
return kWbClassAlphaLetter;
|
||||
} else {
|
||||
return kWbClassPunct;
|
||||
|
@ -8110,6 +8110,9 @@ bool
|
||||
ClusterIterator::IsPunctuation()
|
||||
{
|
||||
NS_ASSERTION(mCharIndex >= 0, "No cluster selected");
|
||||
// The pref is cached on first call; changes will require a browser restart.
|
||||
static bool sStopAtUnderscore =
|
||||
Preferences::GetBool("layout.word_select.stop_at_underscore", false);
|
||||
// Return true for all Punctuation categories (Unicode general category P?),
|
||||
// and also for Symbol categories (S?) except for Modifier Symbol, which is
|
||||
// kept together with any adjacent letter/number. (Bug 1066756)
|
||||
@ -8117,7 +8120,7 @@ ClusterIterator::IsPunctuation()
|
||||
uint8_t cat = unicode::GetGeneralCategory(ch);
|
||||
switch (cat) {
|
||||
case HB_UNICODE_GENERAL_CATEGORY_CONNECT_PUNCTUATION: /* Pc */
|
||||
if (ch == '_') {
|
||||
if (ch == '_' && !sStopAtUnderscore) {
|
||||
return false;
|
||||
}
|
||||
MOZ_FALLTHROUGH;
|
||||
|
@ -41,7 +41,7 @@ DrawEventRecorderPRFileDesc::IsOpen()
|
||||
void
|
||||
DrawEventRecorderPRFileDesc::OpenFD(PRFileDesc* aFd)
|
||||
{
|
||||
MOZ_ASSERT(!IsOpen());
|
||||
MOZ_DIAGNOSTIC_ASSERT(!IsOpen());
|
||||
|
||||
mOutputStream.OpenFD(aFd);
|
||||
WriteHeader(mOutputStream);
|
||||
@ -50,7 +50,7 @@ DrawEventRecorderPRFileDesc::OpenFD(PRFileDesc* aFd)
|
||||
void
|
||||
DrawEventRecorderPRFileDesc::Close()
|
||||
{
|
||||
MOZ_ASSERT(IsOpen());
|
||||
MOZ_DIAGNOSTIC_ASSERT(IsOpen());
|
||||
|
||||
mOutputStream.Close();
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ public:
|
||||
|
||||
void OpenFD(PRFileDesc* aFd)
|
||||
{
|
||||
MOZ_ASSERT(!IsOpen());
|
||||
MOZ_DIAGNOSTIC_ASSERT(!IsOpen());
|
||||
mFd = aFd;
|
||||
mGood = !!mFd;
|
||||
mBuffer.reset(new uint8_t[kBufferSize]);
|
||||
|
47
layout/reftests/bugs/816876-1-ref.xhtml
Normal file
47
layout/reftests/bugs/816876-1-ref.xhtml
Normal file
@ -0,0 +1,47 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/
|
||||
-->
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<style>
|
||||
.container {
|
||||
width: 40px;
|
||||
height: 14px;
|
||||
border: 2px solid green;
|
||||
margin-bottom: 2px;
|
||||
}
|
||||
.a {
|
||||
width: 16px;
|
||||
height: 10px;
|
||||
background: blue;
|
||||
min-width: 0;
|
||||
border: 2px solid lightblue;
|
||||
}
|
||||
.b {
|
||||
width: 16px;
|
||||
height: 10px;
|
||||
background: purple;
|
||||
min-width: 0;
|
||||
border: 2px solid slateblue;
|
||||
}
|
||||
.aKid {
|
||||
margin-left: 10px;
|
||||
margin-top: 2px;
|
||||
width: 16px;
|
||||
height: 6px;
|
||||
background: yellow;
|
||||
border: 1px solid black;
|
||||
}
|
||||
.a, .b { float: left; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<div class="a"><div class="aKid"/></div>
|
||||
<div class="b"></div>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
47
layout/reftests/bugs/816876-1.xhtml
Normal file
47
layout/reftests/bugs/816876-1.xhtml
Normal file
@ -0,0 +1,47 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/
|
||||
-->
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<style>
|
||||
.container {
|
||||
width: 40px;
|
||||
height: 14px;
|
||||
border: 2px solid green;
|
||||
margin-bottom: 2px;
|
||||
}
|
||||
.a {
|
||||
width: 16px;
|
||||
height: 10px;
|
||||
background: blue;
|
||||
min-width: 0;
|
||||
border: 2px solid lightblue;
|
||||
}
|
||||
.b {
|
||||
width: 16px;
|
||||
height: 10px;
|
||||
background: purple;
|
||||
min-width: 0;
|
||||
border: 2px solid slateblue;
|
||||
}
|
||||
.aKid {
|
||||
margin-left: 10px;
|
||||
margin-top: 2px;
|
||||
width: 16px;
|
||||
height: 6px;
|
||||
background: yellow;
|
||||
border: 1px solid black;
|
||||
}
|
||||
.a, .b { float: left; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container" style="position: fixed">
|
||||
<div class="a"><div class="aKid"/></div>
|
||||
<div class="b"></div>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
20
layout/reftests/bugs/816876-2-ref.xhtml
Normal file
20
layout/reftests/bugs/816876-2-ref.xhtml
Normal file
@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/
|
||||
-->
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<style>
|
||||
.container {
|
||||
width: 40px;
|
||||
height: 14px;
|
||||
border: 2px solid green;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container"></div>
|
||||
|
||||
</body>
|
||||
</html>
|
20
layout/reftests/bugs/816876-2a.xhtml
Normal file
20
layout/reftests/bugs/816876-2a.xhtml
Normal file
@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/
|
||||
-->
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<style>
|
||||
.container {
|
||||
width: 40px;
|
||||
height: 14px;
|
||||
border: 2px solid green;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container" style="position: fixed"></div>
|
||||
|
||||
</body>
|
||||
</html>
|
21
layout/reftests/bugs/816876-2b.xhtml
Normal file
21
layout/reftests/bugs/816876-2b.xhtml
Normal file
@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/
|
||||
-->
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<style>
|
||||
.container {
|
||||
width: 40px;
|
||||
height: 14px;
|
||||
border: 2px solid green;
|
||||
position: fixed;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container"></div>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -88,7 +88,7 @@ fuzzy-if(gtkWidget,6,26200) == 28811-2b.html 28811-2-ref.html # Bug 1128229
|
||||
!= 82711-1-ref.html 82711-2-ref.html
|
||||
!= 82711-1-ref.html 82711-3-ref.html
|
||||
!= 82711-2-ref.html 82711-3-ref.html
|
||||
fuzzy-if(Android,4,1) == 84400-1.html 84400-1-ref.html
|
||||
fuzzy-if(Android,4,3) == 84400-1.html 84400-1-ref.html
|
||||
fuzzy-if(skiaContent,2,13) == 84400-2.html 84400-2-ref.html
|
||||
== 97777-1.html 97777-1-ref.html
|
||||
== 97777-2.html 97777-2-ref.html
|
||||
@ -1759,6 +1759,9 @@ fuzzy-if(Android,8,608) == 811301-1.html 811301-1-ref.html
|
||||
fuzzy-if(Android,4,400) == 815593-1.html 815593-1-ref.html
|
||||
== 816359-1.html 816359-1-ref.html
|
||||
== 816458-1.html 816458-1-ref.html
|
||||
== 816876-1.xhtml 816876-1-ref.xhtml
|
||||
== 816876-2a.xhtml 816876-2-ref.xhtml
|
||||
== 816876-2b.xhtml 816876-2-ref.xhtml
|
||||
fuzzy-if(skiaContent,1,5) == 816948-1.html 816948-1-ref.html
|
||||
== 817019-1.html about:blank
|
||||
fuzzy-if(skiaContent,1,5) == 818276-1.html 818276-1-ref.html
|
||||
|
186
mfbt/lz4.c
186
mfbt/lz4.c
@ -85,6 +85,7 @@
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/*-************************************
|
||||
* Dependency
|
||||
**************************************/
|
||||
@ -101,21 +102,43 @@
|
||||
# pragma warning(disable : 4293) /* disable: C4293: too large shift (32-bits) */
|
||||
#endif /* _MSC_VER */
|
||||
|
||||
#ifndef FORCE_INLINE
|
||||
#ifndef LZ4_FORCE_INLINE
|
||||
# ifdef _MSC_VER /* Visual Studio */
|
||||
# define FORCE_INLINE static __forceinline
|
||||
# define LZ4_FORCE_INLINE static __forceinline
|
||||
# else
|
||||
# if defined (__cplusplus) || defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L /* C99 */
|
||||
# ifdef __GNUC__
|
||||
# define FORCE_INLINE static inline __attribute__((always_inline))
|
||||
# define LZ4_FORCE_INLINE static inline __attribute__((always_inline))
|
||||
# else
|
||||
# define FORCE_INLINE static inline
|
||||
# define LZ4_FORCE_INLINE static inline
|
||||
# endif
|
||||
# else
|
||||
# define FORCE_INLINE static
|
||||
# define LZ4_FORCE_INLINE static
|
||||
# endif /* __STDC_VERSION__ */
|
||||
# endif /* _MSC_VER */
|
||||
#endif /* FORCE_INLINE */
|
||||
#endif /* LZ4_FORCE_INLINE */
|
||||
|
||||
/* LZ4_FORCE_O2_GCC_PPC64LE and LZ4_FORCE_O2_INLINE_GCC_PPC64LE
|
||||
* Gcc on ppc64le generates an unrolled SIMDized loop for LZ4_wildCopy,
|
||||
* together with a simple 8-byte copy loop as a fall-back path.
|
||||
* However, this optimization hurts the decompression speed by >30%,
|
||||
* because the execution does not go to the optimized loop
|
||||
* for typical compressible data, and all of the preamble checks
|
||||
* before going to the fall-back path become useless overhead.
|
||||
* This optimization happens only with the -O3 flag, and -O2 generates
|
||||
* a simple 8-byte copy loop.
|
||||
* With gcc on ppc64le, all of the LZ4_decompress_* and LZ4_wildCopy
|
||||
* functions are annotated with __attribute__((optimize("O2"))),
|
||||
* and also LZ4_wildCopy is forcibly inlined, so that the O2 attribute
|
||||
* of LZ4_wildCopy does not affect the compression speed.
|
||||
*/
|
||||
#if defined(__PPC64__) && defined(__LITTLE_ENDIAN__) && defined(__GNUC__)
|
||||
# define LZ4_FORCE_O2_GCC_PPC64LE __attribute__((optimize("O2")))
|
||||
# define LZ4_FORCE_O2_INLINE_GCC_PPC64LE __attribute__((optimize("O2"))) LZ4_FORCE_INLINE
|
||||
#else
|
||||
# define LZ4_FORCE_O2_GCC_PPC64LE
|
||||
# define LZ4_FORCE_O2_INLINE_GCC_PPC64LE static
|
||||
#endif
|
||||
|
||||
#if (defined(__GNUC__) && (__GNUC__ >= 3)) || (defined(__INTEL_COMPILER) && (__INTEL_COMPILER >= 800)) || defined(__clang__)
|
||||
# define expect(expr,value) (__builtin_expect ((expr),(value)) )
|
||||
@ -253,7 +276,8 @@ static void LZ4_copy8(void* dst, const void* src)
|
||||
}
|
||||
|
||||
/* customized variant of memcpy, which can overwrite up to 8 bytes beyond dstEnd */
|
||||
static void LZ4_wildCopy(void* dstPtr, const void* srcPtr, void* dstEnd)
|
||||
LZ4_FORCE_O2_INLINE_GCC_PPC64LE
|
||||
void LZ4_wildCopy(void* dstPtr, const void* srcPtr, void* dstEnd)
|
||||
{
|
||||
BYTE* d = (BYTE*)dstPtr;
|
||||
const BYTE* s = (const BYTE*)srcPtr;
|
||||
@ -289,15 +313,24 @@ static const int LZ4_minLength = (MFLIMIT+1);
|
||||
/*-************************************
|
||||
* Error detection
|
||||
**************************************/
|
||||
#define LZ4_STATIC_ASSERT(c) { enum { LZ4_static_assert = 1/(int)(!!(c)) }; } /* use only *after* variable declarations */
|
||||
#if defined(LZ4_DEBUG) && (LZ4_DEBUG>=1)
|
||||
# include <assert.h>
|
||||
#else
|
||||
# ifndef assert
|
||||
# define assert(condition) ((void)0)
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#define LZ4_STATIC_ASSERT(c) { enum { LZ4_static_assert = 1/(int)(!!(c)) }; } /* use only *after* variable declarations */
|
||||
|
||||
#if defined(LZ4_DEBUG) && (LZ4_DEBUG>=2)
|
||||
# include <stdio.h>
|
||||
# define DEBUGLOG(l, ...) { \
|
||||
if (l<=LZ4_DEBUG) { \
|
||||
fprintf(stderr, __FILE__ ": "); \
|
||||
fprintf(stderr, __VA_ARGS__); \
|
||||
fprintf(stderr, " \n"); \
|
||||
static int g_debuglog_enable = 1;
|
||||
# define DEBUGLOG(l, ...) { \
|
||||
if ((g_debuglog_enable) && (l<=LZ4_DEBUG)) { \
|
||||
fprintf(stderr, __FILE__ ": "); \
|
||||
fprintf(stderr, __VA_ARGS__); \
|
||||
fprintf(stderr, " \n"); \
|
||||
} }
|
||||
#else
|
||||
# define DEBUGLOG(l, ...) {} /* disabled */
|
||||
@ -307,7 +340,7 @@ static const int LZ4_minLength = (MFLIMIT+1);
|
||||
/*-************************************
|
||||
* Common functions
|
||||
**************************************/
|
||||
static unsigned LZ4_NbCommonBytes (register reg_t val)
|
||||
static unsigned LZ4_NbCommonBytes (reg_t val)
|
||||
{
|
||||
if (LZ4_isLittleEndian()) {
|
||||
if (sizeof(val)==8) {
|
||||
@ -318,7 +351,14 @@ static unsigned LZ4_NbCommonBytes (register reg_t val)
|
||||
# elif (defined(__clang__) || (defined(__GNUC__) && (__GNUC__>=3))) && !defined(LZ4_FORCE_SW_BITCOUNT)
|
||||
return (__builtin_ctzll((U64)val) >> 3);
|
||||
# else
|
||||
static const int DeBruijnBytePos[64] = { 0, 0, 0, 0, 0, 1, 1, 2, 0, 3, 1, 3, 1, 4, 2, 7, 0, 2, 3, 6, 1, 5, 3, 5, 1, 3, 4, 4, 2, 5, 6, 7, 7, 0, 1, 2, 3, 3, 4, 6, 2, 6, 5, 5, 3, 4, 5, 6, 7, 1, 2, 4, 6, 4, 4, 5, 7, 2, 6, 5, 7, 6, 7, 7 };
|
||||
static const int DeBruijnBytePos[64] = { 0, 0, 0, 0, 0, 1, 1, 2,
|
||||
0, 3, 1, 3, 1, 4, 2, 7,
|
||||
0, 2, 3, 6, 1, 5, 3, 5,
|
||||
1, 3, 4, 4, 2, 5, 6, 7,
|
||||
7, 0, 1, 2, 3, 3, 4, 6,
|
||||
2, 6, 5, 5, 3, 4, 5, 6,
|
||||
7, 1, 2, 4, 6, 4, 4, 5,
|
||||
7, 2, 6, 5, 7, 6, 7, 7 };
|
||||
return DeBruijnBytePos[((U64)((val & -(long long)val) * 0x0218A392CDABBD3FULL)) >> 58];
|
||||
# endif
|
||||
} else /* 32 bits */ {
|
||||
@ -329,12 +369,15 @@ static unsigned LZ4_NbCommonBytes (register reg_t val)
|
||||
# elif (defined(__clang__) || (defined(__GNUC__) && (__GNUC__>=3))) && !defined(LZ4_FORCE_SW_BITCOUNT)
|
||||
return (__builtin_ctz((U32)val) >> 3);
|
||||
# else
|
||||
static const int DeBruijnBytePos[32] = { 0, 0, 3, 0, 3, 1, 3, 0, 3, 2, 2, 1, 3, 2, 0, 1, 3, 3, 1, 2, 2, 2, 2, 0, 3, 1, 2, 0, 1, 0, 1, 1 };
|
||||
static const int DeBruijnBytePos[32] = { 0, 0, 3, 0, 3, 1, 3, 0,
|
||||
3, 2, 2, 1, 3, 2, 0, 1,
|
||||
3, 3, 1, 2, 2, 2, 2, 0,
|
||||
3, 1, 2, 0, 1, 0, 1, 1 };
|
||||
return DeBruijnBytePos[((U32)((val & -(S32)val) * 0x077CB531U)) >> 27];
|
||||
# endif
|
||||
}
|
||||
} else /* Big Endian CPU */ {
|
||||
if (sizeof(val)==8) {
|
||||
if (sizeof(val)==8) { /* 64-bits */
|
||||
# if defined(_MSC_VER) && defined(_WIN64) && !defined(LZ4_FORCE_SW_BITCOUNT)
|
||||
unsigned long r = 0;
|
||||
_BitScanReverse64( &r, val );
|
||||
@ -342,8 +385,11 @@ static unsigned LZ4_NbCommonBytes (register reg_t val)
|
||||
# elif (defined(__clang__) || (defined(__GNUC__) && (__GNUC__>=3))) && !defined(LZ4_FORCE_SW_BITCOUNT)
|
||||
return (__builtin_clzll((U64)val) >> 3);
|
||||
# else
|
||||
static const U32 by32 = sizeof(val)*4; /* 32 on 64 bits (goal), 16 on 32 bits.
|
||||
Just to avoid some static analyzer complaining about shift by 32 on 32-bits target.
|
||||
Note that this code path is never triggered in 32-bits mode. */
|
||||
unsigned r;
|
||||
if (!(val>>32)) { r=4; } else { r=0; val>>=32; }
|
||||
if (!(val>>by32)) { r=4; } else { r=0; val>>=by32; }
|
||||
if (!(val>>16)) { r+=2; val>>=8; } else { val>>=24; }
|
||||
r += (!val);
|
||||
return r;
|
||||
@ -366,11 +412,20 @@ static unsigned LZ4_NbCommonBytes (register reg_t val)
|
||||
}
|
||||
|
||||
#define STEPSIZE sizeof(reg_t)
|
||||
static unsigned LZ4_count(const BYTE* pIn, const BYTE* pMatch, const BYTE* pInLimit)
|
||||
LZ4_FORCE_INLINE
|
||||
unsigned LZ4_count(const BYTE* pIn, const BYTE* pMatch, const BYTE* pInLimit)
|
||||
{
|
||||
const BYTE* const pStart = pIn;
|
||||
|
||||
while (likely(pIn<pInLimit-(STEPSIZE-1))) {
|
||||
if (likely(pIn < pInLimit-(STEPSIZE-1))) {
|
||||
reg_t const diff = LZ4_read_ARCH(pMatch) ^ LZ4_read_ARCH(pIn);
|
||||
if (!diff) {
|
||||
pIn+=STEPSIZE; pMatch+=STEPSIZE;
|
||||
} else {
|
||||
return LZ4_NbCommonBytes(diff);
|
||||
} }
|
||||
|
||||
while (likely(pIn < pInLimit-(STEPSIZE-1))) {
|
||||
reg_t const diff = LZ4_read_ARCH(pMatch) ^ LZ4_read_ARCH(pIn);
|
||||
if (!diff) { pIn+=STEPSIZE; pMatch+=STEPSIZE; continue; }
|
||||
pIn += LZ4_NbCommonBytes(diff);
|
||||
@ -436,7 +491,7 @@ static U32 LZ4_hash5(U64 sequence, tableType_t const tableType)
|
||||
return (U32)(((sequence >> 24) * prime8bytes) >> (64 - hashLog));
|
||||
}
|
||||
|
||||
FORCE_INLINE U32 LZ4_hashPosition(const void* const p, tableType_t const tableType)
|
||||
LZ4_FORCE_INLINE U32 LZ4_hashPosition(const void* const p, tableType_t const tableType)
|
||||
{
|
||||
if ((sizeof(reg_t)==8) && (tableType != byU16)) return LZ4_hash5(LZ4_read_ARCH(p), tableType);
|
||||
return LZ4_hash4(LZ4_read32(p), tableType);
|
||||
@ -452,7 +507,7 @@ static void LZ4_putPositionOnHash(const BYTE* p, U32 h, void* tableBase, tableTy
|
||||
}
|
||||
}
|
||||
|
||||
FORCE_INLINE void LZ4_putPosition(const BYTE* p, void* tableBase, tableType_t tableType, const BYTE* srcBase)
|
||||
LZ4_FORCE_INLINE void LZ4_putPosition(const BYTE* p, void* tableBase, tableType_t tableType, const BYTE* srcBase)
|
||||
{
|
||||
U32 const h = LZ4_hashPosition(p, tableType);
|
||||
LZ4_putPositionOnHash(p, h, tableBase, tableType, srcBase);
|
||||
@ -465,7 +520,7 @@ static const BYTE* LZ4_getPositionOnHash(U32 h, void* tableBase, tableType_t tab
|
||||
{ const U16* const hashTable = (U16*) tableBase; return hashTable[h] + srcBase; } /* default, to ensure a return */
|
||||
}
|
||||
|
||||
FORCE_INLINE const BYTE* LZ4_getPosition(const BYTE* p, void* tableBase, tableType_t tableType, const BYTE* srcBase)
|
||||
LZ4_FORCE_INLINE const BYTE* LZ4_getPosition(const BYTE* p, void* tableBase, tableType_t tableType, const BYTE* srcBase)
|
||||
{
|
||||
U32 const h = LZ4_hashPosition(p, tableType);
|
||||
return LZ4_getPositionOnHash(h, tableBase, tableType, srcBase);
|
||||
@ -474,7 +529,7 @@ FORCE_INLINE const BYTE* LZ4_getPosition(const BYTE* p, void* tableBase, tableTy
|
||||
|
||||
/** LZ4_compress_generic() :
|
||||
inlined, to ensure branches are decided at compilation time */
|
||||
FORCE_INLINE int LZ4_compress_generic(
|
||||
LZ4_FORCE_INLINE int LZ4_compress_generic(
|
||||
LZ4_stream_t_internal* const cctx,
|
||||
const char* const source,
|
||||
char* const dest,
|
||||
@ -944,6 +999,7 @@ LZ4_stream_t* LZ4_createStream(void)
|
||||
|
||||
void LZ4_resetStream (LZ4_stream_t* LZ4_stream)
|
||||
{
|
||||
DEBUGLOG(4, "LZ4_resetStream");
|
||||
MEM_INIT(LZ4_stream, 0, sizeof(LZ4_stream_t));
|
||||
}
|
||||
|
||||
@ -1104,47 +1160,46 @@ int LZ4_saveDict (LZ4_stream_t* LZ4_dict, char* safeBuffer, int dictSize)
|
||||
* Decompression functions
|
||||
*******************************/
|
||||
/*! LZ4_decompress_generic() :
|
||||
* This generic decompression function cover all use cases.
|
||||
* It shall be instantiated several times, using different sets of directives
|
||||
* Note that it is important this generic function is really inlined,
|
||||
* This generic decompression function covers all use cases.
|
||||
* It shall be instantiated several times, using different sets of directives.
|
||||
* Note that it is important for performance that this function really get inlined,
|
||||
* in order to remove useless branches during compilation optimization.
|
||||
*/
|
||||
FORCE_INLINE int LZ4_decompress_generic(
|
||||
const char* const source,
|
||||
char* const dest,
|
||||
int inputSize,
|
||||
int outputSize, /* If endOnInput==endOnInputSize, this value is the max size of Output Buffer. */
|
||||
LZ4_FORCE_O2_GCC_PPC64LE
|
||||
LZ4_FORCE_INLINE int LZ4_decompress_generic(
|
||||
const char* const src,
|
||||
char* const dst,
|
||||
int srcSize,
|
||||
int outputSize, /* If endOnInput==endOnInputSize, this value is `dstCapacity` */
|
||||
|
||||
int endOnInput, /* endOnOutputSize, endOnInputSize */
|
||||
int partialDecoding, /* full, partial */
|
||||
int targetOutputSize, /* only used if partialDecoding==partial */
|
||||
int dict, /* noDict, withPrefix64k, usingExtDict */
|
||||
const BYTE* const lowPrefix, /* == dest when no prefix */
|
||||
const BYTE* const lowPrefix, /* always <= dst, == dst when no prefix */
|
||||
const BYTE* const dictStart, /* only if dict==usingExtDict */
|
||||
const size_t dictSize /* note : = 0 if noDict */
|
||||
)
|
||||
{
|
||||
/* Local Variables */
|
||||
const BYTE* ip = (const BYTE*) source;
|
||||
const BYTE* const iend = ip + inputSize;
|
||||
const BYTE* ip = (const BYTE*) src;
|
||||
const BYTE* const iend = ip + srcSize;
|
||||
|
||||
BYTE* op = (BYTE*) dest;
|
||||
BYTE* op = (BYTE*) dst;
|
||||
BYTE* const oend = op + outputSize;
|
||||
BYTE* cpy;
|
||||
BYTE* oexit = op + targetOutputSize;
|
||||
const BYTE* const lowLimit = lowPrefix - dictSize;
|
||||
|
||||
const BYTE* const dictEnd = (const BYTE*)dictStart + dictSize;
|
||||
const unsigned dec32table[] = {0, 1, 2, 1, 4, 4, 4, 4};
|
||||
const int dec64table[] = {0, 0, 0, -1, 0, 1, 2, 3};
|
||||
const unsigned inc32table[8] = {0, 1, 2, 1, 0, 4, 4, 4};
|
||||
const int dec64table[8] = {0, 0, 0, -1, -4, 1, 2, 3};
|
||||
|
||||
const int safeDecode = (endOnInput==endOnInputSize);
|
||||
const int checkOffset = ((safeDecode) && (dictSize < (int)(64 KB)));
|
||||
|
||||
|
||||
/* Special cases */
|
||||
if ((partialDecoding) && (oexit > oend-MFLIMIT)) oexit = oend-MFLIMIT; /* targetOutputSize too high => decode everything */
|
||||
if ((endOnInput) && (unlikely(outputSize==0))) return ((inputSize==1) && (*ip==0)) ? 0 : -1; /* Empty output buffer */
|
||||
if ((partialDecoding) && (oexit > oend-MFLIMIT)) oexit = oend-MFLIMIT; /* targetOutputSize too high => just decode everything */
|
||||
if ((endOnInput) && (unlikely(outputSize==0))) return ((srcSize==1) && (*ip==0)) ? 0 : -1; /* Empty output buffer */
|
||||
if ((!endOnInput) && (unlikely(outputSize==0))) return (*ip==0?1:-1);
|
||||
|
||||
/* Main Loop : decode sequences */
|
||||
@ -1153,8 +1208,27 @@ FORCE_INLINE int LZ4_decompress_generic(
|
||||
const BYTE* match;
|
||||
size_t offset;
|
||||
|
||||
/* get literal length */
|
||||
unsigned const token = *ip++;
|
||||
|
||||
/* shortcut for common case :
|
||||
* in most circumstances, we expect to decode small matches (<= 18 bytes) separated by few literals (<= 14 bytes).
|
||||
* this shortcut was tested on x86 and x64, where it improves decoding speed.
|
||||
* it has not yet been benchmarked on ARM, Power, mips, etc. */
|
||||
if (((ip + 14 /*maxLL*/ + 2 /*offset*/ <= iend)
|
||||
& (op + 14 /*maxLL*/ + 18 /*maxML*/ <= oend))
|
||||
& ((token < (15<<ML_BITS)) & ((token & ML_MASK) != 15)) ) {
|
||||
size_t const ll = token >> ML_BITS;
|
||||
size_t const off = LZ4_readLE16(ip+ll);
|
||||
const BYTE* const matchPtr = op + ll - off; /* pointer underflow risk ? */
|
||||
if ((off >= 18) /* do not deal with overlapping matches */ & (matchPtr >= lowPrefix)) {
|
||||
size_t const ml = (token & ML_MASK) + MINMATCH;
|
||||
memcpy(op, ip, 16); op += ll; ip += ll + 2 /*offset*/;
|
||||
memcpy(op, matchPtr, 18); op += ml;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
/* decode literal length */
|
||||
if ((length=(token>>ML_BITS)) == RUN_MASK) {
|
||||
unsigned s;
|
||||
do {
|
||||
@ -1188,7 +1262,7 @@ FORCE_INLINE int LZ4_decompress_generic(
|
||||
/* get offset */
|
||||
offset = LZ4_readLE16(ip); ip+=2;
|
||||
match = op - offset;
|
||||
if ((checkOffset) && (unlikely(match < lowLimit))) goto _output_error; /* Error : offset outside buffers */
|
||||
if ((checkOffset) && (unlikely(match + dictSize < lowPrefix))) goto _output_error; /* Error : offset outside buffers */
|
||||
LZ4_write32(op, (U32)offset); /* costs ~1%; silence an msan warning when offset==0 */
|
||||
|
||||
/* get matchlength */
|
||||
@ -1232,14 +1306,13 @@ FORCE_INLINE int LZ4_decompress_generic(
|
||||
/* copy match within block */
|
||||
cpy = op + length;
|
||||
if (unlikely(offset<8)) {
|
||||
const int dec64 = dec64table[offset];
|
||||
op[0] = match[0];
|
||||
op[1] = match[1];
|
||||
op[2] = match[2];
|
||||
op[3] = match[3];
|
||||
match += dec32table[offset];
|
||||
match += inc32table[offset];
|
||||
memcpy(op+4, match, 4);
|
||||
match -= dec64;
|
||||
match -= dec64table[offset];
|
||||
} else { LZ4_copy8(op, match); match+=8; }
|
||||
op += 8;
|
||||
|
||||
@ -1256,31 +1329,34 @@ FORCE_INLINE int LZ4_decompress_generic(
|
||||
LZ4_copy8(op, match);
|
||||
if (length>16) LZ4_wildCopy(op+8, match+8, cpy);
|
||||
}
|
||||
op=cpy; /* correction */
|
||||
op = cpy; /* correction */
|
||||
}
|
||||
|
||||
/* end of decoding */
|
||||
if (endOnInput)
|
||||
return (int) (((char*)op)-dest); /* Nb of output bytes decoded */
|
||||
return (int) (((char*)op)-dst); /* Nb of output bytes decoded */
|
||||
else
|
||||
return (int) (((const char*)ip)-source); /* Nb of input bytes read */
|
||||
return (int) (((const char*)ip)-src); /* Nb of input bytes read */
|
||||
|
||||
/* Overflow error detected */
|
||||
_output_error:
|
||||
return (int) (-(((const char*)ip)-source))-1;
|
||||
return (int) (-(((const char*)ip)-src))-1;
|
||||
}
|
||||
|
||||
|
||||
LZ4_FORCE_O2_GCC_PPC64LE
|
||||
int LZ4_decompress_safe(const char* source, char* dest, int compressedSize, int maxDecompressedSize)
|
||||
{
|
||||
return LZ4_decompress_generic(source, dest, compressedSize, maxDecompressedSize, endOnInputSize, full, 0, noDict, (BYTE*)dest, NULL, 0);
|
||||
}
|
||||
|
||||
LZ4_FORCE_O2_GCC_PPC64LE
|
||||
int LZ4_decompress_safe_partial(const char* source, char* dest, int compressedSize, int targetOutputSize, int maxDecompressedSize)
|
||||
{
|
||||
return LZ4_decompress_generic(source, dest, compressedSize, maxDecompressedSize, endOnInputSize, partial, targetOutputSize, noDict, (BYTE*)dest, NULL, 0);
|
||||
}
|
||||
|
||||
LZ4_FORCE_O2_GCC_PPC64LE
|
||||
int LZ4_decompress_fast(const char* source, char* dest, int originalSize)
|
||||
{
|
||||
return LZ4_decompress_generic(source, dest, 0, originalSize, endOnOutputSize, full, 0, withPrefix64k, (BYTE*)(dest - 64 KB), NULL, 64 KB);
|
||||
@ -1326,6 +1402,7 @@ int LZ4_setStreamDecode (LZ4_streamDecode_t* LZ4_streamDecode, const char* dicti
|
||||
If it's not possible, save the relevant part of decoded data into a safe buffer,
|
||||
and indicate where it stands using LZ4_setStreamDecode()
|
||||
*/
|
||||
LZ4_FORCE_O2_GCC_PPC64LE
|
||||
int LZ4_decompress_safe_continue (LZ4_streamDecode_t* LZ4_streamDecode, const char* source, char* dest, int compressedSize, int maxOutputSize)
|
||||
{
|
||||
LZ4_streamDecode_t_internal* lz4sd = &LZ4_streamDecode->internal_donotuse;
|
||||
@ -1352,6 +1429,7 @@ int LZ4_decompress_safe_continue (LZ4_streamDecode_t* LZ4_streamDecode, const ch
|
||||
return result;
|
||||
}
|
||||
|
||||
LZ4_FORCE_O2_GCC_PPC64LE
|
||||
int LZ4_decompress_fast_continue (LZ4_streamDecode_t* LZ4_streamDecode, const char* source, char* dest, int originalSize)
|
||||
{
|
||||
LZ4_streamDecode_t_internal* lz4sd = &LZ4_streamDecode->internal_donotuse;
|
||||
@ -1386,7 +1464,8 @@ Advanced decoding functions :
|
||||
the dictionary must be explicitly provided within parameters
|
||||
*/
|
||||
|
||||
FORCE_INLINE int LZ4_decompress_usingDict_generic(const char* source, char* dest, int compressedSize, int maxOutputSize, int safe, const char* dictStart, int dictSize)
|
||||
LZ4_FORCE_O2_GCC_PPC64LE
|
||||
LZ4_FORCE_INLINE int LZ4_decompress_usingDict_generic(const char* source, char* dest, int compressedSize, int maxOutputSize, int safe, const char* dictStart, int dictSize)
|
||||
{
|
||||
if (dictSize==0)
|
||||
return LZ4_decompress_generic(source, dest, compressedSize, maxOutputSize, safe, full, 0, noDict, (BYTE*)dest, NULL, 0);
|
||||
@ -1398,17 +1477,20 @@ FORCE_INLINE int LZ4_decompress_usingDict_generic(const char* source, char* dest
|
||||
return LZ4_decompress_generic(source, dest, compressedSize, maxOutputSize, safe, full, 0, usingExtDict, (BYTE*)dest, (const BYTE*)dictStart, dictSize);
|
||||
}
|
||||
|
||||
LZ4_FORCE_O2_GCC_PPC64LE
|
||||
int LZ4_decompress_safe_usingDict(const char* source, char* dest, int compressedSize, int maxOutputSize, const char* dictStart, int dictSize)
|
||||
{
|
||||
return LZ4_decompress_usingDict_generic(source, dest, compressedSize, maxOutputSize, 1, dictStart, dictSize);
|
||||
}
|
||||
|
||||
LZ4_FORCE_O2_GCC_PPC64LE
|
||||
int LZ4_decompress_fast_usingDict(const char* source, char* dest, int originalSize, const char* dictStart, int dictSize)
|
||||
{
|
||||
return LZ4_decompress_usingDict_generic(source, dest, 0, originalSize, 0, dictStart, dictSize);
|
||||
}
|
||||
|
||||
/* debug function */
|
||||
LZ4_FORCE_O2_GCC_PPC64LE
|
||||
int LZ4_decompress_safe_forceExtDict(const char* source, char* dest, int compressedSize, int maxOutputSize, const char* dictStart, int dictSize)
|
||||
{
|
||||
return LZ4_decompress_generic(source, dest, compressedSize, maxOutputSize, endOnInputSize, full, 0, usingExtDict, (BYTE*)dest, (const BYTE*)dictStart, dictSize);
|
||||
|
132
mfbt/lz4.h
132
mfbt/lz4.h
@ -93,7 +93,7 @@ extern "C" {
|
||||
/*------ Version ------*/
|
||||
#define LZ4_VERSION_MAJOR 1 /* for breaking interface changes */
|
||||
#define LZ4_VERSION_MINOR 8 /* for new (non-breaking) interface capabilities */
|
||||
#define LZ4_VERSION_RELEASE 0 /* for tweaks, bug-fixes, or development */
|
||||
#define LZ4_VERSION_RELEASE 1 /* for tweaks, bug-fixes, or development */
|
||||
|
||||
#define LZ4_VERSION_NUMBER (LZ4_VERSION_MAJOR *100*100 + LZ4_VERSION_MINOR *100 + LZ4_VERSION_RELEASE)
|
||||
|
||||
@ -124,30 +124,30 @@ LZ4LIB_API const char* LZ4_versionString (void); /**< library version string;
|
||||
* Simple Functions
|
||||
**************************************/
|
||||
/*! LZ4_compress_default() :
|
||||
Compresses 'sourceSize' bytes from buffer 'source'
|
||||
into already allocated 'dest' buffer of size 'maxDestSize'.
|
||||
Compression is guaranteed to succeed if 'maxDestSize' >= LZ4_compressBound(sourceSize).
|
||||
Compresses 'srcSize' bytes from buffer 'src'
|
||||
into already allocated 'dst' buffer of size 'dstCapacity'.
|
||||
Compression is guaranteed to succeed if 'dstCapacity' >= LZ4_compressBound(srcSize).
|
||||
It also runs faster, so it's a recommended setting.
|
||||
If the function cannot compress 'source' into a more limited 'dest' budget,
|
||||
If the function cannot compress 'src' into a limited 'dst' budget,
|
||||
compression stops *immediately*, and the function result is zero.
|
||||
As a consequence, 'dest' content is not valid.
|
||||
This function never writes outside 'dest' buffer, nor read outside 'source' buffer.
|
||||
sourceSize : Max supported value is LZ4_MAX_INPUT_VALUE
|
||||
maxDestSize : full or partial size of buffer 'dest' (which must be already allocated)
|
||||
return : the number of bytes written into buffer 'dest' (necessarily <= maxOutputSize)
|
||||
or 0 if compression fails */
|
||||
LZ4LIB_API int LZ4_compress_default(const char* source, char* dest, int sourceSize, int maxDestSize);
|
||||
As a consequence, 'dst' content is not valid.
|
||||
This function never writes outside 'dst' buffer, nor read outside 'source' buffer.
|
||||
srcSize : supported max value is LZ4_MAX_INPUT_VALUE
|
||||
dstCapacity : full or partial size of buffer 'dst' (which must be already allocated)
|
||||
return : the number of bytes written into buffer 'dst' (necessarily <= dstCapacity)
|
||||
or 0 if compression fails */
|
||||
LZ4LIB_API int LZ4_compress_default(const char* src, char* dst, int srcSize, int dstCapacity);
|
||||
|
||||
/*! LZ4_decompress_safe() :
|
||||
compressedSize : is the precise full size of the compressed block.
|
||||
maxDecompressedSize : is the size of destination buffer, which must be already allocated.
|
||||
return : the number of bytes decompressed into destination buffer (necessarily <= maxDecompressedSize)
|
||||
If destination buffer is not large enough, decoding will stop and output an error code (<0).
|
||||
compressedSize : is the exact complete size of the compressed block.
|
||||
dstCapacity : is the size of destination buffer, which must be already allocated.
|
||||
return : the number of bytes decompressed into destination buffer (necessarily <= dstCapacity)
|
||||
If destination buffer is not large enough, decoding will stop and output an error code (negative value).
|
||||
If the source stream is detected malformed, the function will stop decoding and return a negative result.
|
||||
This function is protected against buffer overflow exploits, including malicious data packets.
|
||||
It never writes outside output buffer, nor reads outside input buffer.
|
||||
*/
|
||||
LZ4LIB_API int LZ4_decompress_safe (const char* source, char* dest, int compressedSize, int maxDecompressedSize);
|
||||
LZ4LIB_API int LZ4_decompress_safe (const char* src, char* dst, int compressedSize, int dstCapacity);
|
||||
|
||||
|
||||
/*-************************************
|
||||
@ -176,7 +176,7 @@ LZ4_compress_fast() :
|
||||
An acceleration value of "1" is the same as regular LZ4_compress_default()
|
||||
Values <= 0 will be replaced by ACCELERATION_DEFAULT (see lz4.c), which is 1.
|
||||
*/
|
||||
LZ4LIB_API int LZ4_compress_fast (const char* source, char* dest, int sourceSize, int maxDestSize, int acceleration);
|
||||
LZ4LIB_API int LZ4_compress_fast (const char* src, char* dst, int srcSize, int dstCapacity, int acceleration);
|
||||
|
||||
|
||||
/*!
|
||||
@ -187,49 +187,49 @@ LZ4_compress_fast_extState() :
|
||||
Then, provide it as 'void* state' to compression function.
|
||||
*/
|
||||
LZ4LIB_API int LZ4_sizeofState(void);
|
||||
LZ4LIB_API int LZ4_compress_fast_extState (void* state, const char* source, char* dest, int inputSize, int maxDestSize, int acceleration);
|
||||
LZ4LIB_API int LZ4_compress_fast_extState (void* state, const char* src, char* dst, int srcSize, int dstCapacity, int acceleration);
|
||||
|
||||
|
||||
/*!
|
||||
LZ4_compress_destSize() :
|
||||
Reverse the logic, by compressing as much data as possible from 'source' buffer
|
||||
into already allocated buffer 'dest' of size 'targetDestSize'.
|
||||
This function either compresses the entire 'source' content into 'dest' if it's large enough,
|
||||
or fill 'dest' buffer completely with as much data as possible from 'source'.
|
||||
*sourceSizePtr : will be modified to indicate how many bytes where read from 'source' to fill 'dest'.
|
||||
New value is necessarily <= old value.
|
||||
return : Nb bytes written into 'dest' (necessarily <= targetDestSize)
|
||||
or 0 if compression fails
|
||||
Reverse the logic : compresses as much data as possible from 'src' buffer
|
||||
into already allocated buffer 'dst' of size 'targetDestSize'.
|
||||
This function either compresses the entire 'src' content into 'dst' if it's large enough,
|
||||
or fill 'dst' buffer completely with as much data as possible from 'src'.
|
||||
*srcSizePtr : will be modified to indicate how many bytes where read from 'src' to fill 'dst'.
|
||||
New value is necessarily <= old value.
|
||||
return : Nb bytes written into 'dst' (necessarily <= targetDestSize)
|
||||
or 0 if compression fails
|
||||
*/
|
||||
LZ4LIB_API int LZ4_compress_destSize (const char* source, char* dest, int* sourceSizePtr, int targetDestSize);
|
||||
LZ4LIB_API int LZ4_compress_destSize (const char* src, char* dst, int* srcSizePtr, int targetDstSize);
|
||||
|
||||
|
||||
/*!
|
||||
LZ4_decompress_fast() :
|
||||
originalSize : is the original and therefore uncompressed size
|
||||
LZ4_decompress_fast() : (unsafe!!)
|
||||
originalSize : is the original uncompressed size
|
||||
return : the number of bytes read from the source buffer (in other words, the compressed size)
|
||||
If the source stream is detected malformed, the function will stop decoding and return a negative result.
|
||||
Destination buffer must be already allocated. Its size must be a minimum of 'originalSize' bytes.
|
||||
note : This function fully respect memory boundaries for properly formed compressed data.
|
||||
Destination buffer must be already allocated. Its size must be >= 'originalSize' bytes.
|
||||
note : This function respects memory boundaries for *properly formed* compressed data.
|
||||
It is a bit faster than LZ4_decompress_safe().
|
||||
However, it does not provide any protection against intentionally modified data stream (malicious input).
|
||||
Use this function in trusted environment only (data to decode comes from a trusted source).
|
||||
*/
|
||||
LZ4LIB_API int LZ4_decompress_fast (const char* source, char* dest, int originalSize);
|
||||
LZ4LIB_API int LZ4_decompress_fast (const char* src, char* dst, int originalSize);
|
||||
|
||||
/*!
|
||||
LZ4_decompress_safe_partial() :
|
||||
This function decompress a compressed block of size 'compressedSize' at position 'source'
|
||||
into destination buffer 'dest' of size 'maxDecompressedSize'.
|
||||
The function tries to stop decompressing operation as soon as 'targetOutputSize' has been reached,
|
||||
reducing decompression time.
|
||||
return : the number of bytes decoded in the destination buffer (necessarily <= maxDecompressedSize)
|
||||
Note : this number can be < 'targetOutputSize' should the compressed block to decode be smaller.
|
||||
This function decompress a compressed block of size 'srcSize' at position 'src'
|
||||
into destination buffer 'dst' of size 'dstCapacity'.
|
||||
The function will decompress a minimum of 'targetOutputSize' bytes, and stop after that.
|
||||
However, it's not accurate, and may write more than 'targetOutputSize' (but <= dstCapacity).
|
||||
@return : the number of bytes decoded in the destination buffer (necessarily <= dstCapacity)
|
||||
Note : this number can be < 'targetOutputSize' should the compressed block contain less data.
|
||||
Always control how many bytes were decoded.
|
||||
If the source stream is detected malformed, the function will stop decoding and return a negative result.
|
||||
This function never writes outside of output buffer, and never reads outside of input buffer. It is therefore protected against malicious data packets
|
||||
This function never writes outside of output buffer, and never reads outside of input buffer. It is therefore protected against malicious data packets.
|
||||
*/
|
||||
LZ4LIB_API int LZ4_decompress_safe_partial (const char* source, char* dest, int compressedSize, int targetOutputSize, int maxDecompressedSize);
|
||||
LZ4LIB_API int LZ4_decompress_safe_partial (const char* src, char* dst, int srcSize, int targetOutputSize, int dstCapacity);
|
||||
|
||||
|
||||
/*-*********************************************
|
||||
@ -246,24 +246,29 @@ LZ4LIB_API int LZ4_freeStream (LZ4_stream_t* streamPtr);
|
||||
|
||||
/*! LZ4_resetStream() :
|
||||
* An LZ4_stream_t structure can be allocated once and re-used multiple times.
|
||||
* Use this function to init an allocated `LZ4_stream_t` structure and start a new compression.
|
||||
* Use this function to start compressing a new stream.
|
||||
*/
|
||||
LZ4LIB_API void LZ4_resetStream (LZ4_stream_t* streamPtr);
|
||||
|
||||
/*! LZ4_loadDict() :
|
||||
* Use this function to load a static dictionary into LZ4_stream.
|
||||
* Use this function to load a static dictionary into LZ4_stream_t.
|
||||
* Any previous data will be forgotten, only 'dictionary' will remain in memory.
|
||||
* Loading a size of 0 is allowed.
|
||||
* Return : dictionary size, in bytes (necessarily <= 64 KB)
|
||||
* Loading a size of 0 is allowed, and is the same as reset.
|
||||
* @return : dictionary size, in bytes (necessarily <= 64 KB)
|
||||
*/
|
||||
LZ4LIB_API int LZ4_loadDict (LZ4_stream_t* streamPtr, const char* dictionary, int dictSize);
|
||||
|
||||
/*! LZ4_compress_fast_continue() :
|
||||
* Compress buffer content 'src', using data from previously compressed blocks as dictionary to improve compression ratio.
|
||||
* Important : Previous data blocks are assumed to remain present and unmodified !
|
||||
* Compress content into 'src' using data from previously compressed blocks, improving compression ratio.
|
||||
* 'dst' buffer must be already allocated.
|
||||
* If dstCapacity >= LZ4_compressBound(srcSize), compression is guaranteed to succeed, and runs faster.
|
||||
* If not, and if compressed data cannot fit into 'dst' buffer size, compression stops, and function @return==0.
|
||||
*
|
||||
* Important : Up to 64KB of previously compressed data is assumed to remain present and unmodified in memory !
|
||||
* Special 1 : If input buffer is a double-buffer, it can have any size, including < 64 KB.
|
||||
* Special 2 : If input buffer is a ring-buffer, it can have any size, including < 64 KB.
|
||||
*
|
||||
* @return : size of compressed block
|
||||
* or 0 if there is an error (typically, compressed data cannot fit into 'dst')
|
||||
* After an error, the stream status is invalid, it can only be reset or freed.
|
||||
*/
|
||||
LZ4LIB_API int LZ4_compress_fast_continue (LZ4_stream_t* streamPtr, const char* src, char* dst, int srcSize, int dstCapacity, int acceleration);
|
||||
@ -284,35 +289,40 @@ LZ4LIB_API int LZ4_saveDict (LZ4_stream_t* streamPtr, char* safeBuffer, int dict
|
||||
typedef union LZ4_streamDecode_u LZ4_streamDecode_t; /* incomplete type (defined later) */
|
||||
|
||||
/*! LZ4_createStreamDecode() and LZ4_freeStreamDecode() :
|
||||
* creation / destruction of streaming decompression tracking structure */
|
||||
* creation / destruction of streaming decompression tracking structure.
|
||||
* A tracking structure can be re-used multiple times sequentially. */
|
||||
LZ4LIB_API LZ4_streamDecode_t* LZ4_createStreamDecode(void);
|
||||
LZ4LIB_API int LZ4_freeStreamDecode (LZ4_streamDecode_t* LZ4_stream);
|
||||
|
||||
/*! LZ4_setStreamDecode() :
|
||||
* Use this function to instruct where to find the dictionary.
|
||||
* Setting a size of 0 is allowed (same effect as reset).
|
||||
* @return : 1 if OK, 0 if error
|
||||
* An LZ4_streamDecode_t structure can be allocated once and re-used multiple times.
|
||||
* Use this function to start decompression of a new stream of blocks.
|
||||
* A dictionary can optionnally be set. Use NULL or size 0 for a simple reset order.
|
||||
* @return : 1 if OK, 0 if error
|
||||
*/
|
||||
LZ4LIB_API int LZ4_setStreamDecode (LZ4_streamDecode_t* LZ4_streamDecode, const char* dictionary, int dictSize);
|
||||
|
||||
/*! LZ4_decompress_*_continue() :
|
||||
* These decoding functions allow decompression of multiple blocks in "streaming" mode.
|
||||
* Previously decoded blocks *must* remain available at the memory position where they were decoded (up to 64 KB)
|
||||
* In the case of a ring buffers, decoding buffer must be either :
|
||||
* These decoding functions allow decompression of consecutive blocks in "streaming" mode.
|
||||
* A block is an unsplittable entity, it must be presented entirely to a decompression function.
|
||||
* Decompression functions only accept one block at a time.
|
||||
* Previously decoded blocks *must* remain available at the memory position where they were decoded (up to 64 KB).
|
||||
*
|
||||
* Special : if application sets a ring buffer for decompression, it must respect one of the following conditions :
|
||||
* - Exactly same size as encoding buffer, with same update rule (block boundaries at same positions)
|
||||
* In which case, the decoding & encoding ring buffer can have any size, including very small ones ( < 64 KB).
|
||||
* - Larger than encoding buffer, by a minimum of maxBlockSize more bytes.
|
||||
* maxBlockSize is implementation dependent. It's the maximum size you intend to compress into a single block.
|
||||
* maxBlockSize is implementation dependent. It's the maximum size of any single block.
|
||||
* In which case, encoding and decoding buffers do not need to be synchronized,
|
||||
* and encoding ring buffer can have any size, including small ones ( < 64 KB).
|
||||
* - _At least_ 64 KB + 8 bytes + maxBlockSize.
|
||||
* In which case, encoding and decoding buffers do not need to be synchronized,
|
||||
* and encoding ring buffer can have any size, including larger than decoding buffer.
|
||||
* Whenever these conditions are not possible, save the last 64KB of decoded data into a safe buffer,
|
||||
* and indicate where it is saved using LZ4_setStreamDecode()
|
||||
* and indicate where it is saved using LZ4_setStreamDecode() before decompressing next block.
|
||||
*/
|
||||
LZ4LIB_API int LZ4_decompress_safe_continue (LZ4_streamDecode_t* LZ4_streamDecode, const char* source, char* dest, int compressedSize, int maxDecompressedSize);
|
||||
LZ4LIB_API int LZ4_decompress_fast_continue (LZ4_streamDecode_t* LZ4_streamDecode, const char* source, char* dest, int originalSize);
|
||||
LZ4LIB_API int LZ4_decompress_safe_continue (LZ4_streamDecode_t* LZ4_streamDecode, const char* src, char* dst, int srcSize, int dstCapacity);
|
||||
LZ4LIB_API int LZ4_decompress_fast_continue (LZ4_streamDecode_t* LZ4_streamDecode, const char* src, char* dst, int originalSize);
|
||||
|
||||
|
||||
/*! LZ4_decompress_*_usingDict() :
|
||||
@ -320,8 +330,8 @@ LZ4LIB_API int LZ4_decompress_fast_continue (LZ4_streamDecode_t* LZ4_streamDecod
|
||||
* a combination of LZ4_setStreamDecode() followed by LZ4_decompress_*_continue()
|
||||
* They are stand-alone, and don't need an LZ4_streamDecode_t structure.
|
||||
*/
|
||||
LZ4LIB_API int LZ4_decompress_safe_usingDict (const char* source, char* dest, int compressedSize, int maxDecompressedSize, const char* dictStart, int dictSize);
|
||||
LZ4LIB_API int LZ4_decompress_fast_usingDict (const char* source, char* dest, int originalSize, const char* dictStart, int dictSize);
|
||||
LZ4LIB_API int LZ4_decompress_safe_usingDict (const char* src, char* dst, int srcSize, int dstCapcity, const char* dictStart, int dictSize);
|
||||
LZ4LIB_API int LZ4_decompress_fast_usingDict (const char* src, char* dst, int originalSize, const char* dictStart, int dictSize);
|
||||
|
||||
|
||||
/*^**********************************************
|
||||
|
@ -2695,6 +2695,10 @@ var NativeWindow = {
|
||||
return this.defaultContext = Strings.browser.GetStringFromName("browser.menu.context.default");
|
||||
},
|
||||
|
||||
get nonLinkContext() {
|
||||
return "";
|
||||
},
|
||||
|
||||
/* Gets menuitems for an arbitrary node
|
||||
* Parameters:
|
||||
* element - The element to look at. If this element has a contextmenu attribute, the
|
||||
@ -2757,6 +2761,20 @@ var NativeWindow = {
|
||||
return false;
|
||||
},
|
||||
|
||||
// Returns true if there are any link-related context menu items
|
||||
_shouldPreventDefault: function() {
|
||||
for (let context in this.menus) {
|
||||
if (context === this.nonLinkContext) {
|
||||
continue;
|
||||
}
|
||||
let menu = this.menus[context];
|
||||
if (menu.length > 0) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
},
|
||||
|
||||
/* Returns a label to be shown in a tabbed ui if there are multiple "contexts". For instance, if this
|
||||
* is an image inside an <a> tag, we may have a "link" context and an "image" one.
|
||||
*/
|
||||
@ -2766,7 +2784,10 @@ var NativeWindow = {
|
||||
try {
|
||||
let uri = this.makeURI(this._getLinkURL(element));
|
||||
return Strings.browser.GetStringFromName("browser.menu.context." + uri.scheme);
|
||||
} catch(ex) { }
|
||||
} catch(ex) {
|
||||
// Fallback to the default
|
||||
return this.defaultContext;
|
||||
}
|
||||
}
|
||||
|
||||
// Otherwise we try the nodeName
|
||||
@ -2774,8 +2795,7 @@ var NativeWindow = {
|
||||
return Strings.browser.GetStringFromName("browser.menu.context." + element.nodeName.toLowerCase());
|
||||
} catch(ex) { }
|
||||
|
||||
// Fallback to the default
|
||||
return this.defaultContext;
|
||||
return this.nonLinkContext;
|
||||
},
|
||||
|
||||
// Adds context menu items added through the add-on api
|
||||
@ -2823,8 +2843,10 @@ var NativeWindow = {
|
||||
if (this._shouldShow()) {
|
||||
BrowserEventHandler._cancelTapHighlight();
|
||||
|
||||
// Consume / preventDefault the event, and show the contextmenu.
|
||||
event.preventDefault();
|
||||
if (this._shouldPreventDefault()) {
|
||||
// Consume / preventDefault the event.
|
||||
event.preventDefault();
|
||||
}
|
||||
this._innerShow(this._target, event.clientX, event.clientY);
|
||||
this._target = null;
|
||||
|
||||
|
@ -24,8 +24,7 @@ body {
|
||||
background-color: #ced7de;
|
||||
color: #000000;
|
||||
font-weight: bold;
|
||||
border-bottom: 2px solid;
|
||||
-moz-border-bottom-colors: #ff9100 #f27900;
|
||||
border-bottom: 2px solid #f27900;
|
||||
}
|
||||
|
||||
.toolbar-container {
|
||||
|
@ -73,10 +73,6 @@ xul|scrollbarbutton[sbattr="scrollbar-bottom-top"] {
|
||||
|
||||
xul|scrollbar xul|thumb {
|
||||
background-color: rgba(119, 119, 119, 0.4) !important;
|
||||
-moz-border-top-colors: none !important;
|
||||
-moz-border-bottom-colors: none !important;
|
||||
-moz-border-right-colors: none !important;
|
||||
-moz-border-left-colors: none !important;
|
||||
border: none;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
# CMakeLists.txt
|
||||
#
|
||||
# Copyright 2013-2017 by
|
||||
# Copyright 2013-2018 by
|
||||
# David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
#
|
||||
# Written originally by John Cary <cary@txcorp.com>
|
||||
@ -153,8 +153,8 @@ endif ()
|
||||
|
||||
|
||||
set(VERSION_MAJOR "2")
|
||||
set(VERSION_MINOR "8")
|
||||
set(VERSION_PATCH "1")
|
||||
set(VERSION_MINOR "9")
|
||||
set(VERSION_PATCH "0")
|
||||
|
||||
set(PROJECT_VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH})
|
||||
set(SHARED_LIBRARY_VERSION ${VERSION_MAJOR}.${VERSION_MINOR})
|
||||
@ -331,7 +331,9 @@ if (BUILD_FRAMEWORK)
|
||||
)
|
||||
endif ()
|
||||
|
||||
set(CMAKE_DEBUG_POSTFIX d)
|
||||
if (NOT DISABLE_FORCE_DEBUG_POSTFIX)
|
||||
set(CMAKE_DEBUG_POSTFIX d)
|
||||
endif()
|
||||
|
||||
add_library(freetype
|
||||
${PUBLIC_HEADERS}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -2597,7 +2597,7 @@
|
||||
|
||||
----------------------------------------------------------------------------
|
||||
|
||||
Copyright 2000-2017 by
|
||||
Copyright 2000-2018 by
|
||||
David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
|
||||
This file is part of the FreeType project, and may only be used, modified,
|
||||
|
@ -9422,7 +9422,7 @@
|
||||
|
||||
----------------------------------------------------------------------------
|
||||
|
||||
Copyright 2002-2017 by
|
||||
Copyright 2002-2018 by
|
||||
David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
|
||||
This file is part of the FreeType project, and may only be used, modified,
|
||||
|
@ -612,7 +612,7 @@
|
||||
|
||||
* src/base/ftobjs.c (ft_recompute_scaled_metrics): Re-enable
|
||||
conservative rounding of metrics to avoid breaking clients like
|
||||
Pango (see http://bugzilla.gnome.org/show_bug.cgi?id=327852).
|
||||
Pango (see https://bugzilla.gnome.org/show_bug.cgi?id=327852).
|
||||
|
||||
2006-02-25 Werner Lemberg <wl@gnu.org>
|
||||
|
||||
@ -2318,7 +2318,7 @@
|
||||
|
||||
Further information on the SING Glyphlet format can be found at:
|
||||
|
||||
http://www.adobe.com/products/indesign/sing_gaiji.html
|
||||
https://www.adobe.com/content/dam/acom/en/devnet/font/pdfs/5148.SING_Tutorial.pdf
|
||||
|
||||
* include/freetype/tttags.h (TTAG_SING, TTAG_META): New macros for
|
||||
the OpenType tables `SING' and `META'. These two tables are used in
|
||||
@ -2821,7 +2821,7 @@
|
||||
|
||||
----------------------------------------------------------------------------
|
||||
|
||||
Copyright 2005-2017 by
|
||||
Copyright 2005-2018 by
|
||||
David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
|
||||
This file is part of the FreeType project, and may only be used, modified,
|
||||
|
@ -43,7 +43,7 @@
|
||||
* src/base/ftoutln.c (FT_Outline_New_Internal): The length of
|
||||
FT_Outline->points[] should be numPoints, not 2 * numPoints.
|
||||
Found by Paul Messmer, see
|
||||
http://lists.gnu.org/archive/html/freetype-devel/2010-02/msg00003.html
|
||||
https://lists.gnu.org/archive/html/freetype-devel/2010-02/msg00003.html
|
||||
|
||||
2010-02-10 Ken Sharp <ken.sharp@artifex.com>
|
||||
|
||||
@ -108,7 +108,7 @@
|
||||
Preferred family names should be used for legacy systems that
|
||||
can hold only a few faces (<= 4) for a family name. Suggested by
|
||||
Andreas Heinrich.
|
||||
http://lists.gnu.org/archive/html/freetype/2010-01/msg00001.html
|
||||
https://lists.gnu.org/archive/html/freetype/2010-01/msg00001.html
|
||||
|
||||
* include/freetype/ftsnames.h (FT_PARAM_TAG_IGNORE_PREFERRED_FAMILY,
|
||||
FT_PARAM_TAG_IGNORE_PREFERRED_SUBFAMILY): Define.
|
||||
@ -631,7 +631,7 @@
|
||||
The issue of incompatible cast between unsigned long and void*
|
||||
on LLP64 platform is reported by NightStrike from MinGW-Win64
|
||||
project. See
|
||||
http://lists.gnu.org/archive/html/freetype/2009-09/msg00000.html
|
||||
https://lists.gnu.org/archive/html/freetype/2009-09/msg00000.html
|
||||
|
||||
* src/bdf/bdf.h: The type of hashnode->data is changed from
|
||||
void* to size_t.
|
||||
@ -657,7 +657,7 @@
|
||||
On LLP64 platform, the conversion from pointer to FT_Fixed need
|
||||
to drop higher 32-bit. Explicit casts are required. Reported by
|
||||
NightStrike from MinGW-w64 project. See
|
||||
http://lists.gnu.org/archive/html/freetype/2009-09/msg00000.html
|
||||
https://lists.gnu.org/archive/html/freetype/2009-09/msg00000.html
|
||||
|
||||
* src/cff/cffgload.c: Convert the pointers to FT_Fixed explicitly.
|
||||
|
||||
@ -864,7 +864,7 @@
|
||||
LP64 systems: Higher bits are not used.
|
||||
16-bit systems: Drop can occur.
|
||||
See
|
||||
http://lists.gnu.org/archive/html/freetype-devel/2008-12/msg00065.html
|
||||
https://lists.gnu.org/archive/html/freetype-devel/2008-12/msg00065.html
|
||||
These functions will be refined to take FT_ULong flags in
|
||||
next bump with incompatible API change.
|
||||
|
||||
@ -1765,7 +1765,7 @@
|
||||
ftgzip.c by FT2 are enabled by default. To use
|
||||
zlib zcalloc() & zfree(), define USE_ZLIB_ZCALLOC.
|
||||
See discussion:
|
||||
http://lists.gnu.org/archive/html/freetype-devel/2009-02/msg00000.html
|
||||
https://lists.gnu.org/archive/html/freetype-devel/2009-02/msg00000.html
|
||||
|
||||
2009-07-31 suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp>
|
||||
|
||||
@ -1904,7 +1904,7 @@
|
||||
2009-07-15 suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp>
|
||||
|
||||
Borland C++ compiler patch proposed by Mirco Babin.
|
||||
http://lists.gnu.org/archive/html/freetype/2009-07/msg00016.html.
|
||||
https://lists.gnu.org/archive/html/freetype/2009-07/msg00016.html.
|
||||
|
||||
* builds/exports.mk: Delete unused flags, CCexe_{CFLAGS,LDFLAGS}.
|
||||
Fix APINAMES_C and APINAMES_EXE pathnames to reflect the platform
|
||||
@ -1929,7 +1929,7 @@
|
||||
* src/tools/chktrcmp.py: A script to check trace_XXXX macros
|
||||
that are used in C source but undefined in fttrace.h, or
|
||||
defined in fttrace.h but unused in C sources. See
|
||||
http://lists.gnu.org/archive/html/freetype-devel/2009-07/msg00013.html.
|
||||
https://lists.gnu.org/archive/html/freetype-devel/2009-07/msg00013.html.
|
||||
* docs/DEBUG: Mention on chktrcmp.py.
|
||||
* docs/release: Ditto.
|
||||
|
||||
@ -1961,7 +1961,7 @@
|
||||
|
||||
* include/freetype/internal/fttrace.h: Add FT_TRACE_DEF( t1afm )
|
||||
and FT_TRACE_DEF( ttbdf ). See
|
||||
http://lists.gnu.org/archive/html/freetype-devel/2009-07/msg00013.html
|
||||
https://lists.gnu.org/archive/html/freetype-devel/2009-07/msg00013.html
|
||||
|
||||
2009-07-09 suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp>
|
||||
|
||||
@ -1975,8 +1975,8 @@
|
||||
|
||||
Prevent the overflows by a glyph with too many points or contours.
|
||||
The bug is reported by Boris Letocha <b.letocha@gmc.net>. See
|
||||
http://lists.gnu.org/archive/html/freetype-devel/2009-06/msg00031.html
|
||||
http://lists.gnu.org/archive/html/freetype-devel/2009-07/msg00002.html
|
||||
https://lists.gnu.org/archive/html/freetype-devel/2009-06/msg00031.html
|
||||
https://lists.gnu.org/archive/html/freetype-devel/2009-07/msg00002.html
|
||||
|
||||
* include/freetype/ftimage.h (FT_OUTLINE_CONTOURS_MAX,
|
||||
FT_OUTLINE_POINTS_MAX): New macros to declare the maximum
|
||||
@ -2001,7 +2001,7 @@
|
||||
2009-06-28 suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp>
|
||||
|
||||
ftpatent: Fix a bug by wrong usage of service->table_info().
|
||||
http://lists.gnu.org/archive/html/freetype-devel/2008-12/msg00039.html
|
||||
https://lists.gnu.org/archive/html/freetype-devel/2008-12/msg00039.html
|
||||
|
||||
* include/freetype/internal/services/svsfnt.h: Extend
|
||||
FT_SFNT_TableInfoFunc() to take new argument to obtain the offset
|
||||
@ -2069,7 +2069,7 @@
|
||||
|
||||
* builds/unix/configure.raw: Fix a bug in sed script to extract
|
||||
native suffix for binary executables, patch by Peter Breitenlohner.
|
||||
http://lists.gnu.org/archive/html/freetype-devel/2009-04/msg00036.html
|
||||
https://lists.gnu.org/archive/html/freetype-devel/2009-04/msg00036.html
|
||||
|
||||
2009-06-26 Werner Lemberg <wl@gnu.org>
|
||||
|
||||
@ -3469,8 +3469,8 @@
|
||||
faces includes broken face which FT_Done_Face() cannot free,
|
||||
FT_Done_Library() retries FT_Done_Face() and it can fall into
|
||||
an endless loop. See the discussion:
|
||||
http://lists.gnu.org/archive/html/freetype-devel/2008-09/msg00047.html
|
||||
http://lists.gnu.org/archive/html/freetype-devel/2008-10/msg00000.html
|
||||
https://lists.gnu.org/archive/html/freetype-devel/2008-09/msg00047.html
|
||||
https://lists.gnu.org/archive/html/freetype-devel/2008-10/msg00000.html
|
||||
|
||||
2009-01-07 Werner Lemberg <wl@gnu.org>
|
||||
|
||||
@ -3492,7 +3492,7 @@
|
||||
* builds/unix/configure.raw: Don't call AC_CANONICAL_BUILD and
|
||||
AC_CANONICAL_TARGET and use $host_os only. A nice explanation for
|
||||
this change can be found at
|
||||
http://blog.flameeyes.eu/s/canonical-target.
|
||||
https://blog.flameeyes.eu/s/canonical-target.
|
||||
|
||||
From Savannah patch #6712.
|
||||
|
||||
@ -4516,7 +4516,7 @@
|
||||
recommends to add the option only to CFLAGS, LDFLAGS should include
|
||||
it because libfreetype.la is built with -no-undefined. This fixes a
|
||||
bug reported by Ryan Schmidt in MacPorts,
|
||||
http://trac.macports.org/ticket/15331.
|
||||
https://trac.macports.org/ticket/15331.
|
||||
|
||||
2008-06-21 Werner Lemberg <wl@gnu.org>
|
||||
|
||||
@ -6187,13 +6187,13 @@
|
||||
* builds/unix/ftsystem.c (FT_Stream_Open): Temporary fix to prevent
|
||||
32bit unsigned long overflow by 64bit filesize on LP64 platform, as
|
||||
proposed by Sean McBride:
|
||||
http://lists.gnu.org/archive/html/freetype-devel/2007-03/msg00032.html
|
||||
https://lists.gnu.org/archive/html/freetype-devel/2007-03/msg00032.html
|
||||
|
||||
2007-03-22 suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp>
|
||||
|
||||
* builds/unix/ftconfig.in: Suppress SGI compiler's warning against
|
||||
setjmp, proposed by Sean McBride:
|
||||
http://lists.gnu.org/archive/html/freetype-devel/2007-03/msg00032.html
|
||||
https://lists.gnu.org/archive/html/freetype-devel/2007-03/msg00032.html
|
||||
|
||||
2007-03-19 suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp>
|
||||
|
||||
@ -6852,7 +6852,7 @@
|
||||
|
||||
* include/freetype/internal/services/svotval.h: Add `volatile' to
|
||||
sync with the modification by Jens Claudius on 2006-08-22; cf.
|
||||
http://cvs.savannah.gnu.org/viewcvs/freetype/freetype2/src/otvalid/otvmod.c?r1=1.4&r2=1.5
|
||||
https://cvs.savannah.gnu.org/viewcvs/freetype/freetype2/src/otvalid/otvmod.c?r1=1.4&r2=1.5
|
||||
|
||||
2006-12-15 suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp>
|
||||
|
||||
@ -6876,7 +6876,7 @@
|
||||
|
||||
* src/base/ftobjs.c: Improvement of resource fork handler for
|
||||
POSIX, cf.
|
||||
http://lists.gnu.org/archive/html/freetype-devel/2006-10/msg00025.html
|
||||
https://lists.gnu.org/archive/html/freetype-devel/2006-10/msg00025.html
|
||||
(Mac_Read_sfnt_Resource): Count only `sfnt' resource of suitcase font
|
||||
format or .dfont, to simulate the face index number counted by ftmac.c.
|
||||
(IsMacResource): Return the number of scalable faces correctly.
|
||||
@ -7524,7 +7524,7 @@
|
||||
|
||||
`ft_validator_run' wrapping `setjmp' can cause a crash, as found by
|
||||
Jens:
|
||||
http://lists.gnu.org/archive/html/freetype-devel/2006-08/msg00004.htm.
|
||||
https://lists.gnu.org/archive/html/freetype-devel/2006-08/msg00004.htm.
|
||||
|
||||
* src/otvalid/otvmod.c: Replace `ft_validator_run' by `ft_setjmp'.
|
||||
It reverts the change introduced on 2005-08-20.
|
||||
@ -7721,7 +7721,7 @@
|
||||
2006-06-24 Eugeniy Meshcheryakov <eugen@univ.kiev.ua>
|
||||
|
||||
Fix two hinting bugs as reported in
|
||||
http://lists.gnu.org/archive/html/freetype-devel/2006-06/msg00057.html.
|
||||
https://lists.gnu.org/archive/html/freetype-devel/2006-06/msg00057.html.
|
||||
|
||||
* include/freetype/internal/tttypes.h (TT_GlyphZoneRec): Add
|
||||
`first_point' member.
|
||||
@ -7761,7 +7761,7 @@
|
||||
should return `FT_Err_Unimplemented_Feature' if validation service
|
||||
is unavailable (disabled in `modules.cfg'). It is originally
|
||||
suggested by David Turner, cf.
|
||||
http://lists.gnu.org/archive/html/freetype-devel/2005-11/msg00078.html
|
||||
https://lists.gnu.org/archive/html/freetype-devel/2005-11/msg00078.html
|
||||
|
||||
* src/base/ftgxval.c (FT_TrueTypeGX_Validate): Return
|
||||
FT_Err_Unimplemented_Feature if TrueTypeGX validation service is
|
||||
@ -7932,7 +7932,7 @@
|
||||
|
||||
----------------------------------------------------------------------------
|
||||
|
||||
Copyright 2006-2017 by
|
||||
Copyright 2006-2018 by
|
||||
David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
|
||||
This file is part of the FreeType project, and may only be used, modified,
|
||||
|
@ -1977,7 +1977,7 @@
|
||||
Most of the code is based on the ClearType whitepaper written by
|
||||
Greg Hitchcock
|
||||
|
||||
http://www.microsoft.com/typography/cleartype/truetypecleartype.aspx
|
||||
https://www.microsoft.com/typography/cleartype/truetypecleartype.aspx
|
||||
|
||||
which gives a detailed overview of the necessary changes to the
|
||||
Microsoft rasterizer so that older fonts are supported. However, a
|
||||
@ -2103,7 +2103,7 @@
|
||||
NEC FA family dated in 1996 have different checksum.
|
||||
Reported by Johnson Y. Yan <yinsen_yan@foxitsoftware.com>; see
|
||||
|
||||
http://lists.gnu.org/archive/html/freetype-devel/2012-06/msg00023.html
|
||||
https://lists.gnu.org/archive/html/freetype-devel/2012-06/msg00023.html
|
||||
|
||||
* src/truetype/ttobjs.c (tt_check_trickyness_sfnt_ids): 4 sets
|
||||
of fpgm & prep table checksums for FA-Gothic, FA-Minchou,
|
||||
@ -2117,7 +2117,7 @@
|
||||
|
||||
Problem reported by jola <hans-jochen.lau@lhsystems.com>; see
|
||||
|
||||
http://lists.gnu.org/archive/html/freetype-devel/2012-05/msg00036.html
|
||||
https://lists.gnu.org/archive/html/freetype-devel/2012-05/msg00036.html
|
||||
|
||||
* src/raster/ftraster.c (SMulDiv_No_Round): New macro.
|
||||
(Line_Up): Use it.
|
||||
@ -2603,7 +2603,7 @@
|
||||
|
||||
See discussion starting at
|
||||
|
||||
http://lists.gnu.org/archive/html/freetype-devel/2012-01/msg00037.html
|
||||
https://lists.gnu.org/archive/html/freetype-devel/2012-01/msg00037.html
|
||||
|
||||
* src/smooth/ftgrays.c: s/TBand/gray_TBand/.
|
||||
* src/raster/ftraster.c: s/TBand/black_TBand/.
|
||||
@ -2616,7 +2616,7 @@
|
||||
`outline.flags' so that this information is preserved. See
|
||||
discussion starting at
|
||||
|
||||
http://lists.gnu.org/archive/html/freetype-devel/2012-02/msg00046.html
|
||||
https://lists.gnu.org/archive/html/freetype-devel/2012-02/msg00046.html
|
||||
|
||||
2012-02-11 Werner Lemberg <wl@gnu.org>
|
||||
|
||||
@ -2677,7 +2677,7 @@
|
||||
[raccess] Modify for PIC build.
|
||||
|
||||
Based on the patch provided by Erik Dahlstrom <ed@opera.com>,
|
||||
http://lists.gnu.org/archive/html/freetype-devel/2012-01/msg00010.html
|
||||
https://lists.gnu.org/archive/html/freetype-devel/2012-01/msg00010.html
|
||||
|
||||
Also `raccess_guess_table[]' and `raccess_rule_by_darwin_vfs()'
|
||||
are renamed with `ft_' suffixes.
|
||||
@ -3127,7 +3127,7 @@
|
||||
|
||||
According to
|
||||
|
||||
http://www.gnu.org/prep/maintain/html_node/Copyright-Notices.html
|
||||
https://www.gnu.org/prep/maintain/html_node/Copyright-Notices.html
|
||||
|
||||
this should be mentioned explicitly.
|
||||
|
||||
@ -3456,7 +3456,7 @@
|
||||
|
||||
See
|
||||
|
||||
http://lists.gnu.org/archive/html/freetype-devel/2011-07/msg00049.html
|
||||
https://lists.gnu.org/archive/html/freetype-devel/2011-07/msg00049.html
|
||||
|
||||
for some comparison images.
|
||||
|
||||
@ -3556,7 +3556,7 @@
|
||||
|
||||
See
|
||||
|
||||
http://lists.gnu.org/archive/html/freetype-devel/2011-07/msg00001.html
|
||||
https://lists.gnu.org/archive/html/freetype-devel/2011-07/msg00001.html
|
||||
|
||||
for example documents. The FreeType stroker now produces results
|
||||
very similar to that produced by GhostScript and Distiller for these
|
||||
@ -4005,9 +4005,9 @@
|
||||
aligned, bluezones for CJK Ideographs are calculated from
|
||||
sample glyphs. At present, vertical bluezones (bluezones
|
||||
to align vertical stems) are disabled by default. For detail, see
|
||||
http://lists.gnu.org/archive/html/freetype-devel/2011-04/msg00070.html
|
||||
http://lists.gnu.org/archive/html/freetype-devel/2011-04/msg00092.html
|
||||
http://lists.gnu.org/archive/html/freetype-devel/2011-05/msg00001.html
|
||||
https://lists.gnu.org/archive/html/freetype-devel/2011-04/msg00070.html
|
||||
https://lists.gnu.org/archive/html/freetype-devel/2011-04/msg00092.html
|
||||
https://lists.gnu.org/archive/html/freetype-devel/2011-05/msg00001.html
|
||||
|
||||
* include/freetype/internal/fttrace.h: New trace component `afcjk'.
|
||||
* src/autofit/afcjk.h (AF_CJK{Blue,Axis,Metric}Rec): Add CJK version
|
||||
@ -4075,8 +4075,8 @@
|
||||
the TrueType font header. Some bad PDF generators write
|
||||
wrong values. For details see examples and benchmark tests
|
||||
of the latency by recalculation:
|
||||
http://lists.gnu.org/archive/html/freetype-devel/2011-04/msg00091.html
|
||||
http://lists.gnu.org/archive/html/freetype-devel/2011-04/msg00096.html
|
||||
https://lists.gnu.org/archive/html/freetype-devel/2011-04/msg00091.html
|
||||
https://lists.gnu.org/archive/html/freetype-devel/2011-04/msg00096.html
|
||||
|
||||
2011-04-30 suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp>
|
||||
|
||||
@ -4109,7 +4109,7 @@
|
||||
Because some PDF generators mangle the family name badly,
|
||||
the trickyness check by the checksum should be invoked always.
|
||||
For sample PDF, see
|
||||
http://lists.gnu.org/archive/html/freetype-devel/2011-04/msg00073.html
|
||||
https://lists.gnu.org/archive/html/freetype-devel/2011-04/msg00073.html
|
||||
|
||||
* src/truetype/ttobjs.c (tt_check_trickyness): Even when
|
||||
tt_check_trickyness_family() finds no trickyness,
|
||||
@ -4146,8 +4146,8 @@
|
||||
When there are too many stems to preserve their gaps in the
|
||||
rasterization of CJK Ideographs at a low resolution, blur the
|
||||
stems instead of showing clumped stems. See
|
||||
http://lists.gnu.org/archive/html/freetype-devel/2011-02/msg00011.html
|
||||
http://lists.gnu.org/archive/html/freetype-devel/2011-04/msg00046.html
|
||||
https://lists.gnu.org/archive/html/freetype-devel/2011-02/msg00011.html
|
||||
https://lists.gnu.org/archive/html/freetype-devel/2011-04/msg00046.html
|
||||
for details.
|
||||
|
||||
* src/autofit/afcjk.c (af_cjk_hint_edges): Store the position of
|
||||
@ -4343,7 +4343,7 @@
|
||||
[cache] Fix an off-by-one bug in `FTC_Manager_RemoveFaceID'.
|
||||
Found by <ychen1392001@yahoo.com.cn>, see detail in
|
||||
|
||||
http://lists.gnu.org/archive/html/freetype/2011-01/msg00023.html
|
||||
https://lists.gnu.org/archive/html/freetype/2011-01/msg00023.html
|
||||
|
||||
* src/cache/ftccache.c (FTC_Cache_RemoveFaceID): Check the node
|
||||
buckets[cache->p + cache->mask] too.
|
||||
@ -4464,7 +4464,7 @@
|
||||
Johnson Y. Yan. The bug report by Qt developers is
|
||||
considered too.
|
||||
|
||||
http://bugreports.qt.nokia.com/browse/QTBUG-6521
|
||||
https://bugreports.qt.io/browse/QTBUG-6521
|
||||
|
||||
2011-01-15 Werner Lemberg <wl@gnu.org>
|
||||
|
||||
@ -4923,7 +4923,7 @@
|
||||
Partially undo change from 2010-10-15 by using ONE_PIXEL/4; this has
|
||||
been tested with demo images sent to the mailing list. See
|
||||
|
||||
http://lists.gnu.org/archive/html/freetype-devel/2010-10/msg00055.html
|
||||
https://lists.gnu.org/archive/html/freetype-devel/2010-10/msg00055.html
|
||||
|
||||
and later mails in this thread.
|
||||
|
||||
@ -4943,7 +4943,7 @@
|
||||
Problem reported by Tom Bishop <wenlin@wenlin.com>; see
|
||||
thread starting with
|
||||
|
||||
http://lists.gnu.org/archive/html/freetype/2010-10/msg00049.html
|
||||
https://lists.gnu.org/archive/html/freetype/2010-10/msg00049.html
|
||||
|
||||
* src/raster/ftraster.c (Line_Up): Replace FMulDiv with SMulDiv
|
||||
since the involved multiplication exceeds 32 bits.
|
||||
@ -5007,7 +5007,7 @@
|
||||
normal clients.
|
||||
|
||||
For the history of these macros, see the investigation:
|
||||
http://lists.gnu.org/archive/html/freetype/2010-10/msg00022.html
|
||||
https://lists.gnu.org/archive/html/freetype/2010-10/msg00022.html
|
||||
|
||||
2010-10-24 suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp>
|
||||
|
||||
@ -5054,7 +5054,7 @@
|
||||
by Darwin VFS are skipped. It reduces the warnings of the
|
||||
deprecated resource fork access method by recent Darwin kernel.
|
||||
Fix MacPorts ticket #18859:
|
||||
http://trac.macports.org/ticket/18859
|
||||
https://trac.macports.org/ticket/18859
|
||||
|
||||
* src/base/ftobjs.c (load_face_in_embedded_rfork):
|
||||
When `FT_Stream_New' returns FT_Err_Cannot_Open_Stream, it
|
||||
@ -5182,7 +5182,7 @@
|
||||
[smooth] Fix splitting of cubics for negative values.
|
||||
|
||||
Reported by Róbert Márki <gsmiko@gmail.com>; see
|
||||
http://lists.gnu.org/archive/html/freetype/2010-09/msg00019.html.
|
||||
https://lists.gnu.org/archive/html/freetype/2010-09/msg00019.html.
|
||||
|
||||
* src/smooth/ftgrays.c (gray_render_cubic): Fix thinko.
|
||||
|
||||
@ -5349,7 +5349,7 @@
|
||||
Ignore the environmental setting of LIBTOOL.
|
||||
Patch is suggested by Adrian Bunk, to prevent unexpected
|
||||
reflection of environmental LIBTOOL. See:
|
||||
http://savannah.nongnu.org/patch/?7290
|
||||
https://savannah.nongnu.org/patch/?7290
|
||||
|
||||
* builds/unix/unix-cc.in: LIBTOOL is unconditionally set to
|
||||
$(FT_LIBTOOL_DIR)/libtool. FT_LIBTOOL_DIR is set to $(BUILD_DIR)
|
||||
@ -5406,8 +5406,8 @@
|
||||
for nameless fonts is safer for PDFs including embedded Chinese
|
||||
fonts. Written by David Bevan, see:
|
||||
|
||||
http://lists.gnu.org/archive/html/freetype-devel/2010-08/msg00021.html
|
||||
http://lists.freedesktop.org/archives/poppler/2010-August/006310.html
|
||||
https://lists.gnu.org/archive/html/freetype-devel/2010-08/msg00021.html
|
||||
https://lists.freedesktop.org/archives/poppler/2010-August/006310.html
|
||||
|
||||
* src/truetype/ttobjs.c (tt_check_trickyness): If a NULL pointer by
|
||||
nameless font is given, TRUE is returned to enable hinting.
|
||||
@ -5968,7 +5968,7 @@
|
||||
|
||||
* src/smooth/ftgrays.c (gray_render_cubic): Fix algorithm.
|
||||
The previous version was too aggressive, as demonstrated in
|
||||
http://lists.gnu.org/archive/html/freetype-devel/2010-06/msg00020.html.
|
||||
https://lists.gnu.org/archive/html/freetype-devel/2010-06/msg00020.html.
|
||||
|
||||
2010-06-24 Werner Lemberg <wl@gnu.org>
|
||||
|
||||
@ -6065,7 +6065,7 @@
|
||||
simplified algorithm to find out whether the spline can be replaced
|
||||
with two straight lines. See this thread for more:
|
||||
|
||||
http://lists.gnu.org/archive/html/freetype-devel/2010-06/msg00000.html
|
||||
https://lists.gnu.org/archive/html/freetype-devel/2010-06/msg00000.html
|
||||
|
||||
2010-06-09 Werner Lemberg <wl@gnu.org>
|
||||
|
||||
@ -6220,7 +6220,7 @@
|
||||
Add new function `FT_Library_SetLcdFilterWeights'.
|
||||
|
||||
This is based on code written by Lifter
|
||||
<http://unixforum.org/index.php?showuser=11691>. It fixes
|
||||
<https://unixforum.org/index.php?showuser=11691>. It fixes
|
||||
FreeDesktop bug #27386.
|
||||
|
||||
* src/base/ftlcdfil.c (FT_Library_SetLcdFilterWeights): New
|
||||
@ -6344,7 +6344,7 @@
|
||||
|
||||
----------------------------------------------------------------------------
|
||||
|
||||
Copyright 2010-2017 by
|
||||
Copyright 2010-2018 by
|
||||
David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
|
||||
This file is part of the FreeType project, and may only be used, modified,
|
||||
|
@ -112,8 +112,8 @@
|
||||
Original patch is designed by Werner Lemberg. Extra part
|
||||
for otvalid and gxvalid are added by suzuki toshiya, see
|
||||
discussion:
|
||||
http://lists.nongnu.org/archive/html/freetype-devel/2014-12/msg00002.html
|
||||
http://lists.nongnu.org/archive/html/freetype-devel/2014-12/msg00007.html
|
||||
https://lists.nongnu.org/archive/html/freetype-devel/2014-12/msg00002.html
|
||||
https://lists.nongnu.org/archive/html/freetype-devel/2014-12/msg00007.html
|
||||
|
||||
* include/internal/ftvalid.h: Introduce FT_THROW() in FT_INVALID_().
|
||||
* src/gxvalid/gxvcommn.h: Ditto.
|
||||
@ -144,7 +144,7 @@
|
||||
for Borland's bug tracker entry.
|
||||
|
||||
Reported by Yuliana Zigangirova <zigangirova@inbox.ru>,
|
||||
http://lists.gnu.org/archive/html/freetype-devel/2014-04/msg00001.html.
|
||||
https://lists.gnu.org/archive/html/freetype-devel/2014-04/msg00001.html.
|
||||
|
||||
* include/internal/ftvalid.h (FT_ValidatorRec), src/smooth/ftgrays.c
|
||||
(gray_TWorker_): Move `ft_jmp_buf' field to be the first element.
|
||||
@ -2669,8 +2669,8 @@
|
||||
with Carbon framework is incompatible with that by FreeType 2
|
||||
without Carbon framework.) Found by Khaled Hosny and Hin-Tak Leung.
|
||||
|
||||
http://lists.gnu.org/archive/html/freetype-devel/2013-02/msg00035.html
|
||||
http://lists.gnu.org/archive/html/freetype-devel/2013-12/msg00027.html
|
||||
https://lists.gnu.org/archive/html/freetype-devel/2013-02/msg00035.html
|
||||
https://lists.gnu.org/archive/html/freetype-devel/2013-12/msg00027.html
|
||||
|
||||
* src/base/ftrfork.c (FT_Raccess_Get_DataOffsets): Add a switch
|
||||
`sort_by_res_id' to control the fragmented resource ordering.
|
||||
@ -3181,7 +3181,7 @@
|
||||
|
||||
Problem reported by Hin-Tak Leung <htl10@users.sourceforge.net>; see
|
||||
|
||||
http://lists.nongnu.org/archive/html/freetype-devel/2013-08/msg00005.html
|
||||
https://lists.nongnu.org/archive/html/freetype-devel/2013-08/msg00005.html
|
||||
|
||||
for details.
|
||||
|
||||
@ -3556,7 +3556,7 @@
|
||||
|
||||
Suggested by Akira Tagoh, see
|
||||
|
||||
http://lists.gnu.org/archive/html/freetype/2013-09/msg00030.html
|
||||
https://lists.gnu.org/archive/html/freetype/2013-09/msg00030.html
|
||||
|
||||
* src/bdf/bdfdrivr.c (BDF_Face_Init): Return `Invalid_Argument'
|
||||
error if the font could be opened but non-zero `face_index' is
|
||||
@ -5145,7 +5145,7 @@
|
||||
|
||||
----------------------------------------------------------------------------
|
||||
|
||||
Copyright 2013-2017 by
|
||||
Copyright 2013-2018 by
|
||||
David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
|
||||
This file is part of the FreeType project, and may only be used, modified,
|
||||
|
@ -663,7 +663,7 @@
|
||||
The previous fix for #46372 misunderstood a composite glyph referring
|
||||
same component twice as a recursive reference. See the discussion
|
||||
|
||||
http://lists.gnu.org/archive/html/freetype/2016-05/msg00000.html
|
||||
https://lists.gnu.org/archive/html/freetype/2016-05/msg00000.html
|
||||
|
||||
Thanks to Khaled Hosny for finding this issue.
|
||||
|
||||
@ -788,7 +788,7 @@
|
||||
proper blue zones can't be defined. However, there is already a
|
||||
proposal submitted to Unicode; see
|
||||
|
||||
http://www.unicode.org/L2/L2016/16034-n4707-georgian.pdf
|
||||
https://www.unicode.org/L2/L2016/16034-n4707-georgian.pdf
|
||||
|
||||
Additionally, due to historical reasons, Unicode treats Khutsuri as
|
||||
the same script as Mkhedruli, and so does OpenType. However, since
|
||||
@ -2478,7 +2478,7 @@
|
||||
|
||||
Problem reported by David Capello <davidcapello@gmail.com>; see
|
||||
|
||||
http://lists.nongnu.org/archive/html/freetype-devel/2015-10/msg00108.html
|
||||
https://lists.nongnu.org/archive/html/freetype-devel/2015-10/msg00108.html
|
||||
|
||||
for details.
|
||||
|
||||
@ -3813,7 +3813,7 @@
|
||||
|
||||
See
|
||||
|
||||
http://lists.nongnu.org/archive/html/freetype-devel/2015-07/msg00008.html
|
||||
https://lists.nongnu.org/archive/html/freetype-devel/2015-07/msg00008.html
|
||||
|
||||
for a rationale.
|
||||
|
||||
@ -3932,7 +3932,7 @@
|
||||
|
||||
This change is a result of a discussion thread on freetype-devel
|
||||
|
||||
http://lists.nongnu.org/archive/html/freetype-devel/2015-06/msg00041.html
|
||||
https://lists.nongnu.org/archive/html/freetype-devel/2015-06/msg00041.html
|
||||
|
||||
Re-introduce the `freetype2' subdirectory for all FreeType header
|
||||
files after installation, and rename the `freetype2' subdirectory in
|
||||
@ -4114,7 +4114,7 @@
|
||||
|
||||
Problem reported by Grissiom <chaos.proton@gmail.com>; in
|
||||
|
||||
http://lists.nongnu.org/archive/html/freetype/2015-05/msg00013.html
|
||||
https://lists.nongnu.org/archive/html/freetype/2015-05/msg00013.html
|
||||
|
||||
there is an example code to trigger the bug.
|
||||
|
||||
@ -4292,7 +4292,7 @@
|
||||
|
||||
This follows the OpenType 1.7 specification. See
|
||||
|
||||
http://tug.org/pipermail/tex-live/2015-April/036634.html
|
||||
https://tug.org/pipermail/tex-live/2015-April/036634.html
|
||||
|
||||
for a discussion.
|
||||
|
||||
@ -5695,7 +5695,7 @@
|
||||
|
||||
----------------------------------------------------------------------------
|
||||
|
||||
Copyright 2015-2017 by
|
||||
Copyright 2015-2018 by
|
||||
David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
|
||||
This file is part of the FreeType project, and may only be used, modified,
|
||||
|
2106
modules/freetype2/ChangeLog.27
Normal file
2106
modules/freetype2/ChangeLog.27
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,6 +1,6 @@
|
||||
# FreeType 2 top Jamfile.
|
||||
#
|
||||
# Copyright 2001-2017 by
|
||||
# Copyright 2001-2018 by
|
||||
# David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
#
|
||||
# This file is part of the FreeType project, and may only be used, modified,
|
||||
@ -210,7 +210,7 @@ actions RefDoc
|
||||
{
|
||||
python $(FT2_SRC)/tools/docmaker/docmaker.py
|
||||
--prefix=ft2
|
||||
--title=FreeType-2.8.1
|
||||
--title=FreeType-2.9
|
||||
--output=$(DOC_DIR)
|
||||
$(FT2_INCLUDE)/freetype/*.h
|
||||
$(FT2_INCLUDE)/freetype/config/*.h
|
||||
|
@ -1,6 +1,6 @@
|
||||
# FreeType 2 JamRules.
|
||||
#
|
||||
# Copyright 2001-2017 by
|
||||
# Copyright 2001-2018 by
|
||||
# David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
#
|
||||
# This file is part of the FreeType project, and may only be used, modified,
|
||||
|
@ -1,39 +1,39 @@
|
||||
|
||||
The FreeType 2 font engine is copyrighted work and cannot be used
|
||||
legally without a software license. In order to make this project
|
||||
usable to a vast majority of developers, we distribute it under two
|
||||
mutually exclusive open-source licenses.
|
||||
|
||||
This means that *you* must choose *one* of the two licenses described
|
||||
below, then obey all its terms and conditions when using FreeType 2 in
|
||||
any of your projects or products.
|
||||
|
||||
- The FreeType License, found in the file `FTL.TXT', which is similar
|
||||
to the original BSD license *with* an advertising clause that forces
|
||||
you to explicitly cite the FreeType project in your product's
|
||||
documentation. All details are in the license file. This license
|
||||
is suited to products which don't use the GNU General Public
|
||||
License.
|
||||
|
||||
Note that this license is compatible to the GNU General Public
|
||||
License version 3, but not version 2.
|
||||
|
||||
- The GNU General Public License version 2, found in `GPLv2.TXT' (any
|
||||
later version can be used also), for programs which already use the
|
||||
GPL. Note that the FTL is incompatible with GPLv2 due to its
|
||||
advertisement clause.
|
||||
|
||||
The contributed BDF and PCF drivers come with a license similar to that
|
||||
of the X Window System. It is compatible to the above two licenses (see
|
||||
file src/bdf/README and src/pcf/README). The same holds for the files
|
||||
`fthash.c' and `fthash.h'; their code was part of the BDF driver in
|
||||
earlier FreeType versions.
|
||||
|
||||
The gzip module uses the zlib license (see src/gzip/zlib.h) which too is
|
||||
compatible to the above two licenses.
|
||||
|
||||
The MD5 checksum support (only used for debugging in development builds)
|
||||
is in the public domain.
|
||||
|
||||
|
||||
--- end of LICENSE.TXT ---
|
||||
|
||||
The FreeType 2 font engine is copyrighted work and cannot be used
|
||||
legally without a software license. In order to make this project
|
||||
usable to a vast majority of developers, we distribute it under two
|
||||
mutually exclusive open-source licenses.
|
||||
|
||||
This means that *you* must choose *one* of the two licenses described
|
||||
below, then obey all its terms and conditions when using FreeType 2 in
|
||||
any of your projects or products.
|
||||
|
||||
- The FreeType License, found in the file `FTL.TXT', which is similar
|
||||
to the original BSD license *with* an advertising clause that forces
|
||||
you to explicitly cite the FreeType project in your product's
|
||||
documentation. All details are in the license file. This license
|
||||
is suited to products which don't use the GNU General Public
|
||||
License.
|
||||
|
||||
Note that this license is compatible to the GNU General Public
|
||||
License version 3, but not version 2.
|
||||
|
||||
- The GNU General Public License version 2, found in `GPLv2.TXT' (any
|
||||
later version can be used also), for programs which already use the
|
||||
GPL. Note that the FTL is incompatible with GPLv2 due to its
|
||||
advertisement clause.
|
||||
|
||||
The contributed BDF and PCF drivers come with a license similar to that
|
||||
of the X Window System. It is compatible to the above two licenses (see
|
||||
file src/bdf/README and src/pcf/README). The same holds for the files
|
||||
`fthash.c' and `fthash.h'; their code was part of the BDF driver in
|
||||
earlier FreeType versions.
|
||||
|
||||
The gzip module uses the zlib license (see src/gzip/zlib.h) which too is
|
||||
compatible to the above two licenses.
|
||||
|
||||
The MD5 checksum support (only used for debugging in development builds)
|
||||
is in the public domain.
|
||||
|
||||
|
||||
--- end of LICENSE.TXT ---
|
||||
|
@ -3,7 +3,7 @@
|
||||
#
|
||||
|
||||
|
||||
# Copyright 1996-2017 by
|
||||
# Copyright 1996-2018 by
|
||||
# David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
#
|
||||
# This file is part of the FreeType project, and may only be used, modified,
|
||||
|
@ -1,7 +1,7 @@
|
||||
FreeType 2.8.1
|
||||
==============
|
||||
FreeType 2.9
|
||||
============
|
||||
|
||||
Homepage: http://www.freetype.org
|
||||
Homepage: https://www.freetype.org
|
||||
|
||||
FreeType is a freely available software library to render fonts.
|
||||
|
||||
@ -20,17 +20,17 @@
|
||||
documentation is available as a separate package from our sites. Go
|
||||
to
|
||||
|
||||
http://download.savannah.gnu.org/releases/freetype/
|
||||
https://download.savannah.gnu.org/releases/freetype/
|
||||
|
||||
and download one of the following files.
|
||||
|
||||
freetype-doc-2.8.1.tar.bz2
|
||||
freetype-doc-2.8.1.tar.gz
|
||||
ftdoc281.zip
|
||||
freetype-doc-2.9.tar.bz2
|
||||
freetype-doc-2.9.tar.gz
|
||||
ftdoc29.zip
|
||||
|
||||
To view the documentation online, go to
|
||||
|
||||
http://www.freetype.org/freetype2/documentation.html
|
||||
https://www.freetype.org/freetype2/documentation.html
|
||||
|
||||
|
||||
Mailing Lists
|
||||
@ -46,7 +46,7 @@
|
||||
|
||||
The lists are moderated; see
|
||||
|
||||
http://www.freetype.org/contact.html
|
||||
https://www.freetype.org/contact.html
|
||||
|
||||
how to subscribe.
|
||||
|
||||
@ -71,7 +71,7 @@
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright 2006-2017 by
|
||||
Copyright 2006-2018 by
|
||||
David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
|
||||
This file is part of the FreeType project, and may only be used,
|
||||
|
@ -37,7 +37,7 @@ repository.
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright 2005-2017 by
|
||||
Copyright 2005-2018 by
|
||||
David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
|
||||
This file is part of the FreeType project, and may only be used,
|
||||
|
@ -1,6 +1,6 @@
|
||||
This directory contains freetype2 v2.8 downloaded from
|
||||
This directory contains FreeType v2.9 downloaded from
|
||||
https://download.savannah.gnu.org/releases/freetype/
|
||||
|
||||
There are currently no local changes applied to the freetype tree,
|
||||
There are currently no local changes applied to the FreeType tree,
|
||||
except that the file docs/LICENSE.TXT has been copied to the top-level
|
||||
directory of the FreeType tree as LICENSE.TXT.
|
||||
|
@ -1,6 +1,6 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Copyright 2005-2017 by
|
||||
# Copyright 2005-2018 by
|
||||
# David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
#
|
||||
# This file is part of the FreeType project, and may only be used, modified,
|
||||
|
@ -1,7 +1,7 @@
|
||||
|
||||
README for the builds/amiga subdirectory.
|
||||
|
||||
Copyright 2005-2017 by
|
||||
Copyright 2005-2018 by
|
||||
Werner Lemberg and Detlef Würkner.
|
||||
|
||||
This file is part of the FreeType project, and may only be used, modified,
|
||||
|
@ -4,7 +4,7 @@
|
||||
/* */
|
||||
/* Amiga-specific configuration file (specification only). */
|
||||
/* */
|
||||
/* Copyright 2005-2017 by */
|
||||
/* Copyright 2005-2018 by */
|
||||
/* Werner Lemberg and Detlef Würkner. */
|
||||
/* */
|
||||
/* This file is part of the FreeType project, and may only be used, */
|
||||
|
@ -4,7 +4,7 @@
|
||||
/* */
|
||||
/* Amiga-specific FreeType module selection. */
|
||||
/* */
|
||||
/* Copyright 2005-2017 by */
|
||||
/* Copyright 2005-2018 by */
|
||||
/* Werner Lemberg and Detlef Würkner. */
|
||||
/* */
|
||||
/* This file is part of the FreeType project, and may only be used, */
|
||||
|
@ -5,7 +5,7 @@
|
||||
#
|
||||
|
||||
|
||||
# Copyright 2005-2017 by
|
||||
# Copyright 2005-2018 by
|
||||
# Werner Lemberg and Detlef Würkner.
|
||||
#
|
||||
# This file is part of the FreeType project, and may only be used, modified,
|
||||
|
@ -4,7 +4,7 @@
|
||||
#
|
||||
|
||||
|
||||
# Copyright 2005-2017 by
|
||||
# Copyright 2005-2018 by
|
||||
# Werner Lemberg and Detlef Würkner.
|
||||
#
|
||||
# This file is part of the FreeType project, and may only be used, modified,
|
||||
|
@ -3,7 +3,7 @@
|
||||
#
|
||||
|
||||
|
||||
# Copyright 2005-2017 by
|
||||
# Copyright 2005-2018 by
|
||||
# Werner Lemberg and Detlef Würkner.
|
||||
#
|
||||
# This file is part of the FreeType project, and may only be used, modified,
|
||||
|
@ -4,7 +4,7 @@
|
||||
/* */
|
||||
/* Debugging and logging component for amiga (body). */
|
||||
/* */
|
||||
/* Copyright 1996-2017 by */
|
||||
/* Copyright 1996-2018 by */
|
||||
/* David Turner, Robert Wilhelm, Werner Lemberg and Detlef Würkner. */
|
||||
/* */
|
||||
/* This file is part of the FreeType project, and may only be used, */
|
||||
|
@ -4,7 +4,7 @@
|
||||
/* */
|
||||
/* Amiga-specific FreeType low-level system interface (body). */
|
||||
/* */
|
||||
/* Copyright 1996-2017 by */
|
||||
/* Copyright 1996-2018 by */
|
||||
/* David Turner, Robert Wilhelm, Werner Lemberg and Detlef Würkner. */
|
||||
/* */
|
||||
/* This file is part of the FreeType project, and may only be used, */
|
||||
|
@ -3,7 +3,7 @@
|
||||
#
|
||||
|
||||
|
||||
# Copyright 1996-2017 by
|
||||
# Copyright 1996-2018 by
|
||||
# David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
#
|
||||
# This file is part of the FreeType project, and may only be used, modified,
|
||||
|
@ -3,7 +3,7 @@
|
||||
#
|
||||
|
||||
|
||||
# Copyright 1996-2017 by
|
||||
# Copyright 1996-2018 by
|
||||
# David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
#
|
||||
# This file is part of the FreeType project, and may only be used, modified,
|
||||
|
@ -5,7 +5,7 @@
|
||||
#
|
||||
|
||||
|
||||
# Copyright 1996-2017 by
|
||||
# Copyright 1996-2018 by
|
||||
# David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
#
|
||||
# This file is part of the FreeType project, and may only be used, modified,
|
||||
|
@ -2,7 +2,7 @@
|
||||
# FreeType 2 configuration rules for a BeOS system
|
||||
#
|
||||
|
||||
# Copyright 1996-2017 by
|
||||
# Copyright 1996-2018 by
|
||||
# David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
#
|
||||
# This file is part of the FreeType project, and may only be used, modified,
|
||||
|
@ -3,7 +3,7 @@
|
||||
#
|
||||
|
||||
|
||||
# Copyright 1996-2017 by
|
||||
# Copyright 1996-2018 by
|
||||
# David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
#
|
||||
# This file is part of the FreeType project, and may only be used, modified,
|
||||
|
@ -1,6 +1,6 @@
|
||||
# iOS.cmake
|
||||
#
|
||||
# Copyright 2014-2017 by
|
||||
# Copyright 2014-2018 by
|
||||
# David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
#
|
||||
# Written by David Wimsey <david@wimsey.us>
|
||||
|
@ -1,6 +1,6 @@
|
||||
#!/bin/sh -e
|
||||
|
||||
# Copyright 2015-2017 by
|
||||
# Copyright 2015-2018 by
|
||||
# David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
#
|
||||
# This file is part of the FreeType project, and may only be used, modified,
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user