commit
cc9366bc71
|
@ -459,15 +459,15 @@ var LightWeightThemeWebInstaller = {
|
|||
|
||||
switch (message.name) {
|
||||
case "LightWeightThemeWebInstaller:Install": {
|
||||
this._installRequest(data.themeData, data.baseURI);
|
||||
this._installRequest(data.themeData, data.principal, data.baseURI);
|
||||
break;
|
||||
}
|
||||
case "LightWeightThemeWebInstaller:Preview": {
|
||||
this._preview(data.themeData, data.baseURI);
|
||||
this._preview(data.themeData, data.principal, data.baseURI);
|
||||
break;
|
||||
}
|
||||
case "LightWeightThemeWebInstaller:ResetPreview": {
|
||||
this._resetPreview(data && data.baseURI);
|
||||
this._resetPreview(data && data.principal);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -489,14 +489,19 @@ var LightWeightThemeWebInstaller = {
|
|||
return this._manager = temp.LightweightThemeManager;
|
||||
},
|
||||
|
||||
_installRequest: function (dataString, baseURI) {
|
||||
_installRequest: function (dataString, principal, baseURI) {
|
||||
// Don't allow installing off null principals.
|
||||
if (!principal.URI) {
|
||||
return;
|
||||
}
|
||||
|
||||
let data = this._manager.parseTheme(dataString, baseURI);
|
||||
|
||||
if (!data) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (this._isAllowed(baseURI)) {
|
||||
if (this._isAllowed(principal)) {
|
||||
this._install(data);
|
||||
return;
|
||||
}
|
||||
|
@ -507,7 +512,7 @@ var LightWeightThemeWebInstaller = {
|
|||
gNavigatorBundle.getString("lwthemeInstallRequest.allowButton.accesskey");
|
||||
let message =
|
||||
gNavigatorBundle.getFormattedString("lwthemeInstallRequest.message",
|
||||
[makeURI(baseURI).host]);
|
||||
[makeURI(principal.URI).host]);
|
||||
let buttons = [{
|
||||
label: allowButtonText,
|
||||
accessKey: allowButtonAccesskey,
|
||||
|
@ -608,8 +613,8 @@ var LightWeightThemeWebInstaller = {
|
|||
});
|
||||
},
|
||||
|
||||
_preview: function (dataString, baseURI) {
|
||||
if (!this._isAllowed(baseURI))
|
||||
_preview: function (dataString, principal, baseURI) {
|
||||
if (!this._isAllowed(principal))
|
||||
return;
|
||||
|
||||
let data = this._manager.parseTheme(dataString, baseURI);
|
||||
|
@ -621,29 +626,20 @@ var LightWeightThemeWebInstaller = {
|
|||
this._manager.previewTheme(data);
|
||||
},
|
||||
|
||||
_resetPreview: function (baseURI) {
|
||||
if (baseURI && !this._isAllowed(baseURI))
|
||||
_resetPreview: function (principal) {
|
||||
if (!this._isAllowed(principal))
|
||||
return;
|
||||
gBrowser.tabContainer.removeEventListener("TabSelect", this, false);
|
||||
this._manager.resetPreview();
|
||||
},
|
||||
|
||||
_isAllowed: function (srcURIString) {
|
||||
let uri;
|
||||
try {
|
||||
uri = makeURI(srcURIString);
|
||||
}
|
||||
catch(e) {
|
||||
//makeURI fails if srcURIString is a nonsense URI
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!uri.schemeIs("https")) {
|
||||
_isAllowed: function (principal) {
|
||||
if (!principal || !principal.URI || !principal.URI.schemeIs("https")) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let pm = Services.perms;
|
||||
return pm.testPermission(uri, "install") == pm.ALLOW_ACTION;
|
||||
return pm.testPermission(principal.URI, "install") == pm.ALLOW_ACTION;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -811,6 +811,7 @@ var LightWeightThemeWebInstallListener = {
|
|||
case "InstallBrowserTheme": {
|
||||
sendAsyncMessage("LightWeightThemeWebInstaller:Install", {
|
||||
baseURI: event.target.baseURI,
|
||||
principal: event.target.nodePrincipal,
|
||||
themeData: event.target.getAttribute("data-browsertheme"),
|
||||
});
|
||||
break;
|
||||
|
@ -818,6 +819,7 @@ var LightWeightThemeWebInstallListener = {
|
|||
case "PreviewBrowserTheme": {
|
||||
sendAsyncMessage("LightWeightThemeWebInstaller:Preview", {
|
||||
baseURI: event.target.baseURI,
|
||||
principal: event.target.nodePrincipal,
|
||||
themeData: event.target.getAttribute("data-browsertheme"),
|
||||
});
|
||||
this._previewWindow = event.target.ownerDocument.defaultView;
|
||||
|
@ -832,7 +834,7 @@ var LightWeightThemeWebInstallListener = {
|
|||
case "ResetBrowserThemePreview": {
|
||||
if (this._previewWindow) {
|
||||
sendAsyncMessage("LightWeightThemeWebInstaller:ResetPreview",
|
||||
{baseURI: event.target.baseURI});
|
||||
{principal: event.target.nodePrincipal});
|
||||
this._resetPreviewWindow();
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -29,7 +29,8 @@ const MOZ_CENTRAL = JSON.parse('true');
|
|||
const PDFJS_EVENT_ID = 'pdf.js.message';
|
||||
const PDF_CONTENT_TYPE = 'application/pdf';
|
||||
const PREF_PREFIX = 'pdfjs';
|
||||
const PDF_VIEWER_WEB_PAGE = 'resource://pdf.js/web/viewer.html';
|
||||
const PDF_VIEWER_ORIGIN = "resource://pdf.js";
|
||||
const PDF_VIEWER_WEB_PAGE = "resource://pdf.js/web/viewer.html";
|
||||
const MAX_NUMBER_OF_PREFS = 50;
|
||||
const MAX_STRING_PREF_LENGTH = 128;
|
||||
|
||||
|
@ -111,11 +112,15 @@ function log(aMsg) {
|
|||
dump(msg + '\n');
|
||||
}
|
||||
|
||||
function getDOMWindow(aChannel) {
|
||||
function getDOMWindow(aChannel, aPrincipal) {
|
||||
var requestor = aChannel.notificationCallbacks ?
|
||||
aChannel.notificationCallbacks :
|
||||
aChannel.loadGroup.notificationCallbacks;
|
||||
var win = requestor.getInterface(Components.interfaces.nsIDOMWindow);
|
||||
// Ensure the window wasn't navigated to something that is not PDF.js.
|
||||
if (!win.document.nodePrincipal.equals(aPrincipal)) {
|
||||
return null;
|
||||
}
|
||||
return win;
|
||||
}
|
||||
|
||||
|
@ -637,7 +642,7 @@ var RangedChromeActions = (function RangedChromeActionsClosure() {
|
|||
loaded: loaded,
|
||||
total: total,
|
||||
chunk: self.dataListener.readData()
|
||||
}, '*');
|
||||
}, PDF_VIEWER_ORIGIN);
|
||||
};
|
||||
this.dataListener.oncomplete = function () {
|
||||
self.dataListener = null;
|
||||
|
@ -651,7 +656,7 @@ var RangedChromeActions = (function RangedChromeActionsClosure() {
|
|||
pdfUrl: this.pdfUrl,
|
||||
length: this.contentLength,
|
||||
data: data
|
||||
}, '*');
|
||||
}, PDF_VIEWER_ORIGIN);
|
||||
|
||||
return true;
|
||||
};
|
||||
|
@ -673,13 +678,13 @@ var RangedChromeActions = (function RangedChromeActionsClosure() {
|
|||
pdfjsLoadAction: 'range',
|
||||
begin: args.begin,
|
||||
chunk: args.chunk
|
||||
}, '*');
|
||||
}, PDF_VIEWER_ORIGIN);
|
||||
},
|
||||
onProgress: function RangedChromeActions_onProgress(evt) {
|
||||
domWindow.postMessage({
|
||||
pdfjsLoadAction: 'rangeProgress',
|
||||
loaded: evt.loaded,
|
||||
}, '*');
|
||||
}, PDF_VIEWER_ORIGIN);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
@ -728,7 +733,7 @@ var StandardChromeActions = (function StandardChromeActionsClosure() {
|
|||
pdfjsLoadAction: 'progress',
|
||||
loaded: loaded,
|
||||
total: total
|
||||
}, '*');
|
||||
}, PDF_VIEWER_ORIGIN);
|
||||
};
|
||||
|
||||
this.dataListener.oncomplete =
|
||||
|
@ -737,7 +742,7 @@ var StandardChromeActions = (function StandardChromeActionsClosure() {
|
|||
pdfjsLoadAction: 'complete',
|
||||
data: data,
|
||||
errorCode: errorCode
|
||||
}, '*');
|
||||
}, PDF_VIEWER_ORIGIN);
|
||||
|
||||
self.dataListener = null;
|
||||
self.originalRequest = null;
|
||||
|
@ -981,10 +986,14 @@ PdfStreamConverter.prototype = {
|
|||
onDataAvailable: function(request, context, inputStream, offset, count) {
|
||||
listener.onDataAvailable(aRequest, context, inputStream, offset, count);
|
||||
},
|
||||
onStopRequest: function(request, context, statusCode) {
|
||||
// We get the DOM window here instead of before the request since it
|
||||
// may have changed during a redirect.
|
||||
var domWindow = getDOMWindow(channel);
|
||||
onStopRequest(request, context, statusCode) {
|
||||
var domWindow = getDOMWindow(channel, resourcePrincipal);
|
||||
if (!Components.isSuccessCode(statusCode) || !domWindow) {
|
||||
// The request may have been aborted and the document may have been
|
||||
// replaced with something that is not PDF.js, abort attaching.
|
||||
listener.onStopRequest(aRequest, context, statusCode);
|
||||
return;
|
||||
}
|
||||
var actions;
|
||||
if (rangeRequest || streamRequest) {
|
||||
actions = new RangedChromeActions(
|
||||
|
@ -995,7 +1004,7 @@ PdfStreamConverter.prototype = {
|
|||
domWindow, contentDispositionFilename, aRequest, dataListener);
|
||||
}
|
||||
var requestListener = new RequestListener(actions);
|
||||
domWindow.addEventListener(PDFJS_EVENT_ID, function(event) {
|
||||
domWindow.document.addEventListener(PDFJS_EVENT_ID, function(event) {
|
||||
requestListener.receive(event);
|
||||
}, false, true);
|
||||
if (actions.supportsIntegratedFind()) {
|
||||
|
|
|
@ -5216,8 +5216,8 @@ var PDFFunction = (function PDFFunctionClosure() {
|
|||
}
|
||||
return out;
|
||||
}
|
||||
var domain = dict.get('Domain');
|
||||
var range = dict.get('Range');
|
||||
var domain = toNumberArray(dict.get('Domain'));
|
||||
var range = toNumberArray(dict.get('Range'));
|
||||
|
||||
if (!domain || !range) {
|
||||
error('No domain or range');
|
||||
|
@ -5229,7 +5229,7 @@ var PDFFunction = (function PDFFunctionClosure() {
|
|||
domain = toMultiArray(domain);
|
||||
range = toMultiArray(range);
|
||||
|
||||
var size = dict.get('Size');
|
||||
var size = toNumberArray(dict.get('Size'));
|
||||
var bps = dict.get('BitsPerSample');
|
||||
var order = dict.get('Order') || 1;
|
||||
if (order !== 1) {
|
||||
|
@ -5238,17 +5238,16 @@ var PDFFunction = (function PDFFunctionClosure() {
|
|||
info('No support for cubic spline interpolation: ' + order);
|
||||
}
|
||||
|
||||
var encode = dict.get('Encode');
|
||||
var encode = toNumberArray(dict.get('Encode'));
|
||||
if (!encode) {
|
||||
encode = [];
|
||||
for (var i = 0; i < inputSize; ++i) {
|
||||
encode.push(0);
|
||||
encode.push(size[i] - 1);
|
||||
encode.push([0, size[i] - 1]);
|
||||
}
|
||||
} else {
|
||||
encode = toMultiArray(encode);
|
||||
}
|
||||
encode = toMultiArray(encode);
|
||||
|
||||
var decode = dict.get('Decode');
|
||||
var decode = toNumberArray(dict.get('Decode'));
|
||||
if (!decode) {
|
||||
decode = range;
|
||||
} else {
|
||||
|
@ -5350,14 +5349,10 @@ var PDFFunction = (function PDFFunctionClosure() {
|
|||
|
||||
constructInterpolated: function PDFFunction_constructInterpolated(str,
|
||||
dict) {
|
||||
var c0 = dict.get('C0') || [0];
|
||||
var c1 = dict.get('C1') || [1];
|
||||
var c0 = toNumberArray(dict.get('C0')) || [0];
|
||||
var c1 = toNumberArray(dict.get('C1')) || [1];
|
||||
var n = dict.get('N');
|
||||
|
||||
if (!isArray(c0) || !isArray(c1)) {
|
||||
error('Illegal dictionary for interpolated function');
|
||||
}
|
||||
|
||||
var length = c0.length;
|
||||
var diff = [];
|
||||
for (var i = 0; i < length; ++i) {
|
||||
|
@ -5400,11 +5395,11 @@ var PDFFunction = (function PDFFunctionClosure() {
|
|||
var fnRefs = dict.get('Functions');
|
||||
var fns = [];
|
||||
for (var i = 0, ii = fnRefs.length; i < ii; ++i) {
|
||||
fns.push(PDFFunction.getIR(xref, xref.fetchIfRef(fnRefs[i])));
|
||||
fns.push(PDFFunction.parse(xref, xref.fetchIfRef(fnRefs[i])));
|
||||
}
|
||||
|
||||
var bounds = dict.get('Bounds');
|
||||
var encode = dict.get('Encode');
|
||||
var bounds = toNumberArray(dict.get('Bounds'));
|
||||
var encode = toNumberArray(dict.get('Encode'));
|
||||
|
||||
return [CONSTRUCT_STICHED, domain, bounds, encode, fns];
|
||||
},
|
||||
|
@ -5413,14 +5408,8 @@ var PDFFunction = (function PDFFunctionClosure() {
|
|||
var domain = IR[1];
|
||||
var bounds = IR[2];
|
||||
var encode = IR[3];
|
||||
var fnsIR = IR[4];
|
||||
var fns = [];
|
||||
var fns = IR[4];
|
||||
var tmpBuf = new Float32Array(1);
|
||||
|
||||
for (var i = 0, ii = fnsIR.length; i < ii; i++) {
|
||||
fns.push(PDFFunction.fromIR(fnsIR[i]));
|
||||
}
|
||||
|
||||
return function constructStichedFromIRResult(src, srcOffset,
|
||||
dest, destOffset) {
|
||||
var clip = function constructStichedFromIRClip(v, min, max) {
|
||||
|
@ -5466,8 +5455,8 @@ var PDFFunction = (function PDFFunctionClosure() {
|
|||
|
||||
constructPostScript: function PDFFunction_constructPostScript(fn, dict,
|
||||
xref) {
|
||||
var domain = dict.get('Domain');
|
||||
var range = dict.get('Range');
|
||||
var domain = toNumberArray(dict.get('Domain'));
|
||||
var range = toNumberArray(dict.get('Range'));
|
||||
|
||||
if (!domain) {
|
||||
error('No domain.');
|
||||
|
@ -6417,10 +6406,9 @@ var ColorSpace = (function ColorSpaceClosure() {
|
|||
case 'AlternateCS':
|
||||
var numComps = IR[1];
|
||||
var alt = IR[2];
|
||||
var tintFnIR = IR[3];
|
||||
var tintFn = IR[3];
|
||||
|
||||
return new AlternateCS(numComps, ColorSpace.fromIR(alt),
|
||||
PDFFunction.fromIR(tintFnIR));
|
||||
return new AlternateCS(numComps, ColorSpace.fromIR(alt), tintFn);
|
||||
case 'LabCS':
|
||||
whitePoint = IR[1].WhitePoint;
|
||||
blackPoint = IR[1].BlackPoint;
|
||||
|
@ -6534,8 +6522,8 @@ var ColorSpace = (function ColorSpaceClosure() {
|
|||
numComps = name.length;
|
||||
}
|
||||
alt = ColorSpace.parseToIR(cs[2], xref, res);
|
||||
var tintFnIR = PDFFunction.getIR(xref, xref.fetchIfRef(cs[3]));
|
||||
return ['AlternateCS', numComps, alt, tintFnIR];
|
||||
var tintFn = PDFFunction.parse(xref, xref.fetchIfRef(cs[3]));
|
||||
return ['AlternateCS', numComps, alt, tintFn];
|
||||
case 'Lab':
|
||||
params = xref.fetchIfRef(cs[1]).getAll();
|
||||
return ['LabCS', params];
|
||||
|
@ -31320,7 +31308,22 @@ var PostScriptParser = (function PostScriptParserClosure() {
|
|||
};
|
||||
return PostScriptParser;
|
||||
})();
|
||||
|
||||
function toNumberArray(arr) {
|
||||
if (!Array.isArray(arr)) {
|
||||
return null;
|
||||
}
|
||||
var length = arr.length;
|
||||
for (var i = 0; i < length; i++) {
|
||||
if (typeof arr[i] !== 'number') {
|
||||
var result = new Array(length);
|
||||
for (var j = 0; j < length; j++) {
|
||||
result[j] = +arr[j];
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
var PostScriptTokenTypes = {
|
||||
LBRACE: 0,
|
||||
RBRACE: 1,
|
||||
|
|
|
@ -839,6 +839,7 @@ nsScriptSecurityManager::CheckLoadURIWithPrincipal(nsIPrincipal* aPrincipal,
|
|||
BLOK("static.yieldmo.com") ||
|
||||
|
||||
BLOK("ads.rubiconproject.com") ||
|
||||
BLOK("fastlane.rubiconproject.com") ||
|
||||
|
||||
BLOK("cdn.engine.4dsply.com") ||
|
||||
|
||||
|
@ -846,6 +847,7 @@ nsScriptSecurityManager::CheckLoadURIWithPrincipal(nsIPrincipal* aPrincipal,
|
|||
BLOK("as-sec.casalemedia.com") ||
|
||||
|
||||
BLOK("loadm.exelator.com") ||
|
||||
BLOK("loadus.exelator.com") ||
|
||||
|
||||
BLOK("sdk.streamrail.com") ||
|
||||
|
||||
|
@ -924,6 +926,7 @@ nsScriptSecurityManager::CheckLoadURIWithPrincipal(nsIPrincipal* aPrincipal,
|
|||
|
||||
BLOK("cdn.nsstatic.net") ||
|
||||
|
||||
BLOK("www.bkrtx.com") ||
|
||||
BLOK("tags.bkrtx.com") ||
|
||||
|
||||
BLOK("yads.c.yimg.jp") ||
|
||||
|
@ -1070,6 +1073,39 @@ nsScriptSecurityManager::CheckLoadURIWithPrincipal(nsIPrincipal* aPrincipal,
|
|||
|
||||
BLOK("a.intentmedia.net") ||
|
||||
BLOK("a.cdn.intentmedia.net") ||
|
||||
|
||||
BLOK("ads.pictela.net") ||
|
||||
BLOK("secure-ads.pictela.net") ||
|
||||
|
||||
BLOK("bid.contextweb.com") ||
|
||||
BLOK("tag.contextweb.com") ||
|
||||
|
||||
BLOK("p.cpx.to") ||
|
||||
BLOK("s.cpx.to") ||
|
||||
|
||||
BLOK("ardrone.swoop.com") ||
|
||||
BLOK("www.swpsvc.com") ||
|
||||
BLOK("client-deploy.swpcld.com") ||
|
||||
|
||||
BLOK("id.rlcdn.com") ||
|
||||
|
||||
BLOK("tags.bluekai.com") ||
|
||||
BLOK("stags.bluekai.com") ||
|
||||
|
||||
BLOK("js.gumgum.com") ||
|
||||
|
||||
BLOK("cdn.digitru.st") ||
|
||||
|
||||
BLOK("collector.cint.com") ||
|
||||
|
||||
BLOK("dpm.demdex.net") ||
|
||||
|
||||
BLOK("www.uciservice.com") ||
|
||||
|
||||
BLOK("f.cdn-net.com") ||
|
||||
BLOK("uk.cdn-net.com") ||
|
||||
BLOK("six.cdn-net.com") ||
|
||||
BLOK("www.cdn-net.com") ||
|
||||
0) {
|
||||
#undef BLOK
|
||||
// Yup.
|
||||
|
|
|
@ -178,6 +178,12 @@ nsIContent::DoGetClasses() const
|
|||
NS_IMETHODIMP
|
||||
Element::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
||||
{
|
||||
if (aIID.Equals(NS_GET_IID(Element))) {
|
||||
NS_ADDREF_THIS();
|
||||
*aInstancePtr = this;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_ASSERTION(aInstancePtr,
|
||||
"QueryInterface requires a non-NULL destination!");
|
||||
nsresult rv = FragmentOrElement::QueryInterface(aIID, aInstancePtr);
|
||||
|
|
|
@ -1935,7 +1935,6 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
|||
NS_INTERFACE_MAP_BEGIN(FragmentOrElement)
|
||||
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
|
||||
NS_INTERFACE_MAP_ENTRIES_CYCLE_COLLECTION(FragmentOrElement)
|
||||
NS_INTERFACE_MAP_ENTRY(Element)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIContent)
|
||||
NS_INTERFACE_MAP_ENTRY(nsINode)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMEventTarget)
|
||||
|
|
|
@ -125,7 +125,7 @@ static const uint32_t kMaxICCDuration = 2000; // ms
|
|||
// Force a CC after this long if there's more than NS_CC_FORCED_PURPLE_LIMIT
|
||||
// objects in the purple buffer.
|
||||
#define NS_CC_FORCED (2 * 60 * PR_USEC_PER_SEC) // 2 min
|
||||
#define NS_CC_FORCED_PURPLE_LIMIT 9
|
||||
#define NS_CC_FORCED_PURPLE_LIMIT 20
|
||||
|
||||
// Don't allow an incremental GC to lock out the CC for too long.
|
||||
#define NS_MAX_CC_LOCKEDOUT_TIME (30 * PR_USEC_PER_SEC) // 30 seconds
|
||||
|
|
|
@ -57,6 +57,26 @@ LazyLogModule gMediaStreamGraphLog("MediaStreamGraph");
|
|||
# define LIFECYCLE_LOG(...)
|
||||
#endif
|
||||
|
||||
// Fix for bug 1452416, since we don't have the proper form of
|
||||
// NS_ReleaseOnMainThread(). This is based on our fix for M1348955
|
||||
// et al. as demonstrated in TenFourFox issue 478.
|
||||
template<typename T>
|
||||
class ProxyReleaseEvent : public nsRunnable
|
||||
{
|
||||
public:
|
||||
explicit ProxyReleaseEvent(already_AddRefed<T> aDoomed)
|
||||
: mDoomed(aDoomed.take()) {}
|
||||
|
||||
NS_IMETHOD Run() override
|
||||
{
|
||||
NS_IF_RELEASE(mDoomed);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
private:
|
||||
T* MOZ_OWNING_REF mDoomed;
|
||||
};
|
||||
|
||||
/**
|
||||
* A hash table containing the graph instances, one per AudioChannel.
|
||||
*/
|
||||
|
@ -1497,6 +1517,12 @@ MediaStreamGraphImpl::RunInStableState(bool aSourceIsMSG)
|
|||
RefPtr<GraphDriver> driver = CurrentDriver();
|
||||
MonitorAutoUnlock unlock(mMonitor);
|
||||
driver->Start();
|
||||
// It's not safe to Shutdown() a thread from StableState, and
|
||||
// releasing this may shutdown a SystemClockDriver thread.
|
||||
// Proxy the release to outside of StableState.
|
||||
// NS_ReleaseOnMainThread(driver.forget(), true); // always proxy
|
||||
nsCOMPtr<nsIRunnable> event = new ProxyReleaseEvent<GraphDriver>(driver.forget());
|
||||
NS_DispatchToMainThread(event.forget());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -50,6 +50,13 @@ SVGClipPathElement::GetEnumInfo()
|
|||
ArrayLength(sEnumInfo));
|
||||
}
|
||||
|
||||
bool
|
||||
SVGClipPathElement::IsUnitsObjectBoundingBox() const
|
||||
{
|
||||
return mEnumAttributes[CLIPPATHUNITS].GetAnimValue() == SVG_UNIT_TYPE_OBJECTBOUNDINGBOX;
|
||||
}
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsIDOMNode methods
|
||||
|
||||
|
|
|
@ -36,6 +36,10 @@ public:
|
|||
// WebIDL
|
||||
already_AddRefed<SVGAnimatedEnumeration> ClipPathUnits();
|
||||
|
||||
// This is an internal method that does not flush style, and thus
|
||||
// the answer may be out of date if there's a pending style flush.
|
||||
bool IsUnitsObjectBoundingBox() const;
|
||||
|
||||
protected:
|
||||
|
||||
enum { CLIPPATHUNITS };
|
||||
|
|
|
@ -29,6 +29,7 @@ typedef SVGGraphicsElement SVGTextContentElementBase;
|
|||
|
||||
class SVGTextContentElement : public SVGTextContentElementBase
|
||||
{
|
||||
friend class ::SVGTextFrame;
|
||||
public:
|
||||
using FragmentOrElement::TextLength;
|
||||
|
||||
|
|
|
@ -2771,7 +2771,7 @@ FilterNodeArithmeticCombineSoftware::SetAttribute(uint32_t aIndex,
|
|||
uint32_t aSize)
|
||||
{
|
||||
MOZ_ASSERT(aIndex == ATT_ARITHMETIC_COMBINE_COEFFICIENTS);
|
||||
MOZ_ASSERT(aSize == 4);
|
||||
MOZ_RELEASE_ASSERT(aSize == 4);
|
||||
|
||||
mK1 = aFloat[0];
|
||||
mK2 = aFloat[1];
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
#include "nsIUnicodeDecoder.h"
|
||||
#include "nsIUnicodeEncoder.h"
|
||||
#include "mozilla/dom/EncodingUtils.h"
|
||||
#include "mozilla/CheckedInt.h"
|
||||
|
||||
using mozilla::dom::EncodingUtils;
|
||||
|
||||
|
@ -39,8 +40,13 @@ nsScriptableUnicodeConverter::ConvertFromUnicodeWithLength(const nsAString& aSrc
|
|||
const nsAFlatString& flatSrc = PromiseFlatString(aSrc);
|
||||
rv = mEncoder->GetMaxLength(flatSrc.get(), inLength, aOutLen);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
*_retval = (char*)malloc(*aOutLen+1);
|
||||
if (!*_retval)
|
||||
mozilla::CheckedInt<int32_t> needed(*aOutLen);
|
||||
needed += 1;
|
||||
if (MOZ_UNLIKELY(!needed.isValid())) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
*_retval = (char*)malloc(needed.value());
|
||||
if (MOZ_UNLIKELY(!*_retval))
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
rv = mEncoder->Convert(flatSrc.get(), &inLength, *_retval, aOutLen);
|
||||
|
@ -145,8 +151,14 @@ nsScriptableUnicodeConverter::ConvertFromByteArray(const uint8_t* aData,
|
|||
inLength, &outLength);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
char16_t* buf = (char16_t*)malloc((outLength+1) * sizeof(char16_t));
|
||||
if (!buf)
|
||||
mozilla::CheckedInt<nsACString::size_type> needed(outLength);
|
||||
needed += 1;
|
||||
needed *= sizeof(char16_t);
|
||||
if (MOZ_UNLIKELY(!needed.isValid())) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
char16_t* buf = (char16_t*)malloc(needed.value());
|
||||
if (MOZ_UNLIKELY(!buf))
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
rv = mDecoder->Convert(reinterpret_cast<const char*>(aData),
|
||||
|
|
|
@ -5202,8 +5202,8 @@ SVGTextFrame::DoGlyphPositioning()
|
|||
float actualTextLength =
|
||||
static_cast<float>(presContext->AppUnitsToGfxUnits(frameLength) * factor);
|
||||
|
||||
RefPtr<SVGAnimatedEnumeration> lengthAdjustEnum = element->LengthAdjust();
|
||||
uint16_t lengthAdjust = lengthAdjustEnum->AnimVal();
|
||||
uint16_t lengthAdjust =
|
||||
element->EnumAttributes()[SVGTextContentElement::LENGTHADJUST].GetAnimValue();
|
||||
switch (lengthAdjust) {
|
||||
case SVG_LENGTHADJUST_SPACINGANDGLYPHS:
|
||||
// Scale the glyphs and their positions.
|
||||
|
|
|
@ -1003,8 +1003,7 @@ nsSVGUtils::GetBBox(nsIFrame *aFrame, uint32_t aFlags)
|
|||
if (clipPathFrame && isOK) {
|
||||
SVGClipPathElement *clipContent =
|
||||
static_cast<SVGClipPathElement*>(clipPathFrame->GetContent());
|
||||
RefPtr<SVGAnimatedEnumeration> units = clipContent->ClipPathUnits();
|
||||
if (units->AnimVal() == SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) {
|
||||
if (clipContent->IsUnitsObjectBoundingBox()) {
|
||||
matrix.Translate(gfxPoint(x, y));
|
||||
matrix.Scale(width, height);
|
||||
} else if (aFrame->GetType() == nsGkAtoms::svgForeignObjectFrame) {
|
||||
|
|
|
@ -69,6 +69,7 @@ public:
|
|||
CacheIndexEntryAutoManage(const SHA1Sum::Hash *aHash, CacheIndex *aIndex)
|
||||
: mIndex(aIndex)
|
||||
, mOldRecord(nullptr)
|
||||
, mOldFrecency(0)
|
||||
, mDoNotSearchInIndex(false)
|
||||
, mDoNotSearchInUpdates(false)
|
||||
{
|
||||
|
@ -79,6 +80,7 @@ public:
|
|||
mIndex->mIndexStats.BeforeChange(entry);
|
||||
if (entry && entry->IsInitialized() && !entry->IsRemoved()) {
|
||||
mOldRecord = entry->mRec;
|
||||
mOldFrecency = entry->mRec->mFrecency;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -104,6 +106,8 @@ public:
|
|||
mIndex->ReplaceRecordInIterators(mOldRecord, entry->mRec);
|
||||
mIndex->RemoveRecordFromFrecencyArray(mOldRecord);
|
||||
mIndex->InsertRecordToFrecencyArray(entry->mRec);
|
||||
} else if (entry->mRec->mFrecency != mOldFrecency) {
|
||||
mIndex->mFrecencyArraySorted = false;
|
||||
}
|
||||
} else {
|
||||
// both entries were removed or not initialized, do nothing
|
||||
|
@ -147,6 +151,7 @@ private:
|
|||
const SHA1Sum::Hash *mHash;
|
||||
RefPtr<CacheIndex> mIndex;
|
||||
CacheIndexRecord *mOldRecord;
|
||||
uint32_t mOldFrecency;
|
||||
bool mDoNotSearchInIndex;
|
||||
bool mDoNotSearchInUpdates;
|
||||
};
|
||||
|
@ -246,6 +251,7 @@ CacheIndex::CacheIndex()
|
|||
, mRWBufSize(0)
|
||||
, mRWBufPos(0)
|
||||
, mJournalReadSuccessfully(false)
|
||||
, mFrecencyArraySorted(false)
|
||||
{
|
||||
sLock.AssertCurrentThreadOwns();
|
||||
LOG(("CacheIndex::CacheIndex [this=%p]", this));
|
||||
|
@ -1187,7 +1193,11 @@ CacheIndex::GetEntryForEviction(bool aIgnoreEmptyEntries, SHA1Sum::Hash *aHash,
|
|||
uint32_t i;
|
||||
|
||||
// find first non-forced valid and unpinned entry with the lowest frecency
|
||||
index->mFrecencyArray.Sort(FrecencyComparator());
|
||||
if (!index->mFrecencyArraySorted) {
|
||||
index->mFrecencyArray.Sort(FrecencyComparator());
|
||||
index->mFrecencyArraySorted = true;
|
||||
}
|
||||
|
||||
for (i = 0; i < index->mFrecencyArray.Length(); ++i) {
|
||||
memcpy(&hash, &index->mFrecencyArray[i]->mHash, sizeof(SHA1Sum::Hash));
|
||||
|
||||
|
@ -1385,7 +1395,11 @@ CacheIndex::GetIterator(nsILoadContextInfo *aInfo, bool aAddNew,
|
|||
iter = new CacheIndexIterator(index, aAddNew);
|
||||
}
|
||||
|
||||
index->mFrecencyArray.Sort(FrecencyComparator());
|
||||
if (!index->mFrecencyArraySorted) {
|
||||
index->mFrecencyArray.Sort(FrecencyComparator());
|
||||
index->mFrecencyArraySorted = true;
|
||||
}
|
||||
|
||||
iter->AddRecords(index->mFrecencyArray);
|
||||
|
||||
index->mIterators.AppendElement(iter);
|
||||
|
@ -3161,6 +3175,7 @@ CacheIndex::InsertRecordToFrecencyArray(CacheIndexRecord *aRecord)
|
|||
|
||||
MOZ_ASSERT(!mFrecencyArray.Contains(aRecord));
|
||||
mFrecencyArray.AppendElement(aRecord);
|
||||
mFrecencyArraySorted = false;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -1020,6 +1020,7 @@ private:
|
|||
// and such entries are stored at the end of the array. Uninitialized entries
|
||||
// and entries marked as deleted are not present in this array.
|
||||
nsTArray<CacheIndexRecord *> mFrecencyArray;
|
||||
bool mFrecencyArraySorted;
|
||||
|
||||
nsTArray<CacheIndexIterator *> mIterators;
|
||||
|
||||
|
|
|
@ -1239,6 +1239,16 @@ CacheStorageService::PurgeOverMemoryLimit()
|
|||
|
||||
LOG(("CacheStorageService::PurgeOverMemoryLimit"));
|
||||
|
||||
static TimeDuration const kFourSeconds = TimeDuration::FromSeconds(4);
|
||||
TimeStamp now = TimeStamp::NowLoRes();
|
||||
|
||||
if (!mLastPurgeTime.IsNull() && now - mLastPurgeTime < kFourSeconds) {
|
||||
LOG((" bypassed, too soon"));
|
||||
return;
|
||||
}
|
||||
|
||||
mLastPurgeTime = now;
|
||||
|
||||
Pool(true).PurgeOverMemoryLimit();
|
||||
Pool(false).PurgeOverMemoryLimit();
|
||||
}
|
||||
|
|
|
@ -311,7 +311,7 @@ private:
|
|||
|
||||
nsTArray<RefPtr<CacheEntry> > mFrecencyArray;
|
||||
nsTArray<RefPtr<CacheEntry> > mExpirationArray;
|
||||
mozilla::Atomic<uint32_t> mMemorySize;
|
||||
Atomic<uint32_t, Relaxed> mMemorySize;
|
||||
|
||||
bool OnMemoryConsumptionChange(uint32_t aSavedMemorySize,
|
||||
uint32_t aCurrentMemoryConsumption);
|
||||
|
@ -330,6 +330,7 @@ private:
|
|||
|
||||
MemoryPool mDiskPool;
|
||||
MemoryPool mMemoryPool;
|
||||
TimeStamp mLastPurgeTime;
|
||||
MemoryPool& Pool(bool aUsingDisk)
|
||||
{
|
||||
return aUsingDisk ? mDiskPool : mMemoryPool;
|
||||
|
|
|
@ -1184,4 +1184,4 @@ static const TransportSecurityPreload kPublicKeyPinningPreloadList[] = {
|
|||
|
||||
static const int32_t kUnknownId = -1;
|
||||
|
||||
static const PRTime kPreloadPKPinsExpirationTime = INT64_C(1530217066204000);
|
||||
static const PRTime kPreloadPKPinsExpirationTime = INT64_C(1533849167128000);
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -293,11 +293,12 @@ enum
|
|||
kCommandKeyCode = 0x37,
|
||||
kShiftKeyCode = 0x38,
|
||||
kCapsLockKeyCode = 0x39,
|
||||
kOptionkeyCode = 0x3A,
|
||||
kOptionKeyCode = 0x3A,
|
||||
kControlKeyCode = 0x3B,
|
||||
kRShiftKeyCode = 0x3C, // right shift key
|
||||
kROptionKeyCode = 0x3D, // right option key
|
||||
kRControlKeyCode = 0x3E, // right control key
|
||||
kFnKeyCode = 0x3F, // fn key
|
||||
kClearKeyCode = 0x47,
|
||||
|
||||
// function keys
|
||||
|
@ -316,6 +317,11 @@ enum
|
|||
kF13KeyCode = 0x69,
|
||||
kF14KeyCode = 0x6B,
|
||||
kF15KeyCode = 0x71,
|
||||
kF16KeyCode = 0x6A,
|
||||
kF17KeyCode = 0x40,
|
||||
kF18KeyCode = 0x4F,
|
||||
kF19KeyCode = 0x50,
|
||||
kF20KeyCode = 0x5A,
|
||||
|
||||
kPrintScreenKeyCode = kF13KeyCode,
|
||||
kScrollLockKeyCode = kF14KeyCode,
|
||||
|
@ -345,6 +351,12 @@ enum
|
|||
kVK_ANSI_8 = 0x1C,
|
||||
kVK_ANSI_9 = 0x19,
|
||||
kVK_ANSI_0 = 0x1D,
|
||||
kVK_JIS_Yen = 0x5D,
|
||||
kVK_JIS_Underscore = 0x5E,
|
||||
kVK_JIS_KeypadComma = 0x5F,
|
||||
kVK_JIS_Eisu = 0x66,
|
||||
kVK_JIS_Kana = 0x68,
|
||||
kVK_PC_ContextMenu = 0x6E,
|
||||
#endif
|
||||
|
||||
kKeypadMultiplyKeyCode = 0x43,
|
||||
|
@ -352,7 +364,7 @@ enum
|
|||
kKeypadSubtractKeyCode = 0x4E,
|
||||
kKeypadDecimalKeyCode = 0x41,
|
||||
kKeypadDivideKeyCode = 0x4B,
|
||||
kKeypadEqualsKeyCode = 0x51, // no correpsonding gecko key code
|
||||
kKeypadEqualsKeyCode = 0x51, // no corresponding gecko key code
|
||||
kEnterKeyCode = 0x4C,
|
||||
kReturnKeyCode = 0x24,
|
||||
kPowerbookEnterKeyCode = 0x34, // Enter on Powerbook's keyboard is different
|
||||
|
@ -1512,11 +1524,12 @@ nsresult nsChildView::SynthesizeNativeKeyEvent(int32_t aNativeKeyboardLayout,
|
|||
case kRCommandKeyCode:
|
||||
case kCommandKeyCode:
|
||||
case kShiftKeyCode:
|
||||
case kOptionkeyCode:
|
||||
case kOptionKeyCode:
|
||||
case kControlKeyCode:
|
||||
case kRShiftKeyCode:
|
||||
case kROptionKeyCode:
|
||||
case kRControlKeyCode:
|
||||
// XXX: kFnKeyCode probably should NOT be here?
|
||||
sendFlagsChangedEvent = YES;
|
||||
}
|
||||
NSEventType eventType = sendFlagsChangedEvent ? NSFlagsChanged : NSKeyDown;
|
||||
|
@ -6218,8 +6231,283 @@ static uint32_t GetGeckoKeyCodeFromChar(char16_t aChar)
|
|||
}
|
||||
}
|
||||
|
||||
// XXX: aKeyEvent isn't actually used
|
||||
static uint32_t ConvertMacToGeckoKeyCode(UInt32 keyCode, WidgetKeyboardEvent* aKeyEvent, NSString* characters)
|
||||
// Tabular functions for TenFourFox issue 497
|
||||
static uint32_t ConvertMacToGeckoKeyLocation(UInt32 keyCode)
|
||||
{
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_RETURN;
|
||||
|
||||
uint32_t location = nsIDOMKeyEvent::DOM_KEY_LOCATION_STANDARD;
|
||||
|
||||
switch (keyCode)
|
||||
{
|
||||
case kCommandKeyCode:
|
||||
case kShiftKeyCode:
|
||||
case kOptionKeyCode:
|
||||
case kControlKeyCode:
|
||||
case kFnKeyCode:
|
||||
case kVK_PC_ContextMenu:
|
||||
location = nsIDOMKeyEvent::DOM_KEY_LOCATION_LEFT;
|
||||
break;
|
||||
|
||||
case kRCommandKeyCode:
|
||||
case kRShiftKeyCode:
|
||||
case kROptionKeyCode:
|
||||
case kRControlKeyCode:
|
||||
location = nsIDOMKeyEvent::DOM_KEY_LOCATION_RIGHT;
|
||||
break;
|
||||
|
||||
case kKeypad0KeyCode:
|
||||
case kKeypad1KeyCode:
|
||||
case kKeypad2KeyCode:
|
||||
case kKeypad3KeyCode:
|
||||
case kKeypad4KeyCode:
|
||||
case kKeypad5KeyCode:
|
||||
case kKeypad6KeyCode:
|
||||
case kKeypad7KeyCode:
|
||||
case kKeypad8KeyCode:
|
||||
case kKeypad9KeyCode:
|
||||
case kKeypadMultiplyKeyCode:
|
||||
case kKeypadAddKeyCode:
|
||||
case kKeypadSubtractKeyCode:
|
||||
case kKeypadDecimalKeyCode:
|
||||
case kKeypadDivideKeyCode:
|
||||
case kKeypadEqualsKeyCode:
|
||||
case kVK_JIS_KeypadComma:
|
||||
case kEnterKeyCode:
|
||||
case kClearKeyCode:
|
||||
location = nsIDOMKeyEvent::DOM_KEY_LOCATION_NUMPAD;
|
||||
break;
|
||||
}
|
||||
|
||||
return location;
|
||||
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK_RETURN(0);
|
||||
}
|
||||
|
||||
static KeyNameIndex ConvertMacToDOMKeyName(UInt32 keyCode)
|
||||
{
|
||||
#define K(y,x) case y: return KEY_NAME_INDEX_ ## x;
|
||||
|
||||
// This replaces the code in TextInputHandler that we don't use.
|
||||
// Based on NativeKeyToDOMKeyName.h.
|
||||
switch (keyCode)
|
||||
{
|
||||
K(kOptionKeyCode, Alt)
|
||||
K(kROptionKeyCode, Alt)
|
||||
|
||||
K(kCapsLockKeyCode, CapsLock)
|
||||
|
||||
K(kFnKeyCode, Fn)
|
||||
K(kVK_PC_ContextMenu, ContextMenu)
|
||||
|
||||
K(kControlKeyCode, Control)
|
||||
K(kRControlKeyCode, Control)
|
||||
|
||||
K(kCommandKeyCode, Meta)
|
||||
K(kRCommandKeyCode, Meta)
|
||||
|
||||
K(kShiftKeyCode, Shift)
|
||||
K(kRShiftKeyCode, Shift)
|
||||
|
||||
case kReturnKeyCode:
|
||||
case kEnterKeyCode:
|
||||
case kPowerbookEnterKeyCode:
|
||||
return KEY_NAME_INDEX_Enter;
|
||||
|
||||
K(kTabKeyCode, Tab)
|
||||
K(kLeftArrowKeyCode, ArrowLeft)
|
||||
K(kRightArrowKeyCode, ArrowRight)
|
||||
K(kDownArrowKeyCode, ArrowDown)
|
||||
K(kUpArrowKeyCode, ArrowUp)
|
||||
K(kEndKeyCode, End)
|
||||
K(kHomeKeyCode, Home)
|
||||
K(kPageDownKeyCode, PageDown)
|
||||
K(kPageUpKeyCode, PageUp)
|
||||
|
||||
K(kBackspaceKeyCode, Backspace)
|
||||
K(kDeleteKeyCode, Delete)
|
||||
K(kClearKeyCode, Clear)
|
||||
|
||||
K(kEscapeKeyCode, Escape)
|
||||
|
||||
K(kInsertKeyCode, Help) // XXX?!
|
||||
|
||||
K(kF1KeyCode, F1)
|
||||
K(kF2KeyCode, F2)
|
||||
K(kF3KeyCode, F3)
|
||||
K(kF4KeyCode, F4)
|
||||
K(kF5KeyCode, F5)
|
||||
K(kF6KeyCode, F6)
|
||||
K(kF7KeyCode, F7)
|
||||
K(kF8KeyCode, F8)
|
||||
K(kF9KeyCode, F9)
|
||||
K(kF10KeyCode, F10)
|
||||
K(kF11KeyCode, F11)
|
||||
K(kF12KeyCode, F12)
|
||||
K(kF13KeyCode, F13)
|
||||
K(kF14KeyCode, F14)
|
||||
K(kF15KeyCode, F15)
|
||||
K(kF16KeyCode, F16)
|
||||
K(kF17KeyCode, F17)
|
||||
K(kF18KeyCode, F18)
|
||||
K(kF19KeyCode, F19)
|
||||
K(kF20KeyCode, F20)
|
||||
|
||||
K(kVK_JIS_Eisu, Eisu)
|
||||
K(kVK_JIS_Kana, KanjiMode)
|
||||
|
||||
// We are missing volume and media keys,
|
||||
// but the OS seems to intercept these, so I
|
||||
// didn't bother assigning them symbols.
|
||||
}
|
||||
|
||||
return KEY_NAME_INDEX_Unidentified;
|
||||
|
||||
#undef K
|
||||
}
|
||||
|
||||
#define K(x) CODE_NAME_INDEX_ ## x ,
|
||||
static const CodeNameIndex MacKeyCodeToDOMCode[] = {
|
||||
/* It is not at all clear if all of these keys actually work! */
|
||||
K(KeyA) // 0x00
|
||||
K(KeyS)
|
||||
K(KeyD)
|
||||
K(KeyF)
|
||||
K(KeyH)
|
||||
K(KeyG)
|
||||
K(KeyZ)
|
||||
K(KeyX)
|
||||
K(KeyC) // 0x08
|
||||
K(KeyV)
|
||||
K(IntlBackslash) // XXX: 0x0a
|
||||
K(KeyB)
|
||||
K(KeyQ)
|
||||
K(KeyW)
|
||||
K(KeyE)
|
||||
K(KeyR)
|
||||
K(KeyY) // 0x10
|
||||
K(KeyT)
|
||||
K(Digit1)
|
||||
K(Digit2)
|
||||
K(Digit3)
|
||||
K(Digit4)
|
||||
K(Digit6)
|
||||
K(Digit5)
|
||||
K(Equal) // 0x18
|
||||
K(Digit9)
|
||||
K(Digit7)
|
||||
K(Minus)
|
||||
K(Digit8)
|
||||
K(Digit0)
|
||||
K(BracketRight)
|
||||
K(KeyO)
|
||||
K(KeyU) // 0x20
|
||||
K(BracketLeft)
|
||||
K(KeyI)
|
||||
K(KeyP)
|
||||
K(Enter)
|
||||
K(KeyL)
|
||||
K(KeyJ)
|
||||
K(Quote)
|
||||
K(KeyK) // 0x28
|
||||
K(Semicolon)
|
||||
K(Backslash)
|
||||
K(Comma)
|
||||
K(Slash)
|
||||
K(KeyN)
|
||||
K(KeyM)
|
||||
K(Period)
|
||||
K(Tab) // 0x30
|
||||
K(Space)
|
||||
K(Backquote)
|
||||
K(Backspace)
|
||||
K(NumpadEnter) // XXX: 0x34, kPowerbookEnterKeyCode. Just a guess.
|
||||
K(Escape)
|
||||
K(OSRight)
|
||||
K(OSLeft)
|
||||
K(ShiftLeft) // 0x38
|
||||
K(CapsLock)
|
||||
K(AltLeft)
|
||||
K(ControlLeft)
|
||||
K(ShiftRight)
|
||||
K(AltRight) // huhuhu
|
||||
K(ControlRight)
|
||||
K(Fn)
|
||||
K(F17) // 0x40
|
||||
K(NumpadDecimal)
|
||||
K(UNKNOWN) // 0x42
|
||||
K(NumpadMultiply)
|
||||
K(UNKNOWN) // 0x44
|
||||
K(NumpadAdd)
|
||||
K(UNKNOWN) // 0x46
|
||||
K(NumpadClear)
|
||||
K(VolumeUp) // 0x48
|
||||
K(VolumeDown)
|
||||
K(VolumeMute)
|
||||
K(NumpadDivide)
|
||||
K(NumpadEnter)
|
||||
K(UNKNOWN) // 0x4d
|
||||
K(NumpadSubtract)
|
||||
K(F18)
|
||||
K(F19) // 0x50
|
||||
K(NumpadEqual)
|
||||
K(Numpad0)
|
||||
K(Numpad1)
|
||||
K(Numpad2)
|
||||
K(Numpad3)
|
||||
K(Numpad4)
|
||||
K(Numpad5)
|
||||
K(Numpad6) // 0x58
|
||||
K(Numpad7)
|
||||
K(F20)
|
||||
K(Numpad8)
|
||||
K(Numpad9)
|
||||
K(IntlYen)
|
||||
K(IntlRo)
|
||||
K(NumpadComma)
|
||||
K(F5) // 0x60
|
||||
K(F6)
|
||||
K(F7)
|
||||
K(F3)
|
||||
K(F8)
|
||||
K(F9)
|
||||
K(Lang2) // Eisu
|
||||
K(F11)
|
||||
K(Lang1) // 0x68 // Kana
|
||||
K(F13)
|
||||
K(F16)
|
||||
K(F14)
|
||||
K(UNKNOWN) // 0x6c
|
||||
K(F10)
|
||||
K(ContextMenu)
|
||||
K(F12)
|
||||
K(UNKNOWN) // 0x70
|
||||
K(F15)
|
||||
K(Help)
|
||||
K(Home)
|
||||
K(PageUp)
|
||||
K(Delete)
|
||||
K(F4)
|
||||
K(End)
|
||||
K(F2) // 0x78
|
||||
K(PageDown)
|
||||
K(F1)
|
||||
K(ArrowLeft)
|
||||
K(ArrowRight)
|
||||
K(ArrowDown)
|
||||
K(ArrowUp)
|
||||
K(UNKNOWN) // 0x7f
|
||||
};
|
||||
#undef K
|
||||
|
||||
inline static CodeNameIndex ConvertMacToDOMCode(UInt32 keyCode)
|
||||
{
|
||||
MOZ_ASSERT(keyCode < 0x80);
|
||||
return MacKeyCodeToDOMCode[keyCode];
|
||||
}
|
||||
// End issue 497
|
||||
|
||||
static uint32_t ConvertMacToGeckoKeyCode(UInt32 keyCode, NSString* characters)
|
||||
{
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_RETURN;
|
||||
|
||||
|
@ -6237,8 +6525,7 @@ static uint32_t ConvertMacToGeckoKeyCode(UInt32 keyCode, WidgetKeyboardEvent* aK
|
|||
case kRControlKeyCode:
|
||||
case kControlKeyCode: geckoKeyCode = NS_VK_CONTROL; break;
|
||||
case kROptionKeyCode:
|
||||
case kOptionkeyCode: geckoKeyCode = NS_VK_ALT; break;
|
||||
case kClearKeyCode: geckoKeyCode = NS_VK_CLEAR; break;
|
||||
case kOptionKeyCode: geckoKeyCode = NS_VK_ALT; break;
|
||||
|
||||
// function keys
|
||||
case kF1KeyCode: geckoKeyCode = NS_VK_F1; break;
|
||||
|
@ -6253,10 +6540,11 @@ static uint32_t ConvertMacToGeckoKeyCode(UInt32 keyCode, WidgetKeyboardEvent* aK
|
|||
case kF10KeyCode: geckoKeyCode = NS_VK_F10; break;
|
||||
case kF11KeyCode: geckoKeyCode = NS_VK_F11; break;
|
||||
case kF12KeyCode: geckoKeyCode = NS_VK_F12; break;
|
||||
// these three are aliases for the ones below, so use the canonical ones.
|
||||
// case kF13KeyCode: geckoKeyCode = NS_VK_F13; break;
|
||||
// clash with the 3 below
|
||||
// case kF14KeyCode: geckoKeyCode = NS_VK_F14; break;
|
||||
// case kF15KeyCode: geckoKeyCode = NS_VK_F15; break;
|
||||
// XXX: F16 through F20?
|
||||
case kPauseKeyCode: geckoKeyCode = NS_VK_PAUSE; break;
|
||||
case kScrollLockKeyCode: geckoKeyCode = NS_VK_SCROLL_LOCK; break;
|
||||
case kPrintScreenKeyCode: geckoKeyCode = NS_VK_PRINTSCREEN; break;
|
||||
|
@ -6273,6 +6561,7 @@ static uint32_t ConvertMacToGeckoKeyCode(UInt32 keyCode, WidgetKeyboardEvent* aK
|
|||
case kKeypad8KeyCode: geckoKeyCode = NS_VK_NUMPAD8; break;
|
||||
case kKeypad9KeyCode: geckoKeyCode = NS_VK_NUMPAD9; break;
|
||||
|
||||
case kClearKeyCode: geckoKeyCode = NS_VK_CLEAR; break;
|
||||
case kKeypadMultiplyKeyCode: geckoKeyCode = NS_VK_MULTIPLY; break;
|
||||
case kKeypadAddKeyCode: geckoKeyCode = NS_VK_ADD; break;
|
||||
case kKeypadSubtractKeyCode: geckoKeyCode = NS_VK_SUBTRACT; break;
|
||||
|
@ -6331,9 +6620,10 @@ static bool IsSpecialGeckoKey(UInt32 macKeyCode)
|
|||
case kCapsLockKeyCode:
|
||||
case kControlKeyCode:
|
||||
case kRControlKeyCode:
|
||||
case kOptionkeyCode:
|
||||
case kOptionKeyCode:
|
||||
case kROptionKeyCode:
|
||||
case kClearKeyCode:
|
||||
case kFnKeyCode:
|
||||
|
||||
// function keys
|
||||
case kF1KeyCode:
|
||||
|
@ -6348,9 +6638,18 @@ static bool IsSpecialGeckoKey(UInt32 macKeyCode)
|
|||
case kF10KeyCode:
|
||||
case kF11KeyCode:
|
||||
case kF12KeyCode:
|
||||
// case kF13KeyCode: // clashes with PrintScreen
|
||||
// case kF14KeyCode: // clashes with ScrollLock
|
||||
// case kF15KeyCode: // clashes with Pause
|
||||
case kF16KeyCode:
|
||||
case kF17KeyCode:
|
||||
case kF18KeyCode:
|
||||
case kF19KeyCode:
|
||||
case kF20KeyCode:
|
||||
case kPauseKeyCode:
|
||||
case kScrollLockKeyCode:
|
||||
case kPrintScreenKeyCode:
|
||||
case kVK_PC_ContextMenu:
|
||||
|
||||
case kInsertKeyCode:
|
||||
case kDeleteKeyCode:
|
||||
|
@ -6609,6 +6908,7 @@ GetUSLayoutCharFromKeyTranslate(UInt32 aKeyCode, UInt32 aModifiers)
|
|||
if (!aKeyEvent || !outGeckoEvent)
|
||||
return;
|
||||
|
||||
unsigned short keyCode = nsCocoaUtils::GetCocoaEventKeyCode(aKeyEvent);
|
||||
nsCocoaUtils::InitInputEvent(*outGeckoEvent, aKeyEvent);
|
||||
|
||||
// coords for key events are always 0,0
|
||||
|
@ -6619,12 +6919,15 @@ GetUSLayoutCharFromKeyTranslate(UInt32 aKeyCode, UInt32 aModifiers)
|
|||
|
||||
// Check to see if the message is a key press that does not involve
|
||||
// one of our special key codes.
|
||||
// (This can also be generated by insertText:, so look there for a similar
|
||||
// but abbreviated pathway.)
|
||||
if (outGeckoEvent->mMessage == eKeyPress &&
|
||||
!IsSpecialGeckoKey(nsCocoaUtils::GetCocoaEventKeyCode(aKeyEvent))) {
|
||||
!IsSpecialGeckoKey(keyCode)) {
|
||||
outGeckoEvent->isChar = true; // this is not a special key
|
||||
|
||||
outGeckoEvent->charCode = 0;
|
||||
outGeckoEvent->keyCode = 0; // not set for key press events
|
||||
outGeckoEvent->location = ConvertMacToGeckoKeyLocation(keyCode);
|
||||
|
||||
NSString* chars = [aKeyEvent characters];
|
||||
if ([chars length] > 0)
|
||||
|
@ -6855,16 +7158,39 @@ GetUSLayoutCharFromKeyTranslate(UInt32 aKeyCode, UInt32 aModifiers)
|
|||
outGeckoEvent->alternativeCharCodes.AppendElement(altCharCodes);
|
||||
}
|
||||
}
|
||||
|
||||
// Now that we have a charCode defined, use that as a KeyNameIndex
|
||||
// for TenFourFox issue 497.
|
||||
outGeckoEvent->mKeyNameIndex = KEY_NAME_INDEX_USE_STRING;
|
||||
outGeckoEvent->mKeyValue = (uint32_t)outGeckoEvent->charCode;
|
||||
}
|
||||
else {
|
||||
NSString* characters = nil;
|
||||
if ([aKeyEvent type] != NSFlagsChanged)
|
||||
characters = [aKeyEvent charactersIgnoringModifiers];
|
||||
|
||||
outGeckoEvent->keyCode =
|
||||
ConvertMacToGeckoKeyCode([aKeyEvent keyCode], outGeckoEvent, characters);
|
||||
outGeckoEvent->keyCode = ConvertMacToGeckoKeyCode(keyCode, characters);
|
||||
outGeckoEvent->charCode = 0;
|
||||
}
|
||||
|
||||
// Add extra DOM fields for TenFourFox issue 497.
|
||||
// XXX: Should this be based on the Gecko key code for consistency?
|
||||
outGeckoEvent->location = ConvertMacToGeckoKeyLocation(keyCode);
|
||||
outGeckoEvent->mKeyNameIndex = ConvertMacToDOMKeyName(keyCode);
|
||||
|
||||
// If the KeyNameIndex is still Unidentified, look at [characters] to see if
|
||||
// we can maybe extract it from there.
|
||||
if (outGeckoEvent->mKeyNameIndex == KEY_NAME_INDEX_Unidentified &&
|
||||
characters &&
|
||||
[characters length]) {
|
||||
outGeckoEvent->mKeyNameIndex = KEY_NAME_INDEX_USE_STRING;
|
||||
outGeckoEvent->mKeyValue = (uint32_t)[characters characterAtIndex:0];
|
||||
}
|
||||
}
|
||||
|
||||
// Convert the KeyName to a CodeName. We don't use CODE_NAME_INDEX_STRING; every
|
||||
// key has a code, or else it's CODE_NAME_INDEX_UNKNOWN.
|
||||
// This concludes TenFourFox issue 497.
|
||||
outGeckoEvent->mCodeNameIndex = ConvertMacToDOMCode(keyCode);
|
||||
|
||||
// For NativeKeyBindings
|
||||
outGeckoEvent->mNativeKeyEvent = aKeyEvent;
|
||||
|
@ -7099,10 +7425,16 @@ GetUSLayoutCharFromKeyTranslate(UInt32 aKeyCode, UInt32 aModifiers)
|
|||
return;
|
||||
|
||||
// dispatch keypress event with char instead of textEvent
|
||||
// this is mostly the same as in convertCocoaKeyEvent:
|
||||
WidgetKeyboardEvent geckoEvent(true, eKeyPress, mGeckoChild);
|
||||
geckoEvent.charCode = bufPtr[0]; // gecko expects OS-translated unicode
|
||||
geckoEvent.keyCode = 0;
|
||||
geckoEvent.isChar = true;
|
||||
|
||||
// TenFourFox issue 497
|
||||
geckoEvent.mKeyNameIndex = KEY_NAME_INDEX_USE_STRING;
|
||||
geckoEvent.mKeyValue = (uint32_t)bufPtr[0];
|
||||
|
||||
if (mKeyDownHandled)
|
||||
geckoEvent.mFlags.mDefaultPrevented = true;
|
||||
|
||||
|
@ -7112,6 +7444,7 @@ GetUSLayoutCharFromKeyTranslate(UInt32 aKeyCode, UInt32 aModifiers)
|
|||
|
||||
if (mCurKeyEvent) {
|
||||
nsCocoaUtils::InitInputEvent(geckoEvent, mCurKeyEvent);
|
||||
uint32_t keyCode = nsCocoaUtils::GetCocoaEventKeyCode(mCurKeyEvent);
|
||||
|
||||
// XXX The ASCII characters inputting mode of egbridge (Japanese IME)
|
||||
// might send the keyDown event with wrong keyboard layout if other
|
||||
|
@ -7119,16 +7452,26 @@ GetUSLayoutCharFromKeyTranslate(UInt32 aKeyCode, UInt32 aModifiers)
|
|||
// doesn't match to this gecko event...
|
||||
|
||||
if (!IsPrintableChar(geckoEvent.charCode)) {
|
||||
geckoEvent.keyCode = ConvertMacToGeckoKeyCode(nsCocoaUtils::GetCocoaEventKeyCode(mCurKeyEvent), &geckoEvent, [mCurKeyEvent charactersIgnoringModifiers]);
|
||||
geckoEvent.keyCode = ConvertMacToGeckoKeyCode(keyCode, [mCurKeyEvent charactersIgnoringModifiers]);
|
||||
geckoEvent.charCode = 0;
|
||||
geckoEvent.mKeyValue = (uint32_t)geckoEvent.keyCode;
|
||||
}
|
||||
geckoEvent.mCodeNameIndex = ConvertMacToDOMCode(keyCode);
|
||||
geckoEvent.location = ConvertMacToGeckoKeyLocation(keyCode);
|
||||
} else {
|
||||
nsCocoaUtils::InitInputEvent(geckoEvent, static_cast<NSEvent*>(nullptr));
|
||||
// Note that insertText is not called only at key pressing.
|
||||
if (!IsPrintableChar(geckoEvent.charCode)) {
|
||||
geckoEvent.keyCode = GetGeckoKeyCodeFromChar(geckoEvent.charCode);
|
||||
geckoEvent.charCode = 0;
|
||||
geckoEvent.mKeyValue = (uint32_t)geckoEvent.keyCode;
|
||||
}
|
||||
// If the event does not have a native key event, we can't determine the
|
||||
// actual scan code. In that case, hope for the best -- it would be worse
|
||||
// if we weren't using a QWERTY layout and guessed the wrong key instead
|
||||
// of just saying we don't know.
|
||||
geckoEvent.mCodeNameIndex = CODE_NAME_INDEX_UNKNOWN;
|
||||
geckoEvent.location = nsIDOMKeyEvent::DOM_KEY_LOCATION_STANDARD;
|
||||
}
|
||||
|
||||
// Remove basic modifiers from keypress event because if they are included,
|
||||
|
|
|
@ -373,6 +373,7 @@ void nsCocoaUtils::CleanUpAfterNativeAppModalDialog()
|
|||
|
||||
unsigned short nsCocoaUtils::GetCocoaEventKeyCode(NSEvent *theEvent)
|
||||
{
|
||||
#if(0)
|
||||
unsigned short keyCode = [theEvent keyCode];
|
||||
if (nsCocoaFeatures::OnLeopardOrLater())
|
||||
return keyCode;
|
||||
|
@ -395,6 +396,24 @@ unsigned short nsCocoaUtils::GetCocoaEventKeyCode(NSEvent *theEvent)
|
|||
if ([unmodchars characterAtIndex:0] == 0x1b)
|
||||
keyCode = 0x35;
|
||||
}
|
||||
#else
|
||||
// Clean this up a bit for faster calls.
|
||||
unsigned short keyCode = [theEvent keyCode];
|
||||
// If there is a keyCode (likely), or this is Leopard, return keyCode.
|
||||
if (MOZ_LIKELY(keyCode) || nsCocoaFeatures::OnLeopardOrLater())
|
||||
return keyCode;
|
||||
// Tiger kludge from above.
|
||||
// If the type is not NSKeyDown or KeyUp (unlikely), return keyCode.
|
||||
NSEventType type = [theEvent type];
|
||||
if (MOZ_UNLIKELY((type != NSKeyDown) && (type != NSKeyUp)))
|
||||
return keyCode;
|
||||
NSString *unmodchars = [theEvent charactersIgnoringModifiers];
|
||||
if ([unmodchars length] == 1) {
|
||||
if ([unmodchars characterAtIndex:0] == 0x1b)
|
||||
keyCode = 0x35;
|
||||
}
|
||||
#endif
|
||||
|
||||
return keyCode;
|
||||
}
|
||||
|
||||
|
|
|
@ -220,17 +220,17 @@ PLDHashTable::operator=(PLDHashTable&& aOther)
|
|||
return *this;
|
||||
}
|
||||
|
||||
// Destruct |this|.
|
||||
this->~PLDHashTable();
|
||||
|
||||
// |mOps| and |mEntrySize| are const so we can't assign them. Instead, we
|
||||
// require that they are equal. The justification for this is that they're
|
||||
// |mOps| and |mEntrySize| are required to stay the same, they're
|
||||
// conceptually part of the type -- indeed, if PLDHashTable was a templated
|
||||
// type like nsTHashtable, they *would* be part of the type -- so it only
|
||||
// makes sense to assign in cases where they match.
|
||||
MOZ_RELEASE_ASSERT(mOps == aOther.mOps);
|
||||
MOZ_RELEASE_ASSERT(mEntrySize == aOther.mEntrySize);
|
||||
|
||||
// Reconstruct |this|.
|
||||
this->~PLDHashTable();
|
||||
new (this) PLDHashTable(aOther.mOps, aOther.mEntrySize, 0);
|
||||
|
||||
// Move non-const pieces over.
|
||||
mHashShift = Move(aOther.mHashShift);
|
||||
mEntryCount = Move(aOther.mEntryCount);
|
||||
|
|
Loading…
Reference in New Issue