mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-25 20:01:50 +00:00
Merge inbound to mozilla-central. a=merge
This commit is contained in:
commit
b36e97fc77
22
browser/actors/RFPHelperChild.jsm
Normal file
22
browser/actors/RFPHelperChild.jsm
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
/* -*- indent-tabs-mode: nil; js-indent-level: 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/. */
|
||||||
|
|
||||||
|
var EXPORTED_SYMBOLS = ["RFPHelperChild"];
|
||||||
|
|
||||||
|
const {ActorChild} = ChromeUtils.import("resource://gre/modules/ActorChild.jsm");
|
||||||
|
const {XPCOMUtils} = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||||
|
|
||||||
|
const kPrefLetterboxing = "privacy.resistFingerprinting.letterboxing";
|
||||||
|
|
||||||
|
XPCOMUtils.defineLazyPreferenceGetter(this, "isLetterboxingEnabled",
|
||||||
|
kPrefLetterboxing, false);
|
||||||
|
|
||||||
|
class RFPHelperChild extends ActorChild {
|
||||||
|
handleEvent() {
|
||||||
|
if (isLetterboxingEnabled) {
|
||||||
|
this.mm.sendAsyncMessage("Letterboxing:ContentSizeUpdated");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -42,6 +42,7 @@ FINAL_TARGET_FILES.actors += [
|
|||||||
'PageInfoChild.jsm',
|
'PageInfoChild.jsm',
|
||||||
'PageStyleChild.jsm',
|
'PageStyleChild.jsm',
|
||||||
'PluginChild.jsm',
|
'PluginChild.jsm',
|
||||||
|
'RFPHelperChild.jsm',
|
||||||
'SearchTelemetryChild.jsm',
|
'SearchTelemetryChild.jsm',
|
||||||
'URIFixupChild.jsm',
|
'URIFixupChild.jsm',
|
||||||
'WebRTCChild.jsm',
|
'WebRTCChild.jsm',
|
||||||
|
@ -28,7 +28,6 @@ XPCOMUtils.defineLazyModuleGetters(this, {
|
|||||||
E10SUtils: "resource://gre/modules/E10SUtils.jsm",
|
E10SUtils: "resource://gre/modules/E10SUtils.jsm",
|
||||||
ExtensionsUI: "resource:///modules/ExtensionsUI.jsm",
|
ExtensionsUI: "resource:///modules/ExtensionsUI.jsm",
|
||||||
FormValidationHandler: "resource:///modules/FormValidationHandler.jsm",
|
FormValidationHandler: "resource:///modules/FormValidationHandler.jsm",
|
||||||
LanguagePrompt: "resource://gre/modules/LanguagePrompt.jsm",
|
|
||||||
HomePage: "resource:///modules/HomePage.jsm",
|
HomePage: "resource:///modules/HomePage.jsm",
|
||||||
LightweightThemeConsumer: "resource://gre/modules/LightweightThemeConsumer.jsm",
|
LightweightThemeConsumer: "resource://gre/modules/LightweightThemeConsumer.jsm",
|
||||||
LightweightThemeManager: "resource://gre/modules/LightweightThemeManager.jsm",
|
LightweightThemeManager: "resource://gre/modules/LightweightThemeManager.jsm",
|
||||||
@ -50,6 +49,7 @@ XPCOMUtils.defineLazyModuleGetters(this, {
|
|||||||
ProcessHangMonitor: "resource:///modules/ProcessHangMonitor.jsm",
|
ProcessHangMonitor: "resource:///modules/ProcessHangMonitor.jsm",
|
||||||
PromiseUtils: "resource://gre/modules/PromiseUtils.jsm",
|
PromiseUtils: "resource://gre/modules/PromiseUtils.jsm",
|
||||||
ReaderParent: "resource:///modules/ReaderParent.jsm",
|
ReaderParent: "resource:///modules/ReaderParent.jsm",
|
||||||
|
RFPHelper: "resource://gre/modules/RFPHelper.jsm",
|
||||||
SafeBrowsing: "resource://gre/modules/SafeBrowsing.jsm",
|
SafeBrowsing: "resource://gre/modules/SafeBrowsing.jsm",
|
||||||
Sanitizer: "resource:///modules/Sanitizer.jsm",
|
Sanitizer: "resource:///modules/Sanitizer.jsm",
|
||||||
SessionStartup: "resource:///modules/sessionstore/SessionStartup.jsm",
|
SessionStartup: "resource:///modules/sessionstore/SessionStartup.jsm",
|
||||||
@ -1948,8 +1948,6 @@ var gBrowserInit = {
|
|||||||
ToolbarKeyboardNavigator.uninit();
|
ToolbarKeyboardNavigator.uninit();
|
||||||
}
|
}
|
||||||
|
|
||||||
LanguagePrompt.uninit();
|
|
||||||
|
|
||||||
BrowserSearch.uninit();
|
BrowserSearch.uninit();
|
||||||
|
|
||||||
// Now either cancel delayedStartup, or clean up the services initialized from
|
// Now either cancel delayedStartup, or clean up the services initialized from
|
||||||
|
@ -244,6 +244,16 @@ let ACTORS = {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
RFPHelper: {
|
||||||
|
child: {
|
||||||
|
module: "resource:///actors/RFPHelperChild.jsm",
|
||||||
|
group: "browsers",
|
||||||
|
events: {
|
||||||
|
"resize": {},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
SearchTelemetry: {
|
SearchTelemetry: {
|
||||||
child: {
|
child: {
|
||||||
module: "resource:///actors/SearchTelemetryChild.jsm",
|
module: "resource:///actors/SearchTelemetryChild.jsm",
|
||||||
@ -397,7 +407,6 @@ XPCOMUtils.defineLazyModuleGetters(this, {
|
|||||||
HybridContentTelemetry: "resource://gre/modules/HybridContentTelemetry.jsm",
|
HybridContentTelemetry: "resource://gre/modules/HybridContentTelemetry.jsm",
|
||||||
Integration: "resource://gre/modules/Integration.jsm",
|
Integration: "resource://gre/modules/Integration.jsm",
|
||||||
L10nRegistry: "resource://gre/modules/L10nRegistry.jsm",
|
L10nRegistry: "resource://gre/modules/L10nRegistry.jsm",
|
||||||
LanguagePrompt: "resource://gre/modules/LanguagePrompt.jsm",
|
|
||||||
LightweightThemeManager: "resource://gre/modules/LightweightThemeManager.jsm",
|
LightweightThemeManager: "resource://gre/modules/LightweightThemeManager.jsm",
|
||||||
LiveBookmarkMigrator: "resource:///modules/LiveBookmarkMigrator.jsm",
|
LiveBookmarkMigrator: "resource:///modules/LiveBookmarkMigrator.jsm",
|
||||||
NewTabUtils: "resource://gre/modules/NewTabUtils.jsm",
|
NewTabUtils: "resource://gre/modules/NewTabUtils.jsm",
|
||||||
@ -415,6 +424,7 @@ XPCOMUtils.defineLazyModuleGetters(this, {
|
|||||||
PrivateBrowsingUtils: "resource://gre/modules/PrivateBrowsingUtils.jsm",
|
PrivateBrowsingUtils: "resource://gre/modules/PrivateBrowsingUtils.jsm",
|
||||||
ProcessHangMonitor: "resource:///modules/ProcessHangMonitor.jsm",
|
ProcessHangMonitor: "resource:///modules/ProcessHangMonitor.jsm",
|
||||||
RemoteSettings: "resource://services-settings/remote-settings.js",
|
RemoteSettings: "resource://services-settings/remote-settings.js",
|
||||||
|
RFPHelper: "resource://gre/modules/RFPHelper.jsm",
|
||||||
SafeBrowsing: "resource://gre/modules/SafeBrowsing.jsm",
|
SafeBrowsing: "resource://gre/modules/SafeBrowsing.jsm",
|
||||||
Sanitizer: "resource:///modules/Sanitizer.jsm",
|
Sanitizer: "resource:///modules/Sanitizer.jsm",
|
||||||
SaveToPocket: "chrome://pocket/content/SaveToPocket.jsm",
|
SaveToPocket: "chrome://pocket/content/SaveToPocket.jsm",
|
||||||
@ -1461,6 +1471,7 @@ BrowserGlue.prototype = {
|
|||||||
DateTimePickerParent.uninit();
|
DateTimePickerParent.uninit();
|
||||||
|
|
||||||
Normandy.uninit();
|
Normandy.uninit();
|
||||||
|
RFPHelper.uninit();
|
||||||
},
|
},
|
||||||
|
|
||||||
// Set up a listener to enable/disable the screenshots extension
|
// Set up a listener to enable/disable the screenshots extension
|
||||||
@ -1674,7 +1685,7 @@ BrowserGlue.prototype = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Services.tm.idleDispatchToMainThread(() => {
|
Services.tm.idleDispatchToMainThread(() => {
|
||||||
LanguagePrompt.init();
|
RFPHelper.init();
|
||||||
});
|
});
|
||||||
|
|
||||||
Services.tm.idleDispatchToMainThread(() => {
|
Services.tm.idleDispatchToMainThread(() => {
|
||||||
|
@ -11,6 +11,7 @@ support-files =
|
|||||||
head.js
|
head.js
|
||||||
|
|
||||||
[browser_block_mozAddonManager.js]
|
[browser_block_mozAddonManager.js]
|
||||||
|
[browser_dynamical_window_rounding.js]
|
||||||
[browser_navigator.js]
|
[browser_navigator.js]
|
||||||
[browser_netInfo.js]
|
[browser_netInfo.js]
|
||||||
[browser_performanceAPI.js]
|
[browser_performanceAPI.js]
|
||||||
|
@ -25,6 +25,8 @@ add_task(async function() {
|
|||||||
|
|
||||||
isnot(tab3Zoom, tab1Zoom, "privacy.resistFingerprinting is true, site-specific zoom level should be disabled");
|
isnot(tab3Zoom, tab1Zoom, "privacy.resistFingerprinting is true, site-specific zoom level should be disabled");
|
||||||
|
|
||||||
|
await FullZoom.reset();
|
||||||
|
|
||||||
BrowserTestUtils.removeTab(tab1);
|
BrowserTestUtils.removeTab(tab1);
|
||||||
BrowserTestUtils.removeTab(tab2);
|
BrowserTestUtils.removeTab(tab2);
|
||||||
BrowserTestUtils.removeTab(tab3);
|
BrowserTestUtils.removeTab(tab3);
|
||||||
|
@ -0,0 +1,281 @@
|
|||||||
|
/* 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/.
|
||||||
|
*
|
||||||
|
* Bug 1407366 - A test case for reassuring the size of the content viewport is
|
||||||
|
* rounded if the window is resized when letterboxing is enabled.
|
||||||
|
*
|
||||||
|
* A helpful note: if this test starts randomly failing; it may be because the
|
||||||
|
* zoom level was not reset by an earlier-run test. See Bug 1407366 for an
|
||||||
|
* example.
|
||||||
|
*/
|
||||||
|
|
||||||
|
const TEST_PATH = "http://example.net/browser/browser/components/resistfingerprinting/test/browser/";
|
||||||
|
|
||||||
|
const DEFAULT_ROUNDED_WIDTH_STEP = 200;
|
||||||
|
const DEFAULT_ROUNDED_HEIGHT_STEP = 100;
|
||||||
|
|
||||||
|
// A set of test cases which defines the width and the height of the outer window.
|
||||||
|
const TEST_CASES = [
|
||||||
|
{width: 1250, height: 1000},
|
||||||
|
{width: 1500, height: 1050},
|
||||||
|
{width: 1120, height: 760},
|
||||||
|
{width: 800, height: 600},
|
||||||
|
{width: 640, height: 400},
|
||||||
|
{width: 500, height: 350},
|
||||||
|
{width: 300, height: 170},
|
||||||
|
];
|
||||||
|
|
||||||
|
function getPlatform() {
|
||||||
|
const {OS} = Services.appinfo;
|
||||||
|
if (OS == "WINNT") {
|
||||||
|
return "win";
|
||||||
|
} else if (OS == "Darwin") {
|
||||||
|
return "mac";
|
||||||
|
}
|
||||||
|
return "linux";
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleOSFuzziness(aContent, aTarget) {
|
||||||
|
/*
|
||||||
|
* On Windows, we observed off-by-one pixel differences that
|
||||||
|
* couldn't be expained. When manually setting the window size
|
||||||
|
* to try to reproduce it; it did not occur.
|
||||||
|
*/
|
||||||
|
if (getPlatform() == "win") {
|
||||||
|
return Math.abs(aContent - aTarget) <= 1;
|
||||||
|
}
|
||||||
|
return aContent == aTarget;
|
||||||
|
}
|
||||||
|
|
||||||
|
function checkForDefaultSetting(
|
||||||
|
aContentWidth, aContentHeight, aRealWidth, aRealHeight) {
|
||||||
|
// The default behavior for rounding is to round window with 200x100 stepping.
|
||||||
|
// So, we can get the rounded size by subtracting the remainder.
|
||||||
|
let targetWidth = aRealWidth - (aRealWidth % DEFAULT_ROUNDED_WIDTH_STEP);
|
||||||
|
let targetHeight = aRealHeight - (aRealHeight % DEFAULT_ROUNDED_HEIGHT_STEP);
|
||||||
|
|
||||||
|
// This platform-specific code is explained in the large comment below.
|
||||||
|
if (getPlatform() != "linux") {
|
||||||
|
ok(handleOSFuzziness(aContentWidth, targetWidth),
|
||||||
|
`Default Dimensions: The content window width is correctly rounded into. ${aRealWidth}px -> ${aContentWidth}px should equal ${targetWidth}px`);
|
||||||
|
|
||||||
|
ok(handleOSFuzziness(aContentHeight, targetHeight),
|
||||||
|
`Default Dimensions: The content window height is correctly rounded into. ${aRealHeight}px -> ${aContentHeight}px should equal ${targetHeight}px`);
|
||||||
|
|
||||||
|
// Using ok() above will cause Win/Mac to fail on even the first test, we don't need to repeat it, return true so waitForCondition ends
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
// Returning true or false depending on if the test succeeded will cause Linux to repeat until it succeeds.
|
||||||
|
return handleOSFuzziness(aContentWidth, targetWidth) && handleOSFuzziness(aContentHeight, targetHeight);
|
||||||
|
}
|
||||||
|
|
||||||
|
async function test_dynamical_window_rounding(aWindow, aCheckFunc) {
|
||||||
|
// We need to wait for the updating the margins for the newly opened tab, or
|
||||||
|
// it will affect the following tests.
|
||||||
|
let promiseForTheFirstRounding =
|
||||||
|
TestUtils.topicObserved("test:letterboxing:update-margin-finish");
|
||||||
|
|
||||||
|
info("Open a content tab for testing.");
|
||||||
|
let tab = await BrowserTestUtils.openNewForegroundTab(
|
||||||
|
aWindow.gBrowser, TEST_PATH + "file_dummy.html");
|
||||||
|
|
||||||
|
info("Wait until the margins are applied for the opened tab.");
|
||||||
|
await promiseForTheFirstRounding;
|
||||||
|
|
||||||
|
let getContainerSize = (aTab) => {
|
||||||
|
let browserContainer = aWindow.gBrowser
|
||||||
|
.getBrowserContainer(aTab.linkedBrowser);
|
||||||
|
return {
|
||||||
|
containerWidth: browserContainer.clientWidth,
|
||||||
|
containerHeight: browserContainer.clientHeight,
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
for (let {width, height} of TEST_CASES) {
|
||||||
|
let caseString = "Case " + width + "x" + height + ": ";
|
||||||
|
// Create a promise for waiting for the margin update.
|
||||||
|
let promiseRounding =
|
||||||
|
TestUtils.topicObserved("test:letterboxing:update-margin-finish");
|
||||||
|
|
||||||
|
let {containerWidth, containerHeight} = getContainerSize(tab);
|
||||||
|
|
||||||
|
info(caseString + "Resize the window and wait until resize event happened (currently " +
|
||||||
|
containerWidth + "x" + containerHeight + ")");
|
||||||
|
await new Promise(resolve => {
|
||||||
|
({containerWidth, containerHeight} = getContainerSize(tab));
|
||||||
|
info(caseString + "Resizing (currently " + containerWidth + "x" + containerHeight + ")");
|
||||||
|
|
||||||
|
aWindow.onresize = () => {
|
||||||
|
({containerWidth, containerHeight} = getContainerSize(tab));
|
||||||
|
info(caseString + "Resized (currently " + containerWidth + "x" + containerHeight + ")");
|
||||||
|
if (getPlatform() == "linux" && containerWidth != width) {
|
||||||
|
/*
|
||||||
|
* We observed frequent test failures that resulted from receiving an onresize
|
||||||
|
* event where the browser was resized to an earlier requested dimension. This
|
||||||
|
* resize event happens on Linux only, and is an artifact of the asynchronous
|
||||||
|
* resizing. (See more discussion on 1407366#53)
|
||||||
|
*
|
||||||
|
* We cope with this problem in two ways.
|
||||||
|
*
|
||||||
|
* 1: If we detect that the browser was resized to the wrong value; we
|
||||||
|
* redo the resize. (This is the lines of code immediately following this
|
||||||
|
* comment)
|
||||||
|
* 2: We repeat the test until it works using waitForCondition(). But we still
|
||||||
|
* test Win/Mac more thoroughly: they do not loop in waitForCondition more
|
||||||
|
* than once, and can fail the test on the first attempt (because their
|
||||||
|
* check() functions use ok() while on Linux, we do not all ok() and instead
|
||||||
|
* rely on waitForCondition to fail).
|
||||||
|
*
|
||||||
|
* The logging statements in this test, and RFPHelper.jsm, help narrow down and
|
||||||
|
* illustrate the issue.
|
||||||
|
*/
|
||||||
|
info(caseString + "We hit the weird resize bug. Resize it again.");
|
||||||
|
aWindow.resizeTo(width, height);
|
||||||
|
} else {
|
||||||
|
resolve();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
aWindow.resizeTo(width, height);
|
||||||
|
});
|
||||||
|
|
||||||
|
({containerWidth, containerHeight} = getContainerSize(tab));
|
||||||
|
info(caseString + "Waiting until margin has been updated on browser element. (currently " +
|
||||||
|
containerWidth + "x" + containerHeight + ")");
|
||||||
|
await promiseRounding;
|
||||||
|
|
||||||
|
info(caseString + "Get innerWidth/Height from the content.");
|
||||||
|
await BrowserTestUtils.waitForCondition(async () => {
|
||||||
|
let {contentWidth, contentHeight} = await ContentTask.spawn(
|
||||||
|
tab.linkedBrowser, null, () => {
|
||||||
|
return {
|
||||||
|
contentWidth: content.innerWidth,
|
||||||
|
contentHeight: content.innerHeight,
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
info(caseString + "Check the result.");
|
||||||
|
return aCheckFunc(contentWidth, contentHeight, containerWidth, containerHeight);
|
||||||
|
}, "Default Dimensions: The content window width is correctly rounded into.");
|
||||||
|
}
|
||||||
|
|
||||||
|
BrowserTestUtils.removeTab(tab);
|
||||||
|
}
|
||||||
|
|
||||||
|
async function test_customize_width_and_height(aWindow) {
|
||||||
|
const test_dimensions = `120x80, 200x143, 335x255, 600x312, 742x447, 813x558,
|
||||||
|
990x672, 1200x733, 1470x858`;
|
||||||
|
|
||||||
|
await SpecialPowers.pushPrefEnv({"set":
|
||||||
|
[
|
||||||
|
["privacy.resistFingerprinting.letterboxing.dimensions", test_dimensions],
|
||||||
|
],
|
||||||
|
});
|
||||||
|
|
||||||
|
let dimensions_set = test_dimensions.split(",").map(item => {
|
||||||
|
let sizes = item.split("x").map(size => parseInt(size, 10));
|
||||||
|
|
||||||
|
return {
|
||||||
|
width: sizes[0],
|
||||||
|
height: sizes[1],
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
let checkDimension =
|
||||||
|
(aContentWidth, aContentHeight, aRealWidth, aRealHeight) => {
|
||||||
|
let matchingArea = aRealWidth * aRealHeight;
|
||||||
|
let minWaste = Number.MAX_SAFE_INTEGER;
|
||||||
|
let targetDimensions = undefined;
|
||||||
|
|
||||||
|
// Find the dimensions which waste the least content area.
|
||||||
|
for (let dim of dimensions_set) {
|
||||||
|
if (dim.width > aRealWidth || dim.height > aRealHeight) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
let waste = matchingArea - dim.width * dim.height;
|
||||||
|
|
||||||
|
if (waste >= 0 && waste < minWaste) {
|
||||||
|
targetDimensions = dim;
|
||||||
|
minWaste = waste;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// This platform-specific code is explained in the large comment above.
|
||||||
|
if (getPlatform() != "linux") {
|
||||||
|
ok(handleOSFuzziness(aContentWidth, targetDimensions.width),
|
||||||
|
`Custom Dimension: The content window width is correctly rounded into. ${aRealWidth}px -> ${aContentWidth}px should equal ${targetDimensions.width}`);
|
||||||
|
|
||||||
|
ok(handleOSFuzziness(aContentHeight, targetDimensions.height),
|
||||||
|
`Custom Dimension: The content window height is correctly rounded into. ${aRealHeight}px -> ${aContentHeight}px should equal ${targetDimensions.height}`);
|
||||||
|
|
||||||
|
// Using ok() above will cause Win/Mac to fail on even the first test, we don't need to repeat it, return true so waitForCondition ends
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
// Returning true or false depending on if the test succeeded will cause Linux to repeat until it succeeds.
|
||||||
|
return handleOSFuzziness(aContentWidth, targetDimensions.width) && handleOSFuzziness(aContentHeight, targetDimensions.height);
|
||||||
|
};
|
||||||
|
|
||||||
|
await test_dynamical_window_rounding(aWindow, checkDimension);
|
||||||
|
|
||||||
|
await SpecialPowers.popPrefEnv();
|
||||||
|
}
|
||||||
|
|
||||||
|
async function test_no_rounding_for_chrome(aWindow) {
|
||||||
|
// First, resize the window to a size with is not rounded.
|
||||||
|
await new Promise(resolve => {
|
||||||
|
aWindow.onresize = () => resolve();
|
||||||
|
aWindow.resizeTo(700, 450);
|
||||||
|
});
|
||||||
|
|
||||||
|
// open a chrome privilege tab, like about:config.
|
||||||
|
let tab = await BrowserTestUtils.openNewForegroundTab(
|
||||||
|
aWindow.gBrowser, "about:config");
|
||||||
|
|
||||||
|
// Check that the browser element should not have a margin.
|
||||||
|
is(tab.linkedBrowser.style.margin, "", "There is no margin around chrome tab.");
|
||||||
|
|
||||||
|
BrowserTestUtils.removeTab(tab);
|
||||||
|
}
|
||||||
|
|
||||||
|
add_task(async function setup() {
|
||||||
|
await SpecialPowers.pushPrefEnv({"set":
|
||||||
|
[
|
||||||
|
["privacy.resistFingerprinting.letterboxing", true],
|
||||||
|
["privacy.resistFingerprinting.letterboxing.testing", true],
|
||||||
|
],
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
add_task(async function do_tests() {
|
||||||
|
// Store the original window size before testing.
|
||||||
|
let originalOuterWidth = window.outerWidth;
|
||||||
|
let originalOuterHeight = window.outerHeight;
|
||||||
|
|
||||||
|
info("Run test for the default window rounding.");
|
||||||
|
await test_dynamical_window_rounding(window, checkForDefaultSetting);
|
||||||
|
|
||||||
|
info("Run test for the window rounding with customized dimensions.");
|
||||||
|
await test_customize_width_and_height(window);
|
||||||
|
|
||||||
|
info("Run test for no margin around tab with the chrome privilege.");
|
||||||
|
await test_no_rounding_for_chrome(window);
|
||||||
|
|
||||||
|
// Restore the original window size.
|
||||||
|
window.outerWidth = originalOuterWidth;
|
||||||
|
window.outerHeight = originalOuterHeight;
|
||||||
|
|
||||||
|
// Testing that whether the dynamical rounding works for new windows.
|
||||||
|
let win = await BrowserTestUtils.openNewBrowserWindow();
|
||||||
|
|
||||||
|
info("Run test for the default window rounding in new window.");
|
||||||
|
await test_dynamical_window_rounding(win, checkForDefaultSetting);
|
||||||
|
|
||||||
|
info("Run test for the window rounding with customized dimensions in new window.");
|
||||||
|
await test_customize_width_and_height(win);
|
||||||
|
|
||||||
|
info("Run test for no margin around tab with the chrome privilege in new window.");
|
||||||
|
await test_no_rounding_for_chrome(win);
|
||||||
|
|
||||||
|
await BrowserTestUtils.closeWindow(win);
|
||||||
|
});
|
14
devtools/platform/components.conf
Normal file
14
devtools/platform/components.conf
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
# -*- 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/.
|
||||||
|
|
||||||
|
Classes = [
|
||||||
|
{
|
||||||
|
'cid': '{ec5aa99c-7abb-4142-ac5f-aab2419e38e2}',
|
||||||
|
'contract_ids': ['@mozilla.org/jsinspector;1'],
|
||||||
|
'type': 'mozilla::jsinspector::nsJSInspector',
|
||||||
|
'headers': ['/devtools/platform/nsJSInspector.h'],
|
||||||
|
},
|
||||||
|
]
|
@ -16,4 +16,8 @@ SOURCES += [
|
|||||||
'nsJSInspector.cpp',
|
'nsJSInspector.cpp',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
XPCOM_MANIFESTS += [
|
||||||
|
'components.conf',
|
||||||
|
]
|
||||||
|
|
||||||
FINAL_LIBRARY = 'xul'
|
FINAL_LIBRARY = 'xul'
|
||||||
|
@ -8,7 +8,6 @@
|
|||||||
#include "nsThreadUtils.h"
|
#include "nsThreadUtils.h"
|
||||||
#include "jsfriendapi.h"
|
#include "jsfriendapi.h"
|
||||||
#include "mozilla/HoldDropJSObjects.h"
|
#include "mozilla/HoldDropJSObjects.h"
|
||||||
#include "mozilla/ModuleUtils.h"
|
|
||||||
#include "mozilla/dom/ScriptSettings.h"
|
#include "mozilla/dom/ScriptSettings.h"
|
||||||
#include "nsServiceManagerUtils.h"
|
#include "nsServiceManagerUtils.h"
|
||||||
#include "nsMemory.h"
|
#include "nsMemory.h"
|
||||||
@ -27,8 +26,6 @@
|
|||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
namespace jsinspector {
|
namespace jsinspector {
|
||||||
|
|
||||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsJSInspector)
|
|
||||||
|
|
||||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsJSInspector)
|
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsJSInspector)
|
||||||
NS_INTERFACE_MAP_ENTRY(nsISupports)
|
NS_INTERFACE_MAP_ENTRY(nsISupports)
|
||||||
NS_INTERFACE_MAP_ENTRY(nsIJSInspector)
|
NS_INTERFACE_MAP_ENTRY(nsIJSInspector)
|
||||||
@ -121,18 +118,3 @@ nsJSInspector::GetLastNestRequestor(JS::MutableHandle<JS::Value> out) {
|
|||||||
|
|
||||||
} // namespace jsinspector
|
} // namespace jsinspector
|
||||||
} // namespace mozilla
|
} // namespace mozilla
|
||||||
|
|
||||||
NS_DEFINE_NAMED_CID(JSINSPECTOR_CID);
|
|
||||||
|
|
||||||
static const mozilla::Module::CIDEntry kJSInspectorCIDs[] = {
|
|
||||||
{&kJSINSPECTOR_CID, false, nullptr,
|
|
||||||
mozilla::jsinspector::nsJSInspectorConstructor},
|
|
||||||
{nullptr}};
|
|
||||||
|
|
||||||
static const mozilla::Module::ContractIDEntry kJSInspectorContracts[] = {
|
|
||||||
{JSINSPECTOR_CONTRACTID, &kJSINSPECTOR_CID}, {nullptr}};
|
|
||||||
|
|
||||||
static const mozilla::Module kJSInspectorModule = {
|
|
||||||
mozilla::Module::kVersion, kJSInspectorCIDs, kJSInspectorContracts};
|
|
||||||
|
|
||||||
NSMODULE_DEFN(jsinspector) = &kJSInspectorModule;
|
|
||||||
|
@ -89,7 +89,7 @@ class Timeout final : public LinkedListElement<RefPtr<Timeout>> {
|
|||||||
// when sync loops trigger nested firing.
|
// when sync loops trigger nested firing.
|
||||||
uint32_t mFiringId;
|
uint32_t mFiringId;
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef MOZ_DIAGNOSTIC_ASSERT_ENABLED
|
||||||
int64_t mFiringIndex;
|
int64_t mFiringIndex;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -454,7 +454,7 @@ TimeoutManager::TimeoutManager(nsGlobalWindowInner& aWindow,
|
|||||||
mTimeouts(*this),
|
mTimeouts(*this),
|
||||||
mTimeoutIdCounter(1),
|
mTimeoutIdCounter(1),
|
||||||
mNextFiringId(InvalidFiringId + 1),
|
mNextFiringId(InvalidFiringId + 1),
|
||||||
#ifdef DEBUG
|
#ifdef MOZ_DIAGNOSTIC_ASSERT_ENABLED
|
||||||
mFiringIndex(0),
|
mFiringIndex(0),
|
||||||
mLastFiringIndex(-1),
|
mLastFiringIndex(-1),
|
||||||
#endif
|
#endif
|
||||||
@ -563,7 +563,7 @@ nsresult TimeoutManager::SetTimeout(nsITimeoutHandler* aHandler,
|
|||||||
}
|
}
|
||||||
|
|
||||||
RefPtr<Timeout> timeout = new Timeout();
|
RefPtr<Timeout> timeout = new Timeout();
|
||||||
#ifdef DEBUG
|
#ifdef MOZ_DIAGNOSTIC_ASSERT_ENABLED
|
||||||
timeout->mFiringIndex = -1;
|
timeout->mFiringIndex = -1;
|
||||||
#endif
|
#endif
|
||||||
timeout->mWindow = &mWindow;
|
timeout->mWindow = &mWindow;
|
||||||
@ -860,14 +860,30 @@ void TimeoutManager::RunTimeout(const TimeStamp& aNow,
|
|||||||
// objects we computed above.
|
// objects we computed above.
|
||||||
if (timeout->mFiringId != firingId) {
|
if (timeout->mFiringId != firingId) {
|
||||||
// If the FiringId does not match, but is still valid, then this is
|
// If the FiringId does not match, but is still valid, then this is
|
||||||
// a Timeout for another RunTimeout() on the call stack. Just
|
// a Timeout for another RunTimeout() on the call stack (such as in
|
||||||
// skip it.
|
// the case of nested event loops, for alert() or more likely XHR).
|
||||||
|
// Just skip it.
|
||||||
if (IsValidFiringId(timeout->mFiringId)) {
|
if (IsValidFiringId(timeout->mFiringId)) {
|
||||||
MOZ_LOG(gTimeoutLog, LogLevel::Debug,
|
MOZ_LOG(gTimeoutLog, LogLevel::Debug,
|
||||||
("Skipping Run%s(TimeoutManager=%p, timeout=%p) since "
|
("Skipping Run%s(TimeoutManager=%p, timeout=%p) since "
|
||||||
"firingId %d is valid (processing firingId %d)",
|
"firingId %d is valid (processing firingId %d) - "
|
||||||
|
"FiringIndex %" PRId64 " (mLastFiringIndex %" PRId64 ")",
|
||||||
timeout->mIsInterval ? "Interval" : "Timeout", this,
|
timeout->mIsInterval ? "Interval" : "Timeout", this,
|
||||||
timeout.get(), timeout->mFiringId, firingId));
|
timeout.get(), timeout->mFiringId, firingId,
|
||||||
|
timeout->mFiringIndex, mFiringIndex));
|
||||||
|
#ifdef MOZ_DIAGNOSTIC_ASSERT_ENABLED
|
||||||
|
// The old FiringIndex assumed no recursion; recursion can cause
|
||||||
|
// other timers to get fired "in the middle" of a sequence we've
|
||||||
|
// already assigned firingindexes to. Since we're not going to
|
||||||
|
// run this timeout now, remove any FiringIndex that was already
|
||||||
|
// set.
|
||||||
|
|
||||||
|
// Since all timers that have FiringIndexes set *must* be ready
|
||||||
|
// to run and have valid FiringIds, all of them will be 'skipped'
|
||||||
|
// and reset if we recurse - we don't have to look through the
|
||||||
|
// list past where we'll stop on the first InvalidFiringId.
|
||||||
|
timeout->mFiringIndex = -1;
|
||||||
|
#endif
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -899,7 +915,7 @@ void TimeoutManager::RunTimeout(const TimeStamp& aNow,
|
|||||||
// ("Wait until any invocations of this algorithm that had the same
|
// ("Wait until any invocations of this algorithm that had the same
|
||||||
// method context, that started before this one, and whose timeout is
|
// method context, that started before this one, and whose timeout is
|
||||||
// equal to or less than this one's, have completed.").
|
// equal to or less than this one's, have completed.").
|
||||||
#ifdef DEBUG
|
#ifdef MOZ_DIAGNOSTIC_ASSERT_ENABLED
|
||||||
if (timeout->mFiringIndex == -1) {
|
if (timeout->mFiringIndex == -1) {
|
||||||
timeout->mFiringIndex = mFiringIndex++;
|
timeout->mFiringIndex = mFiringIndex++;
|
||||||
}
|
}
|
||||||
@ -939,8 +955,18 @@ void TimeoutManager::RunTimeout(const TimeStamp& aNow,
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef MOZ_DIAGNOSTIC_ASSERT_ENABLED
|
||||||
MOZ_ASSERT(timeout->mFiringIndex > mLastFiringIndex);
|
if (timeout->mFiringIndex <= mLastFiringIndex) {
|
||||||
|
MOZ_LOG(gTimeoutLog, LogLevel::Debug,
|
||||||
|
("Incorrect firing index for Run%s(TimeoutManager=%p, "
|
||||||
|
"timeout=%p) with "
|
||||||
|
"firingId %d - FiringIndex %" PRId64
|
||||||
|
" (mLastFiringIndex %" PRId64 ")",
|
||||||
|
timeout->mIsInterval ? "Interval" : "Timeout", this,
|
||||||
|
timeout.get(), timeout->mFiringId, timeout->mFiringIndex,
|
||||||
|
mFiringIndex));
|
||||||
|
}
|
||||||
|
MOZ_DIAGNOSTIC_ASSERT(timeout->mFiringIndex > mLastFiringIndex);
|
||||||
mLastFiringIndex = timeout->mFiringIndex;
|
mLastFiringIndex = timeout->mFiringIndex;
|
||||||
#endif
|
#endif
|
||||||
// This timeout is good to run
|
// This timeout is good to run
|
||||||
@ -1068,7 +1094,7 @@ bool TimeoutManager::RescheduleTimeout(Timeout* aTimeout,
|
|||||||
TimeStamp firingTime = aLastCallbackTime + nextInterval;
|
TimeStamp firingTime = aLastCallbackTime + nextInterval;
|
||||||
TimeDuration delay = firingTime - aCurrentNow;
|
TimeDuration delay = firingTime - aCurrentNow;
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef MOZ_DIAGNOSTIC_ASSERT_ENABLED
|
||||||
aTimeout->mFiringIndex = -1;
|
aTimeout->mFiringIndex = -1;
|
||||||
#endif
|
#endif
|
||||||
// And make sure delay is nonnegative; that might happen if the timer
|
// And make sure delay is nonnegative; that might happen if the timer
|
||||||
|
@ -203,7 +203,7 @@ class TimeoutManager final {
|
|||||||
Timeouts mTimeouts;
|
Timeouts mTimeouts;
|
||||||
uint32_t mTimeoutIdCounter;
|
uint32_t mTimeoutIdCounter;
|
||||||
uint32_t mNextFiringId;
|
uint32_t mNextFiringId;
|
||||||
#ifdef DEBUG
|
#ifdef MOZ_DIAGNOSTIC_ASSERT_ENABLED
|
||||||
int64_t mFiringIndex;
|
int64_t mFiringIndex;
|
||||||
int64_t mLastFiringIndex;
|
int64_t mLastFiringIndex;
|
||||||
#endif
|
#endif
|
||||||
|
@ -17,7 +17,6 @@
|
|||||||
#include "mozilla/dom/MediaSource.h"
|
#include "mozilla/dom/MediaSource.h"
|
||||||
#include "mozilla/ipc/IPCStreamUtils.h"
|
#include "mozilla/ipc/IPCStreamUtils.h"
|
||||||
#include "mozilla/LoadInfo.h"
|
#include "mozilla/LoadInfo.h"
|
||||||
#include "mozilla/ModuleUtils.h"
|
|
||||||
#include "mozilla/NullPrincipal.h"
|
#include "mozilla/NullPrincipal.h"
|
||||||
#include "mozilla/Preferences.h"
|
#include "mozilla/Preferences.h"
|
||||||
#include "mozilla/SystemGroup.h"
|
#include "mozilla/SystemGroup.h"
|
||||||
@ -903,33 +902,6 @@ nsresult NS_GetSourceForMediaSourceURI(nsIURI* aURI, MediaSource** aSource) {
|
|||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
namespace dom {
|
namespace dom {
|
||||||
|
|
||||||
#define NS_BLOBPROTOCOLHANDLER_CID \
|
|
||||||
{ \
|
|
||||||
0xb43964aa, 0xa078, 0x44b2, { \
|
|
||||||
0xb0, 0x6b, 0xfd, 0x4d, 0x1b, 0x17, 0x2e, 0x66 \
|
|
||||||
} \
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_GENERIC_FACTORY_CONSTRUCTOR(BlobURLProtocolHandler)
|
|
||||||
|
|
||||||
NS_DEFINE_NAMED_CID(NS_BLOBPROTOCOLHANDLER_CID);
|
|
||||||
|
|
||||||
static const Module::CIDEntry kBlobURLProtocolHandlerCIDs[] = {
|
|
||||||
{&kNS_BLOBPROTOCOLHANDLER_CID, false, nullptr,
|
|
||||||
BlobURLProtocolHandlerConstructor},
|
|
||||||
{nullptr}};
|
|
||||||
|
|
||||||
static const Module::ContractIDEntry kBlobURLProtocolHandlerContracts[] = {
|
|
||||||
{NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX BLOBURI_SCHEME,
|
|
||||||
&kNS_BLOBPROTOCOLHANDLER_CID},
|
|
||||||
{nullptr}};
|
|
||||||
|
|
||||||
static const Module kBlobURLProtocolHandlerModule = {
|
|
||||||
Module::kVersion, kBlobURLProtocolHandlerCIDs,
|
|
||||||
kBlobURLProtocolHandlerContracts};
|
|
||||||
|
|
||||||
NSMODULE_DEFN(BlobURLProtocolHandler) = &kBlobURLProtocolHandlerModule;
|
|
||||||
|
|
||||||
bool IsType(nsIURI* aUri, DataInfo::ObjectType aType) {
|
bool IsType(nsIURI* aUri, DataInfo::ObjectType aType) {
|
||||||
DataInfo* info = GetDataInfoFromURI(aUri);
|
DataInfo* info = GetDataInfoFromURI(aUri);
|
||||||
if (!info) {
|
if (!info) {
|
||||||
|
@ -5,8 +5,10 @@
|
|||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
#include "FontTableURIProtocolHandler.h"
|
#include "FontTableURIProtocolHandler.h"
|
||||||
#include "mozilla/ModuleUtils.h"
|
#include "nsIURIMutator.h"
|
||||||
|
#include "nsIUUIDGenerator.h"
|
||||||
#include "nsNetUtil.h"
|
#include "nsNetUtil.h"
|
||||||
|
#include "nsSimpleURI.h"
|
||||||
|
|
||||||
using namespace mozilla;
|
using namespace mozilla;
|
||||||
using namespace mozilla::dom;
|
using namespace mozilla::dom;
|
||||||
@ -107,31 +109,3 @@ FontTableURIProtocolHandler::NewURI(const nsACString &aSpec,
|
|||||||
uri.forget(aResult);
|
uri.forget(aResult);
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define NS_FONTTABLEPROTOCOLHANDLER_CID \
|
|
||||||
{ \
|
|
||||||
0x3fc8f04e, 0xd719, 0x43ca, { \
|
|
||||||
0x9a, 0xd0, 0x18, 0xee, 0x32, 0x02, 0x11, 0xf2 \
|
|
||||||
} \
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_GENERIC_FACTORY_CONSTRUCTOR(FontTableURIProtocolHandler)
|
|
||||||
|
|
||||||
NS_DEFINE_NAMED_CID(NS_FONTTABLEPROTOCOLHANDLER_CID);
|
|
||||||
|
|
||||||
static const mozilla::Module::CIDEntry FontTableURIProtocolHandlerCIDs[] = {
|
|
||||||
{&kNS_FONTTABLEPROTOCOLHANDLER_CID, false, nullptr,
|
|
||||||
FontTableURIProtocolHandlerConstructor},
|
|
||||||
{nullptr}};
|
|
||||||
|
|
||||||
static const mozilla::Module::ContractIDEntry
|
|
||||||
FontTableURIProtocolHandlerContracts[] = {
|
|
||||||
{NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX FONTTABLEURI_SCHEME,
|
|
||||||
&kNS_FONTTABLEPROTOCOLHANDLER_CID},
|
|
||||||
{nullptr}};
|
|
||||||
|
|
||||||
static const mozilla::Module FontTableURIProtocolHandlerModule = {
|
|
||||||
mozilla::Module::kVersion, FontTableURIProtocolHandlerCIDs,
|
|
||||||
FontTableURIProtocolHandlerContracts};
|
|
||||||
|
|
||||||
NSMODULE_DEFN(FontTableURIProtocolHandler) = &FontTableURIProtocolHandlerModule;
|
|
||||||
|
20
dom/file/uri/components.conf
Normal file
20
dom/file/uri/components.conf
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
# -*- 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/.
|
||||||
|
|
||||||
|
Classes = [
|
||||||
|
{
|
||||||
|
'cid': '{3fc8f04e-d719-43ca-9ad0-18ee320211f2}',
|
||||||
|
'contract_ids': ['@mozilla.org/network/protocol;1?name=moz-fonttable'],
|
||||||
|
'type': 'mozilla::dom::FontTableURIProtocolHandler',
|
||||||
|
'headers': ['mozilla/dom/FontTableURIProtocolHandler.h'],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'cid': '{b43964aa-a078-44b2-b06b-fd4d1b172e66}',
|
||||||
|
'contract_ids': ['@mozilla.org/network/protocol;1?name=blob'],
|
||||||
|
'type': 'mozilla::dom::BlobURLProtocolHandler',
|
||||||
|
'headers': ['mozilla/dom/BlobURLProtocolHandler.h'],
|
||||||
|
},
|
||||||
|
]
|
@ -20,6 +20,10 @@ UNIFIED_SOURCES += [
|
|||||||
'FontTableURIProtocolHandler.cpp',
|
'FontTableURIProtocolHandler.cpp',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
XPCOM_MANIFESTS += [
|
||||||
|
'components.conf',
|
||||||
|
]
|
||||||
|
|
||||||
LOCAL_INCLUDES += [
|
LOCAL_INCLUDES += [
|
||||||
'/dom/file',
|
'/dom/file',
|
||||||
'/netwerk/base',
|
'/netwerk/base',
|
||||||
|
@ -38,10 +38,13 @@ if CONFIG['MOZ_WEBSPEECH']:
|
|||||||
|
|
||||||
if CONFIG['MOZ_WEBSPEECH_TEST_BACKEND']:
|
if CONFIG['MOZ_WEBSPEECH_TEST_BACKEND']:
|
||||||
UNIFIED_SOURCES += [
|
UNIFIED_SOURCES += [
|
||||||
'test/FakeSynthModule.cpp',
|
|
||||||
'test/nsFakeSynthServices.cpp'
|
'test/nsFakeSynthServices.cpp'
|
||||||
]
|
]
|
||||||
|
|
||||||
|
XPCOM_MANIFESTS += [
|
||||||
|
'test/components.conf',
|
||||||
|
]
|
||||||
|
|
||||||
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows':
|
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows':
|
||||||
DIRS += ['windows']
|
DIRS += ['windows']
|
||||||
|
|
||||||
|
@ -1,54 +0,0 @@
|
|||||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
||||||
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
|
||||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
||||||
|
|
||||||
#include "mozilla/ModuleUtils.h"
|
|
||||||
#include "nsIClassInfoImpl.h"
|
|
||||||
#include "SpeechDispatcherService.h"
|
|
||||||
|
|
||||||
using namespace mozilla::dom;
|
|
||||||
|
|
||||||
#define SPEECHDISPATCHERSERVICE_CID \
|
|
||||||
{ \
|
|
||||||
0x8817b1cf, 0x5ada, 0x43bf, { \
|
|
||||||
0xbd, 0x73, 0x60, 0x76, 0x57, 0x70, 0x3d, 0x0d \
|
|
||||||
} \
|
|
||||||
}
|
|
||||||
|
|
||||||
#define SPEECHDISPATCHERSERVICE_CONTRACTID \
|
|
||||||
"@mozilla.org/synthspeechdispatcher;1"
|
|
||||||
|
|
||||||
// Defines SpeechDispatcherServiceConstructor
|
|
||||||
NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(
|
|
||||||
SpeechDispatcherService, SpeechDispatcherService::GetInstanceForService)
|
|
||||||
|
|
||||||
// Defines kSPEECHDISPATCHERSERVICE_CID
|
|
||||||
NS_DEFINE_NAMED_CID(SPEECHDISPATCHERSERVICE_CID);
|
|
||||||
|
|
||||||
static const mozilla::Module::CIDEntry kCIDs[] = {
|
|
||||||
{&kSPEECHDISPATCHERSERVICE_CID, true, nullptr,
|
|
||||||
SpeechDispatcherServiceConstructor},
|
|
||||||
{nullptr}};
|
|
||||||
|
|
||||||
static const mozilla::Module::ContractIDEntry kContracts[] = {
|
|
||||||
{SPEECHDISPATCHERSERVICE_CONTRACTID, &kSPEECHDISPATCHERSERVICE_CID},
|
|
||||||
{nullptr}};
|
|
||||||
|
|
||||||
static const mozilla::Module::CategoryEntry kCategories[] = {
|
|
||||||
{"speech-synth-started", "SpeechDispatcher Speech Synth",
|
|
||||||
SPEECHDISPATCHERSERVICE_CONTRACTID},
|
|
||||||
{nullptr}};
|
|
||||||
|
|
||||||
static const mozilla::Module kModule = {
|
|
||||||
mozilla::Module::kVersion,
|
|
||||||
kCIDs,
|
|
||||||
kContracts,
|
|
||||||
kCategories,
|
|
||||||
nullptr,
|
|
||||||
nullptr,
|
|
||||||
nullptr,
|
|
||||||
};
|
|
||||||
|
|
||||||
NSMODULE_DEFN(synthspeechdispatcher) = &kModule;
|
|
17
dom/media/webspeech/synth/speechd/components.conf
Normal file
17
dom/media/webspeech/synth/speechd/components.conf
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
# -*- 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/.
|
||||||
|
|
||||||
|
Classes = [
|
||||||
|
{
|
||||||
|
'cid': '{8817b1cf-5ada-43bf-bd73-607657703d0d}',
|
||||||
|
'contract_ids': ['@mozilla.org/synthspeechdispatcher;1'],
|
||||||
|
'singleton': True,
|
||||||
|
'type': 'mozilla::dom::SpeechDispatcherService',
|
||||||
|
'headers': ['/dom/media/webspeech/synth/speechd/SpeechDispatcherService.h'],
|
||||||
|
'constructor': 'mozilla::dom::SpeechDispatcherService::GetInstanceForService',
|
||||||
|
'categories': {"speech-synth-started": 'SpeechDispatcher Speech Synth'},
|
||||||
|
},
|
||||||
|
]
|
@ -5,9 +5,13 @@
|
|||||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
|
|
||||||
UNIFIED_SOURCES += [
|
UNIFIED_SOURCES += [
|
||||||
'SpeechDispatcherModule.cpp',
|
|
||||||
'SpeechDispatcherService.cpp'
|
'SpeechDispatcherService.cpp'
|
||||||
]
|
]
|
||||||
|
|
||||||
|
XPCOM_MANIFESTS += [
|
||||||
|
'components.conf',
|
||||||
|
]
|
||||||
|
|
||||||
include('/ipc/chromium/chromium-config.mozbuild')
|
include('/ipc/chromium/chromium-config.mozbuild')
|
||||||
|
|
||||||
FINAL_LIBRARY = 'xul'
|
FINAL_LIBRARY = 'xul'
|
||||||
|
@ -1,45 +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 "mozilla/ModuleUtils.h"
|
|
||||||
#include "nsIClassInfoImpl.h"
|
|
||||||
|
|
||||||
#include "nsFakeSynthServices.h"
|
|
||||||
|
|
||||||
using namespace mozilla::dom;
|
|
||||||
|
|
||||||
#define FAKESYNTHSERVICE_CID \
|
|
||||||
{ \
|
|
||||||
0xe7d52d9e, 0xc148, 0x47d8, { \
|
|
||||||
0xab, 0x2a, 0x95, 0xd7, 0xf4, 0x0e, 0xa5, 0x3d \
|
|
||||||
} \
|
|
||||||
}
|
|
||||||
|
|
||||||
#define FAKESYNTHSERVICE_CONTRACTID "@mozilla.org/fakesynth;1"
|
|
||||||
|
|
||||||
// Defines nsFakeSynthServicesConstructor
|
|
||||||
NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(
|
|
||||||
nsFakeSynthServices, nsFakeSynthServices::GetInstanceForService)
|
|
||||||
|
|
||||||
// Defines kFAKESYNTHSERVICE_CID
|
|
||||||
NS_DEFINE_NAMED_CID(FAKESYNTHSERVICE_CID);
|
|
||||||
|
|
||||||
static const mozilla::Module::CIDEntry kCIDs[] = {
|
|
||||||
{&kFAKESYNTHSERVICE_CID, true, nullptr, nsFakeSynthServicesConstructor},
|
|
||||||
{nullptr}};
|
|
||||||
|
|
||||||
static const mozilla::Module::ContractIDEntry kContracts[] = {
|
|
||||||
{FAKESYNTHSERVICE_CONTRACTID, &kFAKESYNTHSERVICE_CID}, {nullptr}};
|
|
||||||
|
|
||||||
static const mozilla::Module::CategoryEntry kCategories[] = {
|
|
||||||
{"speech-synth-started", "Fake Speech Synth", FAKESYNTHSERVICE_CONTRACTID},
|
|
||||||
{nullptr}};
|
|
||||||
|
|
||||||
static void UnloadFakeSynthmodule() { nsFakeSynthServices::Shutdown(); }
|
|
||||||
|
|
||||||
static const mozilla::Module kModule = {
|
|
||||||
mozilla::Module::kVersion, kCIDs, kContracts, kCategories, nullptr, nullptr,
|
|
||||||
UnloadFakeSynthmodule};
|
|
||||||
|
|
||||||
NSMODULE_DEFN(fakesynth) = &kModule;
|
|
17
dom/media/webspeech/synth/test/components.conf
Normal file
17
dom/media/webspeech/synth/test/components.conf
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
# -*- 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/.
|
||||||
|
|
||||||
|
Classes = [
|
||||||
|
{
|
||||||
|
'cid': '{e7d52d9e-c148-47d8-ab2a-95d7f40ea53d}',
|
||||||
|
'contract_ids': ['@mozilla.org/fakesynth;1'],
|
||||||
|
'singleton': True,
|
||||||
|
'type': 'mozilla::dom::nsFakeSynthServices',
|
||||||
|
'headers': ['/dom/media/webspeech/synth/test/nsFakeSynthServices.h'],
|
||||||
|
'constructor': 'mozilla::dom::nsFakeSynthServices::GetInstanceForService',
|
||||||
|
'categories': {'speech-synth-started': 'Fake Speech Synth'},
|
||||||
|
},
|
||||||
|
]
|
@ -10,6 +10,7 @@
|
|||||||
#include "SharedBuffer.h"
|
#include "SharedBuffer.h"
|
||||||
#include "nsISimpleEnumerator.h"
|
#include "nsISimpleEnumerator.h"
|
||||||
|
|
||||||
|
#include "mozilla/ClearOnShutdown.h"
|
||||||
#include "mozilla/dom/nsSynthVoiceRegistry.h"
|
#include "mozilla/dom/nsSynthVoiceRegistry.h"
|
||||||
#include "mozilla/dom/nsSpeechTask.h"
|
#include "mozilla/dom/nsSpeechTask.h"
|
||||||
|
|
||||||
@ -273,6 +274,7 @@ nsFakeSynthServices* nsFakeSynthServices::GetInstance() {
|
|||||||
|
|
||||||
if (!sSingleton) {
|
if (!sSingleton) {
|
||||||
sSingleton = new nsFakeSynthServices();
|
sSingleton = new nsFakeSynthServices();
|
||||||
|
ClearOnShutdown(&sSingleton);
|
||||||
}
|
}
|
||||||
|
|
||||||
return sSingleton;
|
return sSingleton;
|
||||||
@ -284,13 +286,5 @@ nsFakeSynthServices::GetInstanceForService() {
|
|||||||
return picoService.forget();
|
return picoService.forget();
|
||||||
}
|
}
|
||||||
|
|
||||||
void nsFakeSynthServices::Shutdown() {
|
|
||||||
if (!sSingleton) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
sSingleton = nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace dom
|
} // namespace dom
|
||||||
} // namespace mozilla
|
} // namespace mozilla
|
||||||
|
@ -29,8 +29,6 @@ class nsFakeSynthServices : public nsIObserver {
|
|||||||
|
|
||||||
static already_AddRefed<nsFakeSynthServices> GetInstanceForService();
|
static already_AddRefed<nsFakeSynthServices> GetInstanceForService();
|
||||||
|
|
||||||
static void Shutdown();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
virtual ~nsFakeSynthServices() = default;
|
virtual ~nsFakeSynthServices() = default;
|
||||||
|
|
||||||
|
16
dom/plugins/base/components.conf
Normal file
16
dom/plugins/base/components.conf
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
# -*- 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/.
|
||||||
|
|
||||||
|
Classes = [
|
||||||
|
{
|
||||||
|
'cid': '{23e8fd98-a625-4b08-be1a-f7cc18a5b106}',
|
||||||
|
'contract_ids': ['@mozilla.org/plugin/host;1'],
|
||||||
|
'singleton': True,
|
||||||
|
'type': 'nsPluginHost',
|
||||||
|
'headers': ['nsPluginHost.h'],
|
||||||
|
'constructor': 'nsPluginHost::GetInst',
|
||||||
|
},
|
||||||
|
]
|
@ -38,7 +38,6 @@ UNIFIED_SOURCES += [
|
|||||||
'nsNPAPIPluginInstance.cpp',
|
'nsNPAPIPluginInstance.cpp',
|
||||||
'nsNPAPIPluginStreamListener.cpp',
|
'nsNPAPIPluginStreamListener.cpp',
|
||||||
'nsPluginInstanceOwner.cpp',
|
'nsPluginInstanceOwner.cpp',
|
||||||
'nsPluginModule.cpp',
|
|
||||||
'nsPluginStreamListenerPeer.cpp',
|
'nsPluginStreamListenerPeer.cpp',
|
||||||
'nsPluginTags.cpp',
|
'nsPluginTags.cpp',
|
||||||
]
|
]
|
||||||
@ -67,6 +66,10 @@ else:
|
|||||||
'nsPluginsDirUnix.cpp',
|
'nsPluginsDirUnix.cpp',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
XPCOM_MANIFESTS += [
|
||||||
|
'components.conf',
|
||||||
|
]
|
||||||
|
|
||||||
LOCAL_INCLUDES += [
|
LOCAL_INCLUDES += [
|
||||||
'/dom/base',
|
'/dom/base',
|
||||||
'/dom/plugins/ipc',
|
'/dom/plugins/ipc',
|
||||||
|
@ -1,22 +0,0 @@
|
|||||||
/* -*- Mode: C++; 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 "mozilla/ModuleUtils.h"
|
|
||||||
#include "nsPluginHost.h"
|
|
||||||
#include "nsPluginsCID.h"
|
|
||||||
|
|
||||||
NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsPluginHost, nsPluginHost::GetInst)
|
|
||||||
NS_DEFINE_NAMED_CID(NS_PLUGIN_HOST_CID);
|
|
||||||
|
|
||||||
static const mozilla::Module::CIDEntry kPluginCIDs[] = {
|
|
||||||
{&kNS_PLUGIN_HOST_CID, false, nullptr, nsPluginHostConstructor}, {nullptr}};
|
|
||||||
|
|
||||||
static const mozilla::Module::ContractIDEntry kPluginContracts[] = {
|
|
||||||
{MOZ_PLUGIN_HOST_CONTRACTID, &kNS_PLUGIN_HOST_CID}, {nullptr}};
|
|
||||||
|
|
||||||
static const mozilla::Module kPluginModule = {mozilla::Module::kVersion,
|
|
||||||
kPluginCIDs, kPluginContracts};
|
|
||||||
|
|
||||||
NSMODULE_DEFN(nsPluginModule) = &kPluginModule;
|
|
@ -1,49 +0,0 @@
|
|||||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
||||||
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
|
||||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
||||||
|
|
||||||
#include "MulticastDNSDeviceProvider.h"
|
|
||||||
#include "mozilla/ModuleUtils.h"
|
|
||||||
|
|
||||||
#define MULTICAST_DNS_PROVIDER_CID \
|
|
||||||
{ \
|
|
||||||
0x814f947a, 0x52f7, 0x41c9, { \
|
|
||||||
0x94, 0xa1, 0x36, 0x84, 0x79, 0x72, 0x84, 0xac \
|
|
||||||
} \
|
|
||||||
}
|
|
||||||
|
|
||||||
#define MULTICAST_DNS_PROVIDER_CONTRACT_ID \
|
|
||||||
"@mozilla.org/presentation-device/multicastdns-provider;1"
|
|
||||||
|
|
||||||
using mozilla::dom::presentation::MulticastDNSDeviceProvider;
|
|
||||||
|
|
||||||
NS_GENERIC_FACTORY_CONSTRUCTOR(MulticastDNSDeviceProvider)
|
|
||||||
NS_DEFINE_NAMED_CID(MULTICAST_DNS_PROVIDER_CID);
|
|
||||||
|
|
||||||
static const mozilla::Module::CIDEntry kPresentationDeviceProviderCIDs[] = {
|
|
||||||
{&kMULTICAST_DNS_PROVIDER_CID, false, nullptr,
|
|
||||||
MulticastDNSDeviceProviderConstructor},
|
|
||||||
{nullptr}};
|
|
||||||
|
|
||||||
static const mozilla::Module::ContractIDEntry
|
|
||||||
kPresentationDeviceProviderContracts[] = {
|
|
||||||
{MULTICAST_DNS_PROVIDER_CONTRACT_ID, &kMULTICAST_DNS_PROVIDER_CID},
|
|
||||||
{nullptr}};
|
|
||||||
|
|
||||||
static const mozilla::Module::CategoryEntry
|
|
||||||
kPresentationDeviceProviderCategories[] = {
|
|
||||||
#if defined(MOZ_WIDGET_COCOA) || defined(MOZ_WIDGET_ANDROID)
|
|
||||||
{PRESENTATION_DEVICE_PROVIDER_CATEGORY, "MulticastDNSDeviceProvider",
|
|
||||||
MULTICAST_DNS_PROVIDER_CONTRACT_ID},
|
|
||||||
#endif
|
|
||||||
{nullptr}};
|
|
||||||
|
|
||||||
static const mozilla::Module kPresentationDeviceProviderModule = {
|
|
||||||
mozilla::Module::kVersion, kPresentationDeviceProviderCIDs,
|
|
||||||
kPresentationDeviceProviderContracts,
|
|
||||||
kPresentationDeviceProviderCategories};
|
|
||||||
|
|
||||||
NSMODULE_DEFN(PresentationDeviceProviderModule) =
|
|
||||||
&kPresentationDeviceProviderModule;
|
|
@ -4,6 +4,11 @@
|
|||||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
# 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/.
|
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
|
|
||||||
|
categories = {}
|
||||||
|
|
||||||
|
if buildconfig.substs['MOZ_WIDGET_TOOLKIT'] in ('cocoa', 'android'):
|
||||||
|
categories["presentation-device-provider"] = "MulticastDNSDeviceProvider"
|
||||||
|
|
||||||
Classes = [
|
Classes = [
|
||||||
{
|
{
|
||||||
'cid': '{f4079b8b-ede5-4b90-a112-5b415a931deb}',
|
'cid': '{f4079b8b-ede5-4b90-a112-5b415a931deb}',
|
||||||
@ -11,6 +16,13 @@ Classes = [
|
|||||||
'jsm': 'resource://gre/modules/PresentationControlService.jsm',
|
'jsm': 'resource://gre/modules/PresentationControlService.jsm',
|
||||||
'constructor': 'PresentationControlService',
|
'constructor': 'PresentationControlService',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
'cid': '{814f947a-52f7-41c9-94a1-3684797284ac}',
|
||||||
|
'contract_ids': ['@mozilla.org/presentation-device/multicastdns-provider;1'],
|
||||||
|
'type': 'mozilla::dom::presentation::MulticastDNSDeviceProvider',
|
||||||
|
'headers': ['/dom/presentation/provider/MulticastDNSDeviceProvider.h'],
|
||||||
|
'categories': categories,
|
||||||
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
if buildconfig.substs['MOZ_WIDGET_TOOLKIT'] == 'android':
|
if buildconfig.substs['MOZ_WIDGET_TOOLKIT'] == 'android':
|
||||||
|
@ -11,7 +11,10 @@ EXTRA_JS_MODULES += [
|
|||||||
UNIFIED_SOURCES += [
|
UNIFIED_SOURCES += [
|
||||||
'DeviceProviderHelpers.cpp',
|
'DeviceProviderHelpers.cpp',
|
||||||
'MulticastDNSDeviceProvider.cpp',
|
'MulticastDNSDeviceProvider.cpp',
|
||||||
'PresentationDeviceProviderModule.cpp',
|
]
|
||||||
|
|
||||||
|
XPCOM_MANIFESTS += [
|
||||||
|
'components.conf',
|
||||||
]
|
]
|
||||||
|
|
||||||
XPCOM_MANIFESTS += [
|
XPCOM_MANIFESTS += [
|
||||||
|
22
extensions/cookie/components.conf
Normal file
22
extensions/cookie/components.conf
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
# -*- 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/.
|
||||||
|
|
||||||
|
Headers = [
|
||||||
|
'/extensions/cookie/nsCookieModule.h',
|
||||||
|
]
|
||||||
|
|
||||||
|
UnloadFunc = 'mozilla::CookieModuleDtor'
|
||||||
|
|
||||||
|
Classes = [
|
||||||
|
{
|
||||||
|
'cid': '{4f6b5e00-0c36-11d5-a535-0010a401eb10}',
|
||||||
|
'contract_ids': ['@mozilla.org/permissionmanager;1'],
|
||||||
|
'singleton': True,
|
||||||
|
'type': 'nsIPermissionManager',
|
||||||
|
'constructor': 'nsPermissionManager::GetXPCOMSingleton',
|
||||||
|
'headers': ['/extensions/cookie/nsPermissionManager.h'],
|
||||||
|
},
|
||||||
|
]
|
@ -17,6 +17,10 @@ UNIFIED_SOURCES += [
|
|||||||
'nsPermissionManager.cpp',
|
'nsPermissionManager.cpp',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
XPCOM_MANIFESTS += [
|
||||||
|
'components.conf',
|
||||||
|
]
|
||||||
|
|
||||||
LOCAL_INCLUDES += [
|
LOCAL_INCLUDES += [
|
||||||
'/caps',
|
'/caps',
|
||||||
]
|
]
|
||||||
|
@ -3,35 +3,10 @@
|
|||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* 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/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
#include "mozilla/ModuleUtils.h"
|
|
||||||
#include "nsIServiceManager.h"
|
|
||||||
#include "nsPermissionManager.h"
|
|
||||||
#include "nsICategoryManager.h"
|
|
||||||
#include "nsCookiePermission.h"
|
#include "nsCookiePermission.h"
|
||||||
#include "nsString.h"
|
|
||||||
|
|
||||||
// Define the constructor function for the objects
|
namespace mozilla {
|
||||||
NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsIPermissionManager,
|
|
||||||
nsPermissionManager::GetXPCOMSingleton)
|
|
||||||
|
|
||||||
NS_DEFINE_NAMED_CID(NS_PERMISSIONMANAGER_CID);
|
void CookieModuleDtor() { nsCookiePermission::Shutdown(); }
|
||||||
|
|
||||||
static const mozilla::Module::CIDEntry kCookieCIDs[] = {
|
} // namespace mozilla
|
||||||
{&kNS_PERMISSIONMANAGER_CID, false, nullptr,
|
|
||||||
nsIPermissionManagerConstructor},
|
|
||||||
{nullptr}};
|
|
||||||
|
|
||||||
static const mozilla::Module::ContractIDEntry kCookieContracts[] = {
|
|
||||||
{NS_PERMISSIONMANAGER_CONTRACTID, &kNS_PERMISSIONMANAGER_CID}, {nullptr}};
|
|
||||||
|
|
||||||
static void CookieModuleDtor() { nsCookiePermission::Shutdown(); }
|
|
||||||
|
|
||||||
static const mozilla::Module kCookieModule = {mozilla::Module::kVersion,
|
|
||||||
kCookieCIDs,
|
|
||||||
kCookieContracts,
|
|
||||||
nullptr,
|
|
||||||
nullptr,
|
|
||||||
nullptr,
|
|
||||||
CookieModuleDtor};
|
|
||||||
|
|
||||||
NSMODULE_DEFN(nsCookieModule) = &kCookieModule;
|
|
||||||
|
19
extensions/cookie/nsCookieModule.h
Normal file
19
extensions/cookie/nsCookieModule.h
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||||
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
||||||
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
|
#ifndef nsCookieModule_h
|
||||||
|
#define nsCookieModule_h
|
||||||
|
|
||||||
|
#include "nscore.h"
|
||||||
|
|
||||||
|
namespace mozilla {
|
||||||
|
|
||||||
|
void CookieModuleDtor();
|
||||||
|
|
||||||
|
} // namespace mozilla
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
16
extensions/permissions/components.conf
Normal file
16
extensions/permissions/components.conf
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
# -*- 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/.
|
||||||
|
|
||||||
|
Classes = [
|
||||||
|
{
|
||||||
|
'cid': '{4ca6b67b-5cc7-4e71-a98a-97af1c134862}',
|
||||||
|
'contract_ids': ['@mozilla.org/permissions/contentblocker;1'],
|
||||||
|
'type': 'nsContentBlocker',
|
||||||
|
'headers': ['/extensions/permissions/nsContentBlocker.h'],
|
||||||
|
'init_method': 'Init',
|
||||||
|
'categories': {'content-policy': '@mozilla.org/permissions/contentblocker;1'},
|
||||||
|
},
|
||||||
|
]
|
@ -6,7 +6,10 @@
|
|||||||
|
|
||||||
UNIFIED_SOURCES += [
|
UNIFIED_SOURCES += [
|
||||||
'nsContentBlocker.cpp',
|
'nsContentBlocker.cpp',
|
||||||
'nsModuleFactory.cpp',
|
]
|
||||||
|
|
||||||
|
XPCOM_MANIFESTS += [
|
||||||
|
'components.conf',
|
||||||
]
|
]
|
||||||
|
|
||||||
FINAL_LIBRARY = 'xul'
|
FINAL_LIBRARY = 'xul'
|
||||||
|
@ -1,31 +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 "mozilla/ModuleUtils.h"
|
|
||||||
#include "nsIServiceManager.h"
|
|
||||||
#include "nsContentBlocker.h"
|
|
||||||
#include "nsString.h"
|
|
||||||
|
|
||||||
// Define the constructor function for the objects
|
|
||||||
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsContentBlocker, Init)
|
|
||||||
|
|
||||||
NS_DEFINE_NAMED_CID(NS_CONTENTBLOCKER_CID);
|
|
||||||
|
|
||||||
static const mozilla::Module::CIDEntry kPermissionsCIDs[] = {
|
|
||||||
{&kNS_CONTENTBLOCKER_CID, false, nullptr, nsContentBlockerConstructor},
|
|
||||||
{nullptr}};
|
|
||||||
|
|
||||||
static const mozilla::Module::ContractIDEntry kPermissionsContracts[] = {
|
|
||||||
{NS_CONTENTBLOCKER_CONTRACTID, &kNS_CONTENTBLOCKER_CID}, {nullptr}};
|
|
||||||
|
|
||||||
static const mozilla::Module::CategoryEntry kPermissionsCategories[] = {
|
|
||||||
{"content-policy", NS_CONTENTBLOCKER_CONTRACTID,
|
|
||||||
NS_CONTENTBLOCKER_CONTRACTID},
|
|
||||||
{nullptr}};
|
|
||||||
|
|
||||||
static const mozilla::Module kPermissionsModule = {
|
|
||||||
mozilla::Module::kVersion, kPermissionsCIDs, kPermissionsContracts,
|
|
||||||
kPermissionsCategories};
|
|
||||||
|
|
||||||
NSMODULE_DEFN(nsPermissionsModule) = &kPermissionsModule;
|
|
16
extensions/pref/autoconfig/src/components.conf
Normal file
16
extensions/pref/autoconfig/src/components.conf
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
# -*- 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/.
|
||||||
|
|
||||||
|
Classes = [
|
||||||
|
{
|
||||||
|
'cid': '{ba5bc4c6-1dd1-11b2-bb89-b844c6ec0339}',
|
||||||
|
'contract_ids': ['@mozilla.org/readconfig;1'],
|
||||||
|
'type': 'nsReadConfig',
|
||||||
|
'headers': ['/extensions/pref/autoconfig/src/nsReadConfig.h'],
|
||||||
|
'init_method': 'Init',
|
||||||
|
'categories': {'pref-config-startup': 'ReadConfig Module'},
|
||||||
|
},
|
||||||
|
]
|
@ -6,11 +6,14 @@
|
|||||||
|
|
||||||
UNIFIED_SOURCES += [
|
UNIFIED_SOURCES += [
|
||||||
'nsAutoConfig.cpp',
|
'nsAutoConfig.cpp',
|
||||||
'nsConfigFactory.cpp',
|
|
||||||
'nsJSConfigTriggers.cpp',
|
'nsJSConfigTriggers.cpp',
|
||||||
'nsReadConfig.cpp',
|
'nsReadConfig.cpp',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
XPCOM_MANIFESTS += [
|
||||||
|
'components.conf',
|
||||||
|
]
|
||||||
|
|
||||||
FINAL_LIBRARY = 'xul'
|
FINAL_LIBRARY = 'xul'
|
||||||
|
|
||||||
FINAL_TARGET_FILES.defaults.autoconfig += [
|
FINAL_TARGET_FILES.defaults.autoconfig += [
|
||||||
|
@ -1,37 +0,0 @@
|
|||||||
/* -*- Mode: C++; 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 "mozilla/ModuleUtils.h"
|
|
||||||
#include "nsReadConfig.h"
|
|
||||||
#include "nsIAppStartupNotifier.h"
|
|
||||||
|
|
||||||
#define NS_READCONFIG_CID \
|
|
||||||
{ \
|
|
||||||
0xba5bc4c6, 0x1dd1, 0x11b2, { \
|
|
||||||
0xbb, 0x89, 0xb8, 0x44, 0xc6, 0xec, 0x03, 0x39 \
|
|
||||||
} \
|
|
||||||
}
|
|
||||||
|
|
||||||
#define NS_READCONFIG_CONTRACTID "@mozilla.org/readconfig;1"
|
|
||||||
|
|
||||||
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsReadConfig, Init)
|
|
||||||
|
|
||||||
NS_DEFINE_NAMED_CID(NS_READCONFIG_CID);
|
|
||||||
|
|
||||||
static const mozilla::Module::CIDEntry kAutoConfigCIDs[] = {
|
|
||||||
{&kNS_READCONFIG_CID, false, nullptr, nsReadConfigConstructor}, {nullptr}};
|
|
||||||
|
|
||||||
static const mozilla::Module::ContractIDEntry kAutoConfigContracts[] = {
|
|
||||||
{NS_READCONFIG_CONTRACTID, &kNS_READCONFIG_CID}, {nullptr}};
|
|
||||||
|
|
||||||
static const mozilla::Module::CategoryEntry kAutoConfigCategories[] = {
|
|
||||||
{"pref-config-startup", "ReadConfig Module", NS_READCONFIG_CONTRACTID},
|
|
||||||
{nullptr}};
|
|
||||||
|
|
||||||
static const mozilla::Module kAutoConfigModule = {
|
|
||||||
mozilla::Module::kVersion, kAutoConfigCIDs, kAutoConfigContracts,
|
|
||||||
kAutoConfigCategories};
|
|
||||||
|
|
||||||
NSMODULE_DEFN(nsAutoConfigModule) = &kAutoConfigModule;
|
|
@ -72,6 +72,7 @@
|
|||||||
#include "nsIPrefBranch.h"
|
#include "nsIPrefBranch.h"
|
||||||
#include "nsNetUtil.h"
|
#include "nsNetUtil.h"
|
||||||
#include "mozilla/dom/ContentParent.h"
|
#include "mozilla/dom/ContentParent.h"
|
||||||
|
#include "mozilla/Components.h"
|
||||||
|
|
||||||
using mozilla::dom::ContentParent;
|
using mozilla::dom::ContentParent;
|
||||||
using namespace mozilla;
|
using namespace mozilla;
|
||||||
@ -90,6 +91,14 @@ NS_INTERFACE_MAP_END
|
|||||||
|
|
||||||
NS_IMPL_CYCLE_COLLECTION(mozHunspell, mPersonalDictionary)
|
NS_IMPL_CYCLE_COLLECTION(mozHunspell, mPersonalDictionary)
|
||||||
|
|
||||||
|
NS_IMPL_COMPONENT_FACTORY(mozHunspell) {
|
||||||
|
auto hunspell = MakeRefPtr<mozHunspell>();
|
||||||
|
if (NS_SUCCEEDED(hunspell->Init())) {
|
||||||
|
return hunspell.forget().downcast<mozISpellCheckingEngine>();
|
||||||
|
}
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
mozilla::CountingAllocatorBase<HunspellAllocator>::AmountType
|
mozilla::CountingAllocatorBase<HunspellAllocator>::AmountType
|
||||||
mozilla::CountingAllocatorBase<HunspellAllocator>::sAmount(0);
|
mozilla::CountingAllocatorBase<HunspellAllocator>::sAmount(0);
|
||||||
|
20
extensions/spellcheck/src/components.conf
Normal file
20
extensions/spellcheck/src/components.conf
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
# -*- 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/.
|
||||||
|
|
||||||
|
Classes = [
|
||||||
|
{
|
||||||
|
'cid': '{56c778e4-1bee-45f3-a689-886692a97fe7}',
|
||||||
|
'contract_ids': ['@mozilla.org/spellchecker/engine;1'],
|
||||||
|
'type': 'mozHunspell',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'cid': '{7ef52eaf-b7e1-462b-87e2-5d1dbaca9048}',
|
||||||
|
'contract_ids': ['@mozilla.org/spellchecker/personaldictionary;1'],
|
||||||
|
'type': 'mozPersonalDictionary',
|
||||||
|
'headers': ['/extensions/spellcheck/src/mozPersonalDictionary.h'],
|
||||||
|
'init_method': 'Init',
|
||||||
|
},
|
||||||
|
]
|
@ -11,7 +11,10 @@ UNIFIED_SOURCES += [
|
|||||||
'mozInlineSpellWordUtil.cpp',
|
'mozInlineSpellWordUtil.cpp',
|
||||||
'mozPersonalDictionary.cpp',
|
'mozPersonalDictionary.cpp',
|
||||||
'mozSpellChecker.cpp',
|
'mozSpellChecker.cpp',
|
||||||
'mozSpellCheckerFactory.cpp',
|
]
|
||||||
|
|
||||||
|
XPCOM_MANIFESTS += [
|
||||||
|
'components.conf',
|
||||||
]
|
]
|
||||||
|
|
||||||
FINAL_LIBRARY = 'xul'
|
FINAL_LIBRARY = 'xul'
|
||||||
|
@ -1,31 +0,0 @@
|
|||||||
/* -*- Mode: C++; tab-width: 4; 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 "mozilla/ModuleUtils.h"
|
|
||||||
#include "mozHunspell.h"
|
|
||||||
#include "mozPersonalDictionary.h"
|
|
||||||
#include "nsIFile.h"
|
|
||||||
|
|
||||||
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(mozHunspell, Init)
|
|
||||||
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(mozPersonalDictionary, Init)
|
|
||||||
|
|
||||||
NS_DEFINE_NAMED_CID(MOZ_HUNSPELL_CID);
|
|
||||||
NS_DEFINE_NAMED_CID(MOZ_PERSONALDICTIONARY_CID);
|
|
||||||
|
|
||||||
static const mozilla::Module::CIDEntry kSpellcheckCIDs[] = {
|
|
||||||
{&kMOZ_HUNSPELL_CID, false, nullptr, mozHunspellConstructor},
|
|
||||||
{&kMOZ_PERSONALDICTIONARY_CID, false, nullptr,
|
|
||||||
mozPersonalDictionaryConstructor},
|
|
||||||
{nullptr}};
|
|
||||||
|
|
||||||
static const mozilla::Module::ContractIDEntry kSpellcheckContracts[] = {
|
|
||||||
{MOZ_HUNSPELL_CONTRACTID, &kMOZ_HUNSPELL_CID},
|
|
||||||
{MOZ_PERSONALDICTIONARY_CONTRACTID, &kMOZ_PERSONALDICTIONARY_CID},
|
|
||||||
{nullptr}};
|
|
||||||
|
|
||||||
const mozilla::Module kSpellcheckModule = {
|
|
||||||
mozilla::Module::kVersion, kSpellcheckCIDs, kSpellcheckContracts, nullptr};
|
|
||||||
|
|
||||||
NSMODULE_DEFN(mozSpellCheckerModule) = &kSpellcheckModule;
|
|
@ -4,6 +4,8 @@
|
|||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* 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/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
|
#include "BufferUnrotate.h"
|
||||||
|
|
||||||
#include <algorithm> // min & max
|
#include <algorithm> // min & max
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
@ -192,14 +192,16 @@ static bool PatternIsCompatible(const Pattern& aPattern) {
|
|||||||
|
|
||||||
static cairo_user_data_key_t surfaceDataKey;
|
static cairo_user_data_key_t surfaceDataKey;
|
||||||
|
|
||||||
void ReleaseData(void* aData) {
|
static void ReleaseData(void* aData) {
|
||||||
DataSourceSurface* data = static_cast<DataSourceSurface*>(aData);
|
DataSourceSurface* data = static_cast<DataSourceSurface*>(aData);
|
||||||
data->Unmap();
|
data->Unmap();
|
||||||
data->Release();
|
data->Release();
|
||||||
}
|
}
|
||||||
|
|
||||||
cairo_surface_t* CopyToImageSurface(unsigned char* aData, const IntRect& aRect,
|
static cairo_surface_t* CopyToImageSurface(unsigned char* aData,
|
||||||
int32_t aStride, SurfaceFormat aFormat) {
|
const IntRect& aRect,
|
||||||
|
int32_t aStride,
|
||||||
|
SurfaceFormat aFormat) {
|
||||||
MOZ_ASSERT(aData);
|
MOZ_ASSERT(aData);
|
||||||
|
|
||||||
auto aRectWidth = aRect.Width();
|
auto aRectWidth = aRect.Width();
|
||||||
@ -236,7 +238,7 @@ cairo_surface_t* CopyToImageSurface(unsigned char* aData, const IntRect& aRect,
|
|||||||
* CAIRO_SURFACE_TYPE_IMAGE then returns that surface. Does
|
* CAIRO_SURFACE_TYPE_IMAGE then returns that surface. Does
|
||||||
* not add a reference.
|
* not add a reference.
|
||||||
*/
|
*/
|
||||||
cairo_surface_t* GetAsImageSurface(cairo_surface_t* aSurface) {
|
static cairo_surface_t* GetAsImageSurface(cairo_surface_t* aSurface) {
|
||||||
if (cairo_surface_get_type(aSurface) == CAIRO_SURFACE_TYPE_IMAGE) {
|
if (cairo_surface_get_type(aSurface) == CAIRO_SURFACE_TYPE_IMAGE) {
|
||||||
return aSurface;
|
return aSurface;
|
||||||
#ifdef CAIRO_HAS_WIN32_SURFACE
|
#ifdef CAIRO_HAS_WIN32_SURFACE
|
||||||
@ -248,9 +250,9 @@ cairo_surface_t* GetAsImageSurface(cairo_surface_t* aSurface) {
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
cairo_surface_t* CreateSubImageForData(unsigned char* aData,
|
static cairo_surface_t* CreateSubImageForData(unsigned char* aData,
|
||||||
const IntRect& aRect, int aStride,
|
const IntRect& aRect, int aStride,
|
||||||
SurfaceFormat aFormat) {
|
SurfaceFormat aFormat) {
|
||||||
if (!aData) {
|
if (!aData) {
|
||||||
gfxWarning() << "DrawTargetCairo.CreateSubImageForData null aData";
|
gfxWarning() << "DrawTargetCairo.CreateSubImageForData null aData";
|
||||||
return nullptr;
|
return nullptr;
|
||||||
@ -269,9 +271,9 @@ cairo_surface_t* CreateSubImageForData(unsigned char* aData,
|
|||||||
* Returns a referenced cairo_surface_t representing the
|
* Returns a referenced cairo_surface_t representing the
|
||||||
* sub-image specified by aSubImage.
|
* sub-image specified by aSubImage.
|
||||||
*/
|
*/
|
||||||
cairo_surface_t* ExtractSubImage(cairo_surface_t* aSurface,
|
static cairo_surface_t* ExtractSubImage(cairo_surface_t* aSurface,
|
||||||
const IntRect& aSubImage,
|
const IntRect& aSubImage,
|
||||||
SurfaceFormat aFormat) {
|
SurfaceFormat aFormat) {
|
||||||
// No need to worry about retaining a reference to the original
|
// No need to worry about retaining a reference to the original
|
||||||
// surface since the only caller of this function guarantees
|
// surface since the only caller of this function guarantees
|
||||||
// that aSurface will stay alive as long as the result
|
// that aSurface will stay alive as long as the result
|
||||||
@ -305,7 +307,7 @@ cairo_surface_t* ExtractSubImage(cairo_surface_t* aSurface,
|
|||||||
* In either case, the caller must call cairo_surface_destroy on the
|
* In either case, the caller must call cairo_surface_destroy on the
|
||||||
* result when it is done with it.
|
* result when it is done with it.
|
||||||
*/
|
*/
|
||||||
cairo_surface_t* GetCairoSurfaceForSourceSurface(
|
static cairo_surface_t* GetCairoSurfaceForSourceSurface(
|
||||||
SourceSurface* aSurface, bool aExistingOnly = false,
|
SourceSurface* aSurface, bool aExistingOnly = false,
|
||||||
const IntRect& aSubImage = IntRect()) {
|
const IntRect& aSubImage = IntRect()) {
|
||||||
if (!aSurface) {
|
if (!aSurface) {
|
||||||
|
@ -23,7 +23,7 @@ struct RecordingSourceSurfaceUserData {
|
|||||||
RefPtr<DrawEventRecorderPrivate> recorder;
|
RefPtr<DrawEventRecorderPrivate> recorder;
|
||||||
};
|
};
|
||||||
|
|
||||||
void RecordingSourceSurfaceUserDataFunc(void *aUserData) {
|
static void RecordingSourceSurfaceUserDataFunc(void *aUserData) {
|
||||||
RecordingSourceSurfaceUserData *userData =
|
RecordingSourceSurfaceUserData *userData =
|
||||||
static_cast<RecordingSourceSurfaceUserData *>(aUserData);
|
static_cast<RecordingSourceSurfaceUserData *>(aUserData);
|
||||||
|
|
||||||
@ -269,7 +269,7 @@ struct RecordingFontUserData {
|
|||||||
RefPtr<DrawEventRecorderPrivate> recorder;
|
RefPtr<DrawEventRecorderPrivate> recorder;
|
||||||
};
|
};
|
||||||
|
|
||||||
void RecordingFontUserDataDestroyFunc(void *aUserData) {
|
static void RecordingFontUserDataDestroyFunc(void *aUserData) {
|
||||||
RecordingFontUserData *userData =
|
RecordingFontUserData *userData =
|
||||||
static_cast<RecordingFontUserData *>(aUserData);
|
static_cast<RecordingFontUserData *>(aUserData);
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ struct WrapAndRecordSourceSurfaceUserData {
|
|||||||
RefPtr<DrawEventRecorderPrivate> recorder;
|
RefPtr<DrawEventRecorderPrivate> recorder;
|
||||||
};
|
};
|
||||||
|
|
||||||
void WrapAndRecordSourceSurfaceUserDataFunc(void *aUserData) {
|
static void WrapAndRecordSourceSurfaceUserDataFunc(void *aUserData) {
|
||||||
WrapAndRecordSourceSurfaceUserData *userData =
|
WrapAndRecordSourceSurfaceUserData *userData =
|
||||||
static_cast<WrapAndRecordSourceSurfaceUserData *>(aUserData);
|
static_cast<WrapAndRecordSourceSurfaceUserData *>(aUserData);
|
||||||
|
|
||||||
@ -355,7 +355,7 @@ struct WrapAndRecordFontUserData {
|
|||||||
RefPtr<DrawEventRecorderPrivate> recorder;
|
RefPtr<DrawEventRecorderPrivate> recorder;
|
||||||
};
|
};
|
||||||
|
|
||||||
void WrapAndRecordFontUserDataDestroyFunc(void *aUserData) {
|
static void WrapAndRecordFontUserDataDestroyFunc(void *aUserData) {
|
||||||
WrapAndRecordFontUserData *userData =
|
WrapAndRecordFontUserData *userData =
|
||||||
static_cast<WrapAndRecordFontUserData *>(aUserData);
|
static_cast<WrapAndRecordFontUserData *>(aUserData);
|
||||||
|
|
||||||
|
@ -180,7 +180,8 @@ static int32_t NS_lround(double x) {
|
|||||||
return x >= 0.0 ? int32_t(x + 0.5) : int32_t(x - 0.5);
|
return x >= 0.0 ? int32_t(x + 0.5) : int32_t(x - 0.5);
|
||||||
}
|
}
|
||||||
|
|
||||||
already_AddRefed<DataSourceSurface> CloneAligned(DataSourceSurface *aSource) {
|
static already_AddRefed<DataSourceSurface> CloneAligned(
|
||||||
|
DataSourceSurface *aSource) {
|
||||||
return CreateDataSourceSurfaceByCloning(aSource);
|
return CreateDataSourceSurfaceByCloning(aSource);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1813,7 +1814,7 @@ static void TransferComponents(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IsAllZero(uint8_t aLookupTable[256]) {
|
static bool IsAllZero(const uint8_t aLookupTable[256]) {
|
||||||
for (int32_t i = 0; i < 256; i++) {
|
for (int32_t i = 0; i < 256; i++) {
|
||||||
if (aLookupTable[i] != 0) {
|
if (aLookupTable[i] != 0) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -439,7 +439,7 @@ using mozilla::gfx::IntSize;
|
|||||||
using mozilla::gfx::SourceSurface;
|
using mozilla::gfx::SourceSurface;
|
||||||
using mozilla::gfx::SurfaceFormat;
|
using mozilla::gfx::SurfaceFormat;
|
||||||
|
|
||||||
void MacIOSurfaceBufferDeallocator(void* aClosure) {
|
static void MacIOSurfaceBufferDeallocator(void* aClosure) {
|
||||||
MOZ_ASSERT(aClosure);
|
MOZ_ASSERT(aClosure);
|
||||||
|
|
||||||
delete[] static_cast<unsigned char*>(aClosure);
|
delete[] static_cast<unsigned char*>(aClosure);
|
||||||
|
@ -35,7 +35,7 @@ CGColorSpaceRef CreateSystemColorSpace() {
|
|||||||
|
|
||||||
nsCARenderer::~nsCARenderer() { Destroy(); }
|
nsCARenderer::~nsCARenderer() { Destroy(); }
|
||||||
|
|
||||||
void cgdata_release_callback(void* aCGData, const void* data, size_t size) {
|
static void cgdata_release_callback(void* aCGData, const void* data, size_t size) {
|
||||||
if (aCGData) {
|
if (aCGData) {
|
||||||
free(aCGData);
|
free(aCGData);
|
||||||
}
|
}
|
||||||
|
@ -188,8 +188,8 @@ already_AddRefed<Path> ScaledFontMac::GetPathForGlyphs(
|
|||||||
return ScaledFontBase::GetPathForGlyphs(aBuffer, aTarget);
|
return ScaledFontBase::GetPathForGlyphs(aBuffer, aTarget);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t CalcTableChecksum(const uint32_t* tableStart, uint32_t length,
|
static uint32_t CalcTableChecksum(const uint32_t* tableStart, uint32_t length,
|
||||||
bool skipChecksumAdjust = false) {
|
bool skipChecksumAdjust = false) {
|
||||||
uint32_t sum = 0L;
|
uint32_t sum = 0L;
|
||||||
const uint32_t* table = tableStart;
|
const uint32_t* table = tableStart;
|
||||||
const uint32_t* end = table + length / sizeof(uint32_t);
|
const uint32_t* end = table + length / sizeof(uint32_t);
|
||||||
@ -221,7 +221,7 @@ struct TableRecord {
|
|||||||
CFDataRef data;
|
CFDataRef data;
|
||||||
};
|
};
|
||||||
|
|
||||||
int maxPow2LessThan(int a) {
|
static int maxPow2LessThan(int a) {
|
||||||
int x = 1;
|
int x = 1;
|
||||||
int shift = 0;
|
int shift = 0;
|
||||||
while ((x << (shift + 1)) < a) {
|
while ((x << (shift + 1)) < a) {
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
namespace layers {
|
namespace layers {
|
||||||
|
|
||||||
void TryCircle(double centerX, double centerY, double radius) {
|
static void TryCircle(double centerX, double centerY, double radius) {
|
||||||
printf("TestCairo:TryArcs centerY %f, radius %f\n", centerY, radius);
|
printf("TestCairo:TryArcs centerY %f, radius %f\n", centerY, radius);
|
||||||
|
|
||||||
cairo_surface_t *surf =
|
cairo_surface_t *surf =
|
||||||
|
@ -55,8 +55,6 @@ uint8_t gLayerManagerLayerBuilder;
|
|||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
namespace layers {
|
namespace layers {
|
||||||
|
|
||||||
FILE* FILEOrDefault(FILE* aFile) { return aFile ? aFile : stderr; }
|
|
||||||
|
|
||||||
typedef ScrollableLayerGuid::ViewID ViewID;
|
typedef ScrollableLayerGuid::ViewID ViewID;
|
||||||
|
|
||||||
using namespace mozilla::gfx;
|
using namespace mozilla::gfx;
|
||||||
|
@ -214,18 +214,5 @@ gfx::CompositionOp GetEffectiveOperator(Layer* aLayer) {
|
|||||||
return ToData(aLayer)->GetOperator();
|
return ToData(aLayer)->GetOperator();
|
||||||
}
|
}
|
||||||
|
|
||||||
ShadowableLayer* ToShadowable(Layer* aLayer) {
|
|
||||||
return aLayer->AsShadowableLayer();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ShouldShadow(Layer* aLayer) {
|
|
||||||
if (!ToShadowable(aLayer)) {
|
|
||||||
MOZ_ASSERT(aLayer->GetType() == Layer::TYPE_READBACK,
|
|
||||||
"Only expect not to shadow ReadbackLayers");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace layers
|
} // namespace layers
|
||||||
} // namespace mozilla
|
} // namespace mozilla
|
||||||
|
@ -147,10 +147,20 @@ void ClientPaintedLayer::RenderLayerWithReadback(ReadbackProcessor* aReadback) {
|
|||||||
MOZ_ASSERT(ctx); // already checked the target above
|
MOZ_ASSERT(ctx); // already checked the target above
|
||||||
|
|
||||||
if (!gfxEnv::SkipRasterization()) {
|
if (!gfxEnv::SkipRasterization()) {
|
||||||
ClientManager()->GetPaintedLayerCallback()(
|
if (!target->IsCaptureDT()) {
|
||||||
this, ctx, iter.mDrawRegion, iter.mDrawRegion, state.mClip,
|
target->ClearRect(Rect());
|
||||||
state.mRegionToInvalidate,
|
if (target->IsValid()) {
|
||||||
ClientManager()->GetPaintedLayerCallbackData());
|
ClientManager()->GetPaintedLayerCallback()(
|
||||||
|
this, ctx, iter.mDrawRegion, iter.mDrawRegion, state.mClip,
|
||||||
|
state.mRegionToInvalidate,
|
||||||
|
ClientManager()->GetPaintedLayerCallbackData());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
ClientManager()->GetPaintedLayerCallback()(
|
||||||
|
this, ctx, iter.mDrawRegion, iter.mDrawRegion, state.mClip,
|
||||||
|
state.mRegionToInvalidate,
|
||||||
|
ClientManager()->GetPaintedLayerCallbackData());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx = nullptr;
|
ctx = nullptr;
|
||||||
|
@ -24,7 +24,6 @@
|
|||||||
#include "mozilla/layers/ShadowLayers.h" // for ShadowLayerForwarder
|
#include "mozilla/layers/ShadowLayers.h" // for ShadowLayerForwarder
|
||||||
#include "mozilla/layers/PaintThread.h" // for PaintThread
|
#include "mozilla/layers/PaintThread.h" // for PaintThread
|
||||||
#include "TextureClientPool.h"
|
#include "TextureClientPool.h"
|
||||||
#include "nsDebug.h" // for NS_ASSERTION
|
|
||||||
#include "nsISupportsImpl.h" // for gfxContext::AddRef, etc
|
#include "nsISupportsImpl.h" // for gfxContext::AddRef, etc
|
||||||
#include "nsExpirationTracker.h" // for nsExpirationTracker
|
#include "nsExpirationTracker.h" // for nsExpirationTracker
|
||||||
#include "nsMathUtils.h" // for NS_lroundf
|
#include "nsMathUtils.h" // for NS_lroundf
|
||||||
@ -32,12 +31,6 @@
|
|||||||
#include "UnitTransforms.h" // for TransformTo
|
#include "UnitTransforms.h" // for TransformTo
|
||||||
#include "mozilla/UniquePtr.h"
|
#include "mozilla/UniquePtr.h"
|
||||||
|
|
||||||
// This is the minimum area that we deem reasonable to copy from the front
|
|
||||||
// buffer to the back buffer on tile updates. If the valid region is smaller
|
|
||||||
// than this, we just redraw it and save on the copy (and requisite
|
|
||||||
// surface-locking involved).
|
|
||||||
#define MINIMUM_TILE_COPY_AREA (1.f / 16.f)
|
|
||||||
|
|
||||||
#ifdef GFX_TILEDLAYER_DEBUG_OVERLAY
|
#ifdef GFX_TILEDLAYER_DEBUG_OVERLAY
|
||||||
# include "cairo.h"
|
# include "cairo.h"
|
||||||
# include <sstream>
|
# include <sstream>
|
||||||
|
@ -23,10 +23,6 @@ namespace layers {
|
|||||||
static StaticRefPtr<CompositorThreadHolder> sCompositorThreadHolder;
|
static StaticRefPtr<CompositorThreadHolder> sCompositorThreadHolder;
|
||||||
static bool sFinishedCompositorShutDown = false;
|
static bool sFinishedCompositorShutDown = false;
|
||||||
|
|
||||||
CompositorThreadHolder* GetCompositorThreadHolder() {
|
|
||||||
return sCompositorThreadHolder;
|
|
||||||
}
|
|
||||||
|
|
||||||
base::Thread* CompositorThread() {
|
base::Thread* CompositorThread() {
|
||||||
return sCompositorThreadHolder
|
return sCompositorThreadHolder
|
||||||
? sCompositorThreadHolder->GetCompositorThread()
|
? sCompositorThreadHolder->GetCompositorThread()
|
||||||
|
@ -48,9 +48,6 @@ StaticAutoPtr<mozilla::Monitor> sImageBridgesLock;
|
|||||||
|
|
||||||
static StaticRefPtr<ImageBridgeParent> sImageBridgeParentSingleton;
|
static StaticRefPtr<ImageBridgeParent> sImageBridgeParentSingleton;
|
||||||
|
|
||||||
// defined in CompositorBridgeParent.cpp
|
|
||||||
CompositorThreadHolder* GetCompositorThreadHolder();
|
|
||||||
|
|
||||||
/* static */ void ImageBridgeParent::Setup() {
|
/* static */ void ImageBridgeParent::Setup() {
|
||||||
MOZ_ASSERT(NS_IsMainThread());
|
MOZ_ASSERT(NS_IsMainThread());
|
||||||
if (!sImageBridgesLock) {
|
if (!sImageBridgesLock) {
|
||||||
|
14
gfx/src/components.conf
Normal file
14
gfx/src/components.conf
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
# -*- 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/.
|
||||||
|
|
||||||
|
Classes = [
|
||||||
|
{
|
||||||
|
'cid': '{a6cf9115-15b3-11d2-932e-00805f8add32}',
|
||||||
|
'contract_ids': ['@mozilla.org/gfx/fontenumerator;1'],
|
||||||
|
'type': 'nsThebesFontEnumerator',
|
||||||
|
'headers': ['/gfx/src/nsThebesFontEnumerator.h'],
|
||||||
|
},
|
||||||
|
]
|
@ -68,7 +68,6 @@ UNIFIED_SOURCES += [
|
|||||||
'nsRect.cpp',
|
'nsRect.cpp',
|
||||||
'nsRegion.cpp',
|
'nsRegion.cpp',
|
||||||
'nsThebesFontEnumerator.cpp',
|
'nsThebesFontEnumerator.cpp',
|
||||||
'nsThebesGfxFactory.cpp',
|
|
||||||
'nsTransform2D.cpp',
|
'nsTransform2D.cpp',
|
||||||
'TiledRegion.cpp',
|
'TiledRegion.cpp',
|
||||||
]
|
]
|
||||||
@ -78,6 +77,10 @@ SOURCES += [
|
|||||||
'nsDeviceContext.cpp',
|
'nsDeviceContext.cpp',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
XPCOM_MANIFESTS += [
|
||||||
|
'components.conf',
|
||||||
|
]
|
||||||
|
|
||||||
include('/ipc/chromium/chromium-config.mozbuild')
|
include('/ipc/chromium/chromium-config.mozbuild')
|
||||||
|
|
||||||
LOCAL_INCLUDES += [
|
LOCAL_INCLUDES += [
|
||||||
|
@ -1,40 +0,0 @@
|
|||||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
||||||
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
|
||||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
||||||
|
|
||||||
#include "gfxPlatform.h" // for gfxPlatform
|
|
||||||
#include "mozilla/Assertions.h" // for MOZ_ASSERT_HELPER2
|
|
||||||
#include "mozilla/Attributes.h" // for final
|
|
||||||
#include "mozilla/Module.h" // for Module, Module::CIDEntry, etc
|
|
||||||
#include "mozilla/ModuleUtils.h"
|
|
||||||
#include "mozilla/mozalloc.h" // for operator new
|
|
||||||
#include "nsCOMPtr.h" // for nsCOMPtr
|
|
||||||
#include "nsError.h" // for NS_ERROR_NO_AGGREGATION, etc
|
|
||||||
#include "nsGfxCIID.h" // for NS_FONT_ENUMERATOR_CID, etc
|
|
||||||
#include "nsID.h" // for NS_DEFINE_NAMED_CID, etc
|
|
||||||
#include "nsISupports.h" // for NS_DECL_ISUPPORTS, etc
|
|
||||||
#include "nsThebesFontEnumerator.h" // for nsThebesFontEnumerator
|
|
||||||
|
|
||||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsThebesFontEnumerator)
|
|
||||||
|
|
||||||
NS_DEFINE_NAMED_CID(NS_FONT_ENUMERATOR_CID);
|
|
||||||
|
|
||||||
static const mozilla::Module::CIDEntry kThebesCIDs[] = {
|
|
||||||
{&kNS_FONT_ENUMERATOR_CID, false, nullptr,
|
|
||||||
nsThebesFontEnumeratorConstructor},
|
|
||||||
{nullptr}};
|
|
||||||
|
|
||||||
static const mozilla::Module::ContractIDEntry kThebesContracts[] = {
|
|
||||||
{"@mozilla.org/gfx/fontenumerator;1", &kNS_FONT_ENUMERATOR_CID}, {nullptr}};
|
|
||||||
|
|
||||||
static const mozilla::Module kThebesModule = {mozilla::Module::kVersion,
|
|
||||||
kThebesCIDs,
|
|
||||||
kThebesContracts,
|
|
||||||
nullptr,
|
|
||||||
nullptr,
|
|
||||||
nullptr,
|
|
||||||
nullptr};
|
|
||||||
|
|
||||||
NSMODULE_DEFN(nsGfxModule) = &kThebesModule;
|
|
@ -1196,10 +1196,6 @@ struct AssignSearchNodeTypesWithLastLeafAsNeedle {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
bool FindNeedle(SearchTestNode* aNode) {
|
|
||||||
return aNode->GetType() == SearchNodeType::Needle;
|
|
||||||
}
|
|
||||||
|
|
||||||
struct AssignSearchNodeTypesAllHay {
|
struct AssignSearchNodeTypesAllHay {
|
||||||
void operator()(SearchTestNode* aNode) {
|
void operator()(SearchTestNode* aNode) {
|
||||||
aNode->SetType(SearchNodeType::Hay);
|
aNode->SetType(SearchNodeType::Hay);
|
||||||
@ -1249,8 +1245,6 @@ struct AllocateUnitRegionsToLeavesOnly {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
void ForEachNodeDoNothing(ForEachTestNode* aNode) {}
|
|
||||||
|
|
||||||
template <typename Node>
|
template <typename Node>
|
||||||
static RefPtr<Node> DepthFirstSearchForwardRecursive(RefPtr<Node> aNode) {
|
static RefPtr<Node> DepthFirstSearchForwardRecursive(RefPtr<Node> aNode) {
|
||||||
if (aNode->GetType() == SearchNodeType::Needle) {
|
if (aNode->GetType() == SearchNodeType::Needle) {
|
||||||
|
@ -435,7 +435,7 @@ void Logger::Flush() {
|
|||||||
uint32_t bytesWritten;
|
uint32_t bytesWritten;
|
||||||
nsCString& line = linesToWrite[i];
|
nsCString& line = linesToWrite[i];
|
||||||
nsresult rv = mLogFile->Write(line.get(), line.Length(), &bytesWritten);
|
nsresult rv = mLogFile->Write(line.get(), line.Length(), &bytesWritten);
|
||||||
NS_WARN_IF(NS_FAILED(rv));
|
Unused << NS_WARN_IF(NS_FAILED(rv));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -415,7 +415,7 @@ static CRITICAL_SECTION* GetMutex() {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
sRegistry->emplaceBack(aProxy);
|
MOZ_ALWAYS_TRUE(sRegistry->emplaceBack(aProxy));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* static */ void RegisteredProxy::DeleteFromRegistry(RegisteredProxy* aProxy) {
|
/* static */ void RegisteredProxy::DeleteFromRegistry(RegisteredProxy* aProxy) {
|
||||||
@ -449,7 +449,7 @@ void RegisterArrayData(const ArrayData* aArrayData, size_t aLength) {
|
|||||||
ClearOnShutdown(&sArrayData, ShutdownPhase::ShutdownThreads);
|
ClearOnShutdown(&sArrayData, ShutdownPhase::ShutdownThreads);
|
||||||
}
|
}
|
||||||
|
|
||||||
sArrayData->emplaceBack(MakePair(aArrayData, aLength));
|
MOZ_ALWAYS_TRUE(sArrayData->emplaceBack(MakePair(aArrayData, aLength)));
|
||||||
}
|
}
|
||||||
|
|
||||||
const ArrayData* FindArrayData(REFIID aIid, ULONG aMethodIndex) {
|
const ArrayData* FindArrayData(REFIID aIid, ULONG aMethodIndex) {
|
||||||
|
@ -28,7 +28,7 @@ bool SpinEvent::sIsMulticore = false;
|
|||||||
|
|
||||||
SpinEvent::SpinEvent() : mDone(false) {
|
SpinEvent::SpinEvent() : mDone(false) {
|
||||||
static const bool gotStatics = InitStatics();
|
static const bool gotStatics = InitStatics();
|
||||||
MOZ_ASSERT(gotStatics);
|
MOZ_ALWAYS_TRUE(gotStatics);
|
||||||
|
|
||||||
mDoneEvent.own(::CreateEventW(nullptr, FALSE, FALSE, nullptr));
|
mDoneEvent.own(::CreateEventW(nullptr, FALSE, FALSE, nullptr));
|
||||||
MOZ_ASSERT(mDoneEvent);
|
MOZ_ASSERT(mDoneEvent);
|
||||||
|
@ -88,6 +88,3 @@ FINAL_LIBRARY = 'xul'
|
|||||||
|
|
||||||
with Files("**"):
|
with Files("**"):
|
||||||
BUG_COMPONENT = ("Core", "IPC: MSCOM")
|
BUG_COMPONENT = ("Core", "IPC: MSCOM")
|
||||||
|
|
||||||
if CONFIG['CC_TYPE'] == 'clang-cl':
|
|
||||||
AllowCompilerWarnings() # workaround for bug 1090497
|
|
||||||
|
@ -37,6 +37,3 @@ FORCE_STATIC_LIB = True
|
|||||||
# This DLL may be loaded into other processes, so we need static libs for
|
# This DLL may be loaded into other processes, so we need static libs for
|
||||||
# Windows 7 and Windows 8.
|
# Windows 7 and Windows 8.
|
||||||
USE_STATIC_LIBS = True
|
USE_STATIC_LIBS = True
|
||||||
|
|
||||||
if CONFIG['CC_TYPE'] == 'clang-cl':
|
|
||||||
AllowCompilerWarnings() # workaround for bug 1090497
|
|
||||||
|
@ -10,7 +10,6 @@
|
|||||||
#include "jsapi.h"
|
#include "jsapi.h"
|
||||||
#include "jsfriendapi.h"
|
#include "jsfriendapi.h"
|
||||||
#include "js/Wrapper.h"
|
#include "js/Wrapper.h"
|
||||||
#include "mozilla/ModuleUtils.h"
|
|
||||||
#include "nsServiceManagerUtils.h"
|
#include "nsServiceManagerUtils.h"
|
||||||
#include "nsMemory.h"
|
#include "nsMemory.h"
|
||||||
|
|
||||||
@ -26,8 +25,6 @@
|
|||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
namespace jsdebugger {
|
namespace jsdebugger {
|
||||||
|
|
||||||
NS_GENERIC_FACTORY_CONSTRUCTOR(JSDebugger)
|
|
||||||
|
|
||||||
NS_IMPL_ISUPPORTS(JSDebugger, IJSDebugger)
|
NS_IMPL_ISUPPORTS(JSDebugger, IJSDebugger)
|
||||||
|
|
||||||
JSDebugger::JSDebugger() {}
|
JSDebugger::JSDebugger() {}
|
||||||
@ -75,18 +72,3 @@ JSDebugger::AddClass(JS::Handle<JS::Value> global, JSContext* cx) {
|
|||||||
|
|
||||||
} // namespace jsdebugger
|
} // namespace jsdebugger
|
||||||
} // namespace mozilla
|
} // namespace mozilla
|
||||||
|
|
||||||
NS_DEFINE_NAMED_CID(JSDEBUGGER_CID);
|
|
||||||
|
|
||||||
static const mozilla::Module::CIDEntry kJSDebuggerCIDs[] = {
|
|
||||||
{&kJSDEBUGGER_CID, false, nullptr,
|
|
||||||
mozilla::jsdebugger::JSDebuggerConstructor},
|
|
||||||
{nullptr}};
|
|
||||||
|
|
||||||
static const mozilla::Module::ContractIDEntry kJSDebuggerContracts[] = {
|
|
||||||
{JSDEBUGGER_CONTRACTID, &kJSDEBUGGER_CID}, {nullptr}};
|
|
||||||
|
|
||||||
static const mozilla::Module kJSDebuggerModule = {
|
|
||||||
mozilla::Module::kVersion, kJSDebuggerCIDs, kJSDebuggerContracts};
|
|
||||||
|
|
||||||
NSMODULE_DEFN(jsdebugger) = &kJSDebuggerModule;
|
|
||||||
|
14
js/ductwork/debugger/components.conf
Normal file
14
js/ductwork/debugger/components.conf
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
# -*- 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/.
|
||||||
|
|
||||||
|
Classes = [
|
||||||
|
{
|
||||||
|
'cid': '{0365cbd5-d46e-4e94-a39f-83b63cd1a963}',
|
||||||
|
'contract_ids': ['@mozilla.org/jsdebugger;1'],
|
||||||
|
'type': 'mozilla::jsdebugger::JSDebugger',
|
||||||
|
'headers': ['/js/ductwork/debugger/JSDebugger.h'],
|
||||||
|
},
|
||||||
|
]
|
@ -19,6 +19,10 @@ SOURCES += [
|
|||||||
'JSDebugger.cpp',
|
'JSDebugger.cpp',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
XPCOM_MANIFESTS += [
|
||||||
|
'components.conf',
|
||||||
|
]
|
||||||
|
|
||||||
EXTRA_JS_MODULES += [
|
EXTRA_JS_MODULES += [
|
||||||
'jsdebugger.jsm',
|
'jsdebugger.jsm',
|
||||||
]
|
]
|
||||||
|
@ -1490,23 +1490,6 @@ bool TypedObject::isAttached() const {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* static */ bool TypedObject::GetBuffer(JSContext* cx, unsigned argc,
|
|
||||||
Value* vp) {
|
|
||||||
CallArgs args = CallArgsFromVp(argc, vp);
|
|
||||||
JSObject& obj = args[0].toObject();
|
|
||||||
ArrayBufferObject* buffer;
|
|
||||||
if (obj.is<OutlineTransparentTypedObject>()) {
|
|
||||||
buffer = obj.as<OutlineTransparentTypedObject>().getOrCreateBuffer(cx);
|
|
||||||
} else {
|
|
||||||
buffer = obj.as<InlineTransparentTypedObject>().getOrCreateBuffer(cx);
|
|
||||||
}
|
|
||||||
if (!buffer) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
args.rval().setObject(*buffer);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* static */ bool TypedObject::GetByteOffset(JSContext* cx, unsigned argc,
|
/* static */ bool TypedObject::GetByteOffset(JSContext* cx, unsigned argc,
|
||||||
Value* vp) {
|
Value* vp) {
|
||||||
CallArgs args = CallArgsFromVp(argc, vp);
|
CallArgs args = CallArgsFromVp(argc, vp);
|
||||||
@ -1531,11 +1514,6 @@ bool TypedObject::isAttached() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void OutlineTypedObject::setOwnerAndData(JSObject* owner, uint8_t* data) {
|
void OutlineTypedObject::setOwnerAndData(JSObject* owner, uint8_t* data) {
|
||||||
// Make sure we don't associate with array buffers whose data is from an
|
|
||||||
// inline typed object, see obj_trace.
|
|
||||||
MOZ_ASSERT_IF(owner && owner->is<ArrayBufferObject>(),
|
|
||||||
!owner->as<ArrayBufferObject>().forInlineTypedObject());
|
|
||||||
|
|
||||||
// Typed objects cannot move from one owner to another, so don't worry
|
// Typed objects cannot move from one owner to another, so don't worry
|
||||||
// about pre barriers during this initialization.
|
// about pre barriers during this initialization.
|
||||||
owner_ = owner;
|
owner_ = owner;
|
||||||
@ -1594,14 +1572,6 @@ void OutlineTypedObject::attach(JSContext* cx, ArrayBufferObject& buffer,
|
|||||||
MOZ_ASSERT(offset <= buffer.byteLength());
|
MOZ_ASSERT(offset <= buffer.byteLength());
|
||||||
MOZ_ASSERT(size() <= buffer.byteLength() - offset);
|
MOZ_ASSERT(size() <= buffer.byteLength() - offset);
|
||||||
|
|
||||||
// If the owner's data is from an inline typed object, associate this with
|
|
||||||
// the inline typed object instead, to simplify tracing.
|
|
||||||
if (buffer.forInlineTypedObject()) {
|
|
||||||
InlineTypedObject& realOwner = buffer.firstView()->as<InlineTypedObject>();
|
|
||||||
attach(cx, realOwner, offset);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
buffer.setHasTypedObjectViews();
|
buffer.setHasTypedObjectViews();
|
||||||
|
|
||||||
{
|
{
|
||||||
@ -1711,11 +1681,7 @@ void OutlineTypedObject::attach(JSContext* cx, TypedObject& typedObj,
|
|||||||
uint8_t* newData = oldData;
|
uint8_t* newData = oldData;
|
||||||
|
|
||||||
// Update the data pointer if the owner moved and the owner's data is
|
// Update the data pointer if the owner moved and the owner's data is
|
||||||
// inline with it. Note that an array buffer pointing to data in an inline
|
// inline with it.
|
||||||
// typed object will never be used as an owner for another outline typed
|
|
||||||
// object. In such cases, the owner will be the inline typed object itself.
|
|
||||||
MOZ_ASSERT_IF(owner->is<ArrayBufferObject>(),
|
|
||||||
!owner->as<ArrayBufferObject>().forInlineTypedObject());
|
|
||||||
if (owner != oldOwner && (owner->is<InlineTypedObject>() ||
|
if (owner != oldOwner && (owner->is<InlineTypedObject>() ||
|
||||||
owner->as<ArrayBufferObject>().hasInlineData())) {
|
owner->as<ArrayBufferObject>().hasInlineData())) {
|
||||||
newData += reinterpret_cast<uint8_t*>(owner) -
|
newData += reinterpret_cast<uint8_t*>(owner) -
|
||||||
@ -2226,70 +2192,6 @@ void OutlineTypedObject::notifyBufferDetached(void* newData) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
ArrayBufferObject* InlineTransparentTypedObject::getOrCreateBuffer(
|
|
||||||
JSContext* cx) {
|
|
||||||
ObjectRealm& realm = ObjectRealm::get(this);
|
|
||||||
if (!realm.lazyArrayBuffers) {
|
|
||||||
auto table = cx->make_unique<ObjectWeakMap>(cx);
|
|
||||||
if (!table) {
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
realm.lazyArrayBuffers = std::move(table);
|
|
||||||
}
|
|
||||||
|
|
||||||
ObjectWeakMap* table = realm.lazyArrayBuffers.get();
|
|
||||||
|
|
||||||
JSObject* obj = table->lookup(this);
|
|
||||||
if (obj) {
|
|
||||||
return &obj->as<ArrayBufferObject>();
|
|
||||||
}
|
|
||||||
|
|
||||||
ArrayBufferObject::BufferContents contents =
|
|
||||||
ArrayBufferObject::BufferContents::createPlain(inlineTypedMem());
|
|
||||||
size_t nbytes = typeDescr().size();
|
|
||||||
|
|
||||||
// Prevent GC under ArrayBufferObject::create, which might move this object
|
|
||||||
// and its contents.
|
|
||||||
gc::AutoSuppressGC suppress(cx);
|
|
||||||
|
|
||||||
ArrayBufferObject* buffer = ArrayBufferObject::create(
|
|
||||||
cx, nbytes, contents, ArrayBufferObject::DoesntOwnData);
|
|
||||||
if (!buffer) {
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
// The owning object must always be the array buffer's first view. This
|
|
||||||
// both prevents the memory from disappearing out from under the buffer
|
|
||||||
// (the first view is held strongly by the buffer) and is used by the
|
|
||||||
// buffer marking code to detect whether its data pointer needs to be
|
|
||||||
// relocated.
|
|
||||||
MOZ_ALWAYS_TRUE(buffer->addView(cx, this));
|
|
||||||
|
|
||||||
buffer->setForInlineTypedObject();
|
|
||||||
buffer->setHasTypedObjectViews();
|
|
||||||
|
|
||||||
if (!table->add(cx, this, buffer)) {
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (IsInsideNursery(this)) {
|
|
||||||
// Make sure the buffer is traced by the next generational collection,
|
|
||||||
// so that its data pointer is updated after this typed object moves.
|
|
||||||
storeBuffer()->putWholeCell(buffer);
|
|
||||||
}
|
|
||||||
|
|
||||||
return buffer;
|
|
||||||
}
|
|
||||||
|
|
||||||
ArrayBufferObject* OutlineTransparentTypedObject::getOrCreateBuffer(
|
|
||||||
JSContext* cx) {
|
|
||||||
if (owner().is<ArrayBufferObject>()) {
|
|
||||||
return &owner().as<ArrayBufferObject>();
|
|
||||||
}
|
|
||||||
return owner().as<InlineTransparentTypedObject>().getOrCreateBuffer(cx);
|
|
||||||
}
|
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* Typed object classes
|
* Typed object classes
|
||||||
*/
|
*/
|
||||||
|
@ -619,7 +619,6 @@ class TypedObject : public ShapedObject {
|
|||||||
static MOZ_MUST_USE bool construct(JSContext* cx, unsigned argc, Value* vp);
|
static MOZ_MUST_USE bool construct(JSContext* cx, unsigned argc, Value* vp);
|
||||||
|
|
||||||
/* Accessors for self hosted code. */
|
/* Accessors for self hosted code. */
|
||||||
static MOZ_MUST_USE bool GetBuffer(JSContext* cx, unsigned argc, Value* vp);
|
|
||||||
static MOZ_MUST_USE bool GetByteOffset(JSContext* cx, unsigned argc,
|
static MOZ_MUST_USE bool GetByteOffset(JSContext* cx, unsigned argc,
|
||||||
Value* vp);
|
Value* vp);
|
||||||
|
|
||||||
@ -701,8 +700,6 @@ class OutlineTypedObject : public TypedObject {
|
|||||||
class OutlineTransparentTypedObject : public OutlineTypedObject {
|
class OutlineTransparentTypedObject : public OutlineTypedObject {
|
||||||
public:
|
public:
|
||||||
static const Class class_;
|
static const Class class_;
|
||||||
|
|
||||||
ArrayBufferObject* getOrCreateBuffer(JSContext* cx);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Class for an opaque typed object whose owner may be either an array buffer
|
// Class for an opaque typed object whose owner may be either an array buffer
|
||||||
@ -760,8 +757,6 @@ class InlineTransparentTypedObject : public InlineTypedObject {
|
|||||||
public:
|
public:
|
||||||
static const Class class_;
|
static const Class class_;
|
||||||
|
|
||||||
ArrayBufferObject* getOrCreateBuffer(JSContext* cx);
|
|
||||||
|
|
||||||
uint8_t* inlineTypedMem() const {
|
uint8_t* inlineTypedMem() const {
|
||||||
return InlineTypedObject::inlineTypedMem();
|
return InlineTypedObject::inlineTypedMem();
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
|
|
||||||
#define JS_ARRAYBUFFER_FLAGS_SLOT 3
|
#define JS_ARRAYBUFFER_FLAGS_SLOT 3
|
||||||
|
|
||||||
#define JS_ARRAYBUFFER_DETACHED_FLAG 0x4
|
#define JS_ARRAYBUFFER_DETACHED_FLAG 0x8
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
// Slots for typed prototypes
|
// Slots for typed prototypes
|
||||||
|
@ -158,12 +158,11 @@ static void* MapAlignedPagesLastDitch(size_t length, size_t alignment);
|
|||||||
|
|
||||||
#ifdef JS_64BIT
|
#ifdef JS_64BIT
|
||||||
static void* MapAlignedPagesRandom(size_t length, size_t alignment);
|
static void* MapAlignedPagesRandom(size_t length, size_t alignment);
|
||||||
void* TestMapAlignedPagesLastDitch(size_t, size_t) { return nullptr; }
|
#endif
|
||||||
#else
|
|
||||||
void* TestMapAlignedPagesLastDitch(size_t length, size_t alignment) {
|
void* TestMapAlignedPagesLastDitch(size_t length, size_t alignment) {
|
||||||
return MapAlignedPagesLastDitch(length, alignment);
|
return MapAlignedPagesLastDitch(length, alignment);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We can only decommit unused pages if the hardcoded Arena
|
* We can only decommit unused pages if the hardcoded Arena
|
||||||
@ -425,28 +424,45 @@ void* MapAlignedPages(size_t length, size_t alignment) {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Try to allocate the region. If the returned address is aligned,
|
||||||
|
// either we OOMed (region is nullptr) or we're done.
|
||||||
void* region = MapMemory(length);
|
void* region = MapMemory(length);
|
||||||
if (OffsetFromAligned(region, alignment) == 0) {
|
if (OffsetFromAligned(region, alignment) == 0) {
|
||||||
return region;
|
return region;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Try to align the region. On success, TryToAlignChunk() returns
|
||||||
|
// true and we can return the aligned region immediately.
|
||||||
void* retainedRegion;
|
void* retainedRegion;
|
||||||
TryToAlignChunk(®ion, &retainedRegion, length, alignment);
|
if (TryToAlignChunk(®ion, &retainedRegion, length, alignment)) {
|
||||||
|
MOZ_ASSERT(region && OffsetFromAligned(region, alignment) == 0);
|
||||||
|
MOZ_ASSERT(!retainedRegion);
|
||||||
|
return region;
|
||||||
|
}
|
||||||
|
|
||||||
|
// On failure, the unaligned region is retained unless we OOMed. We don't
|
||||||
|
// use the retained region on this path (see the last ditch allocator).
|
||||||
if (retainedRegion) {
|
if (retainedRegion) {
|
||||||
UnmapInternal(retainedRegion, length);
|
UnmapInternal(retainedRegion, length);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If it fails to align the given region, TryToAlignChunk() returns the
|
||||||
|
// next valid region that we might be able to align (unless we OOMed).
|
||||||
if (region) {
|
if (region) {
|
||||||
if (OffsetFromAligned(region, alignment) == 0) {
|
MOZ_ASSERT(OffsetFromAligned(region, alignment) != 0);
|
||||||
return region;
|
|
||||||
}
|
|
||||||
UnmapInternal(region, length);
|
UnmapInternal(region, length);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Since we couldn't align the first region, fall back to allocating a
|
||||||
|
// region large enough that we can definitely align it.
|
||||||
region = MapAlignedPagesSlow(length, alignment);
|
region = MapAlignedPagesSlow(length, alignment);
|
||||||
if (!region) {
|
if (!region) {
|
||||||
|
// If there wasn't enough contiguous address space left for that,
|
||||||
|
// try to find an alignable region using the last ditch allocator.
|
||||||
region = MapAlignedPagesLastDitch(length, alignment);
|
region = MapAlignedPagesLastDitch(length, alignment);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// At this point we should either have an aligned region or nullptr.
|
||||||
MOZ_ASSERT(OffsetFromAligned(region, alignment) == 0);
|
MOZ_ASSERT(OffsetFromAligned(region, alignment) == 0);
|
||||||
return region;
|
return region;
|
||||||
}
|
}
|
||||||
@ -510,6 +526,7 @@ static void* MapAlignedPagesRandom(size_t length, size_t alignment) {
|
|||||||
}
|
}
|
||||||
void* retainedRegion = nullptr;
|
void* retainedRegion = nullptr;
|
||||||
if (TryToAlignChunk<false>(®ion, &retainedRegion, length, alignment)) {
|
if (TryToAlignChunk<false>(®ion, &retainedRegion, length, alignment)) {
|
||||||
|
MOZ_ASSERT(region && OffsetFromAligned(region, alignment) == 0);
|
||||||
MOZ_ASSERT(!retainedRegion);
|
MOZ_ASSERT(!retainedRegion);
|
||||||
return region;
|
return region;
|
||||||
}
|
}
|
||||||
@ -590,6 +607,7 @@ static void* MapAlignedPagesLastDitch(size_t length, size_t alignment) {
|
|||||||
}
|
}
|
||||||
for (; attempt < MaxLastDitchAttempts; ++attempt) {
|
for (; attempt < MaxLastDitchAttempts; ++attempt) {
|
||||||
if (TryToAlignChunk(®ion, tempMaps + attempt, length, alignment)) {
|
if (TryToAlignChunk(®ion, tempMaps + attempt, length, alignment)) {
|
||||||
|
MOZ_ASSERT(region && OffsetFromAligned(region, alignment) == 0);
|
||||||
MOZ_ASSERT(!tempMaps[attempt]);
|
MOZ_ASSERT(!tempMaps[attempt]);
|
||||||
break; // Success!
|
break; // Success!
|
||||||
}
|
}
|
||||||
@ -705,6 +723,12 @@ static bool TryToAlignChunk(void** aRegion, void** aRetainedRegion,
|
|||||||
// If our current chunk cannot be aligned, just get a new one.
|
// If our current chunk cannot be aligned, just get a new one.
|
||||||
retainedRegion = regionStart;
|
retainedRegion = regionStart;
|
||||||
regionStart = MapMemory(length);
|
regionStart = MapMemory(length);
|
||||||
|
// Our new region might happen to already be aligned.
|
||||||
|
result = OffsetFromAligned(regionStart, alignment) == 0;
|
||||||
|
if (result) {
|
||||||
|
UnmapInternal(retainedRegion, length);
|
||||||
|
retainedRegion = nullptr;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
*aRegion = regionStart;
|
*aRegion = regionStart;
|
||||||
|
@ -221,6 +221,7 @@ void js::Nursery::disable() {
|
|||||||
// nursery. JIT'd code uses this even if the nursery is disabled.
|
// nursery. JIT'd code uses this even if the nursery is disabled.
|
||||||
currentEnd_ = 0;
|
currentEnd_ = 0;
|
||||||
currentStringEnd_ = 0;
|
currentStringEnd_ = 0;
|
||||||
|
position_ = 0;
|
||||||
runtime()->gc.storeBuffer().disable();
|
runtime()->gc.storeBuffer().disable();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -362,6 +362,7 @@ class Nursery {
|
|||||||
return capacity() - freeSpace();
|
return capacity() - freeSpace();
|
||||||
}
|
}
|
||||||
MOZ_ALWAYS_INLINE size_t freeSpace() const {
|
MOZ_ALWAYS_INLINE size_t freeSpace() const {
|
||||||
|
MOZ_ASSERT(isEnabled());
|
||||||
MOZ_ASSERT(currentEnd_ - position_ <= NurseryChunkUsableSize);
|
MOZ_ASSERT(currentEnd_ - position_ <= NurseryChunkUsableSize);
|
||||||
MOZ_ASSERT(currentChunk_ < maxChunkCount());
|
MOZ_ASSERT(currentChunk_ < maxChunkCount());
|
||||||
return (currentEnd_ - position_) +
|
return (currentEnd_ - position_) +
|
||||||
|
@ -3429,10 +3429,6 @@ void MacroAssembler::wasmInterruptCheck(Register tls,
|
|||||||
|
|
||||||
void MacroAssembler::wasmReserveStackChecked(uint32_t amount,
|
void MacroAssembler::wasmReserveStackChecked(uint32_t amount,
|
||||||
wasm::BytecodeOffset trapOffset) {
|
wasm::BytecodeOffset trapOffset) {
|
||||||
if (!amount) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// If the frame is large, don't bump sp until after the stack limit check so
|
// If the frame is large, don't bump sp until after the stack limit check so
|
||||||
// that the trap handler isn't called with a wild sp.
|
// that the trap handler isn't called with a wild sp.
|
||||||
|
|
||||||
|
@ -135,6 +135,9 @@ bool testGCAllocatorUp(const size_t PageSize) {
|
|||||||
// Check that the last ditch allocator works as expected.
|
// Check that the last ditch allocator works as expected.
|
||||||
CHECK(positionIsCorrect("x--xx--xx-oox---", stagingArea, chunkPool,
|
CHECK(positionIsCorrect("x--xx--xx-oox---", stagingArea, chunkPool,
|
||||||
tempChunks, UseLastDitchAllocator));
|
tempChunks, UseLastDitchAllocator));
|
||||||
|
// Check that the last ditch allocator can deal with naturally aligned chunks.
|
||||||
|
CHECK(positionIsCorrect("x--xx--xoo------", stagingArea, chunkPool,
|
||||||
|
tempChunks, UseLastDitchAllocator));
|
||||||
|
|
||||||
// Clean up.
|
// Clean up.
|
||||||
while (--tempChunks >= 0) {
|
while (--tempChunks >= 0) {
|
||||||
@ -185,6 +188,9 @@ bool testGCAllocatorDown(const size_t PageSize) {
|
|||||||
// Check that the last ditch allocator works as expected.
|
// Check that the last ditch allocator works as expected.
|
||||||
CHECK(positionIsCorrect("---xoo-xx--xx--x", stagingArea, chunkPool,
|
CHECK(positionIsCorrect("---xoo-xx--xx--x", stagingArea, chunkPool,
|
||||||
tempChunks, UseLastDitchAllocator));
|
tempChunks, UseLastDitchAllocator));
|
||||||
|
// Check that the last ditch allocator can deal with naturally aligned chunks.
|
||||||
|
CHECK(positionIsCorrect("------oox--xx--x", stagingArea, chunkPool,
|
||||||
|
tempChunks, UseLastDitchAllocator));
|
||||||
|
|
||||||
// Clean up.
|
// Clean up.
|
||||||
while (--tempChunks >= 0) {
|
while (--tempChunks >= 0) {
|
||||||
|
@ -2022,7 +2022,7 @@ JS_PUBLIC_API void JS_SetAllNonReservedSlotsToUndefined(JSContext* cx,
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new array buffer with the given contents. It must be legal to pass
|
* Create a new array buffer with the given contents. It must be legal to pass
|
||||||
* these contents to free(). On success, the ownership is transferred to the
|
* these contents to JS_free(). On success, the ownership is transferred to the
|
||||||
* new array buffer.
|
* new array buffer.
|
||||||
*/
|
*/
|
||||||
extern JS_PUBLIC_API JSObject* JS_NewArrayBufferWithContents(JSContext* cx,
|
extern JS_PUBLIC_API JSObject* JS_NewArrayBufferWithContents(JSContext* cx,
|
||||||
@ -2067,8 +2067,8 @@ extern JS_PUBLIC_API JSObject* JS_NewExternalArrayBuffer(
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new array buffer with the given contents. The array buffer does not
|
* Create a new array buffer with the given contents. The array buffer does not
|
||||||
* take ownership of contents, and JS_DetachArrayBuffer must be called before
|
* take ownership of contents. JS_DetachArrayBuffer must be called before
|
||||||
* the contents are disposed of.
|
* the contents are disposed of by the user; this call will always succeed.
|
||||||
*/
|
*/
|
||||||
extern JS_PUBLIC_API JSObject* JS_NewArrayBufferWithExternalContents(
|
extern JS_PUBLIC_API JSObject* JS_NewArrayBufferWithExternalContents(
|
||||||
JSContext* cx, size_t nbytes, void* contents);
|
JSContext* cx, size_t nbytes, void* contents);
|
||||||
|
@ -1943,7 +1943,9 @@ extern JS_FRIEND_API JSObject* JS_GetArrayBufferViewBuffer(
|
|||||||
* Detach an ArrayBuffer, causing all associated views to no longer refer to
|
* Detach an ArrayBuffer, causing all associated views to no longer refer to
|
||||||
* the ArrayBuffer's original attached memory.
|
* the ArrayBuffer's original attached memory.
|
||||||
*
|
*
|
||||||
* The |changeData| argument is obsolete and ignored.
|
* This function throws only if it is provided a non-ArrayBuffer object or if
|
||||||
|
* the provided ArrayBuffer is a WASM-backed ArrayBuffer or an ArrayBuffer used
|
||||||
|
* in asm.js code.
|
||||||
*/
|
*/
|
||||||
extern JS_FRIEND_API bool JS_DetachArrayBuffer(JSContext* cx,
|
extern JS_FRIEND_API bool JS_DetachArrayBuffer(JSContext* cx,
|
||||||
JS::HandleObject obj);
|
JS::HandleObject obj);
|
||||||
|
@ -1916,9 +1916,9 @@ static bool CacheEntry_setBytecode(JSContext* cx, HandleObject cache,
|
|||||||
uint8_t* buffer, uint32_t length) {
|
uint8_t* buffer, uint32_t length) {
|
||||||
MOZ_ASSERT(CacheEntry_isCacheEntry(cache));
|
MOZ_ASSERT(CacheEntry_isCacheEntry(cache));
|
||||||
|
|
||||||
ArrayBufferObject::BufferContents contents =
|
using BufferContents = ArrayBufferObject::BufferContents;
|
||||||
ArrayBufferObject::BufferContents::create<ArrayBufferObject::PLAIN>(
|
|
||||||
buffer);
|
BufferContents contents = BufferContents::createPlainData(buffer);
|
||||||
Rooted<ArrayBufferObject*> arrayBuffer(
|
Rooted<ArrayBufferObject*> arrayBuffer(
|
||||||
cx, ArrayBufferObject::create(cx, length, contents));
|
cx, ArrayBufferObject::create(cx, length, contents));
|
||||||
if (!arrayBuffer) {
|
if (!arrayBuffer) {
|
||||||
|
@ -293,7 +293,7 @@ static const ClassOps ArrayBufferObjectClassOps = {
|
|||||||
nullptr, /* call */
|
nullptr, /* call */
|
||||||
nullptr, /* hasInstance */
|
nullptr, /* hasInstance */
|
||||||
nullptr, /* construct */
|
nullptr, /* construct */
|
||||||
ArrayBufferObject::trace,
|
nullptr, /* trace */
|
||||||
};
|
};
|
||||||
|
|
||||||
static const JSFunctionSpec arraybuffer_functions[] = {
|
static const JSFunctionSpec arraybuffer_functions[] = {
|
||||||
@ -445,7 +445,7 @@ static ArrayBufferObject::BufferContents AllocateArrayBufferContents(
|
|||||||
JSContext* cx, uint32_t nbytes) {
|
JSContext* cx, uint32_t nbytes) {
|
||||||
uint8_t* p =
|
uint8_t* p =
|
||||||
cx->pod_callocCanGC<uint8_t>(nbytes, js::ArrayBufferContentsArena);
|
cx->pod_callocCanGC<uint8_t>(nbytes, js::ArrayBufferContentsArena);
|
||||||
return ArrayBufferObject::BufferContents::create<ArrayBufferObject::PLAIN>(p);
|
return ArrayBufferObject::BufferContents::createPlainData(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void NoteViewBufferWasDetached(
|
static void NoteViewBufferWasDetached(
|
||||||
@ -468,8 +468,6 @@ static void NoteViewBufferWasDetached(
|
|||||||
// When detaching buffers where we don't know all views, the new data must
|
// When detaching buffers where we don't know all views, the new data must
|
||||||
// match the old data. All missing views are typed objects, which do not
|
// match the old data. All missing views are typed objects, which do not
|
||||||
// expect their data to ever change.
|
// expect their data to ever change.
|
||||||
MOZ_ASSERT_IF(buffer->forInlineTypedObject(),
|
|
||||||
newContents.data() == buffer->dataPointer());
|
|
||||||
|
|
||||||
// When detaching a buffer with typed object views, any jitcode accessing
|
// When detaching a buffer with typed object views, any jitcode accessing
|
||||||
// such views must be deoptimized so that detachment checks are performed.
|
// such views must be deoptimized so that detachment checks are performed.
|
||||||
@ -503,8 +501,6 @@ static void NoteViewBufferWasDetached(
|
|||||||
innerViews.removeViews(buffer);
|
innerViews.removeViews(buffer);
|
||||||
}
|
}
|
||||||
if (JSObject* view = buffer->firstView()) {
|
if (JSObject* view = buffer->firstView()) {
|
||||||
MOZ_ASSERT(!buffer->forInlineTypedObject(),
|
|
||||||
"Typed object buffers cannot be detached");
|
|
||||||
NoteViewBufferWasDetached(&view->as<ArrayBufferViewObject>(), newContents,
|
NoteViewBufferWasDetached(&view->as<ArrayBufferViewObject>(), newContents,
|
||||||
cx);
|
cx);
|
||||||
buffer->setFirstView(nullptr);
|
buffer->setFirstView(nullptr);
|
||||||
@ -561,7 +557,6 @@ void ArrayBufferObject::changeContents(JSContext* cx,
|
|||||||
BufferContents newContents,
|
BufferContents newContents,
|
||||||
OwnsState ownsState) {
|
OwnsState ownsState) {
|
||||||
MOZ_RELEASE_ASSERT(!isWasm());
|
MOZ_RELEASE_ASSERT(!isWasm());
|
||||||
MOZ_ASSERT(!forInlineTypedObject());
|
|
||||||
|
|
||||||
// Change buffer contents.
|
// Change buffer contents.
|
||||||
uint8_t* oldDataPointer = dataPointer();
|
uint8_t* oldDataPointer = dataPointer();
|
||||||
@ -931,19 +926,31 @@ bool js::CreateWasmBuffer(JSContext* cx, const wasm::Limits& memory,
|
|||||||
// Don't assert cx->wasmHaveSignalHandlers because (1) they aren't needed
|
// Don't assert cx->wasmHaveSignalHandlers because (1) they aren't needed
|
||||||
// for asm.js, (2) they are only installed for WebAssembly, not asm.js.
|
// for asm.js, (2) they are only installed for WebAssembly, not asm.js.
|
||||||
|
|
||||||
if (buffer->forInlineTypedObject()) {
|
// wasm buffers can be detached at any time.
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!buffer->isWasm() && buffer->isPreparedForAsmJS()) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Non-prepared-for-asm.js wasm buffers can be detached at any time.
|
|
||||||
if (buffer->isWasm()) {
|
if (buffer->isWasm()) {
|
||||||
|
MOZ_ASSERT(!buffer->isPreparedForAsmJS());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// asm.js code and associated buffers are potentially long-lived. Yet if
|
||||||
|
// |buffer->hasUserOwnedData()|, |buffer| *must* be detached by the user
|
||||||
|
// before the user-provided data is disposed. Eliminate the complexity of
|
||||||
|
// this edge case by not allowing buffers with user-provided content to be
|
||||||
|
// used with asm.js, as no callers exist that want to use such buffer with
|
||||||
|
// asm.js.
|
||||||
|
if (buffer->hasUserOwnedData()) {
|
||||||
|
MOZ_ASSERT(!buffer->isPreparedForAsmJS());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
MOZ_ASSERT(buffer->isPlainData() || buffer->isMapped() ||
|
||||||
|
buffer->isExternal());
|
||||||
|
|
||||||
|
// Buffers already prepared for asm.js need no further work.
|
||||||
|
if (buffer->isPreparedForAsmJS()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
if (!buffer->ownsData()) {
|
if (!buffer->ownsData()) {
|
||||||
BufferContents contents =
|
BufferContents contents =
|
||||||
AllocateArrayBufferContents(cx, buffer->byteLength());
|
AllocateArrayBufferContents(cx, buffer->byteLength());
|
||||||
@ -986,9 +993,12 @@ void ArrayBufferObject::releaseData(FreeOp* fop) {
|
|||||||
MOZ_ASSERT(ownsData());
|
MOZ_ASSERT(ownsData());
|
||||||
|
|
||||||
switch (bufferKind()) {
|
switch (bufferKind()) {
|
||||||
case PLAIN:
|
case PLAIN_DATA:
|
||||||
fop->free_(dataPointer());
|
fop->free_(dataPointer());
|
||||||
break;
|
break;
|
||||||
|
case USER_OWNED:
|
||||||
|
MOZ_ASSERT_UNREACHABLE("user-owned data should never be owned by this");
|
||||||
|
break;
|
||||||
case MAPPED:
|
case MAPPED:
|
||||||
gc::DeallocateMappedContent(dataPointer(), byteLength());
|
gc::DeallocateMappedContent(dataPointer(), byteLength());
|
||||||
break;
|
break;
|
||||||
@ -1005,6 +1015,11 @@ void ArrayBufferObject::releaseData(FreeOp* fop) {
|
|||||||
freeInfo()->freeFunc(dataPointer(), freeInfo()->freeUserData);
|
freeInfo()->freeFunc(dataPointer(), freeInfo()->freeUserData);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case BAD1:
|
||||||
|
case BAD2:
|
||||||
|
case BAD3:
|
||||||
|
MOZ_CRASH("invalid BufferKind encountered");
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1123,7 +1138,8 @@ Maybe<uint32_t> js::WasmArrayBufferMaxSize(
|
|||||||
newBuf->initialize(newSize, contents, OwnsData);
|
newBuf->initialize(newSize, contents, OwnsData);
|
||||||
|
|
||||||
memcpy(newBuf->dataPointer(), oldBuf->dataPointer(), oldBuf->byteLength());
|
memcpy(newBuf->dataPointer(), oldBuf->dataPointer(), oldBuf->byteLength());
|
||||||
ArrayBufferObject::detach(cx, oldBuf, BufferContents::createPlain(nullptr));
|
ArrayBufferObject::detach(cx, oldBuf,
|
||||||
|
BufferContents::createPlainData(nullptr));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1207,7 +1223,7 @@ ArrayBufferObject* ArrayBufferObject::create(
|
|||||||
int newSlots = JS_HOWMANY(nbytes, sizeof(Value));
|
int newSlots = JS_HOWMANY(nbytes, sizeof(Value));
|
||||||
MOZ_ASSERT(int(nbytes) <= newSlots * int(sizeof(Value)));
|
MOZ_ASSERT(int(nbytes) <= newSlots * int(sizeof(Value)));
|
||||||
nslots = reservedSlots + newSlots;
|
nslots = reservedSlots + newSlots;
|
||||||
contents = BufferContents::createPlain(nullptr);
|
contents = BufferContents::createPlainData(nullptr);
|
||||||
} else {
|
} else {
|
||||||
contents = AllocateArrayBufferContents(cx, nbytes);
|
contents = AllocateArrayBufferContents(cx, nbytes);
|
||||||
if (!contents) {
|
if (!contents) {
|
||||||
@ -1237,7 +1253,8 @@ ArrayBufferObject* ArrayBufferObject::create(
|
|||||||
if (!contents) {
|
if (!contents) {
|
||||||
void* data = obj->inlineDataPointer();
|
void* data = obj->inlineDataPointer();
|
||||||
memset(data, 0, nbytes);
|
memset(data, 0, nbytes);
|
||||||
obj->initialize(nbytes, BufferContents::createPlain(data), DoesntOwnData);
|
obj->initialize(nbytes, BufferContents::createPlainData(data),
|
||||||
|
DoesntOwnData);
|
||||||
} else {
|
} else {
|
||||||
obj->initialize(nbytes, contents, ownsState);
|
obj->initialize(nbytes, contents, ownsState);
|
||||||
}
|
}
|
||||||
@ -1247,7 +1264,7 @@ ArrayBufferObject* ArrayBufferObject::create(
|
|||||||
|
|
||||||
ArrayBufferObject* ArrayBufferObject::create(
|
ArrayBufferObject* ArrayBufferObject::create(
|
||||||
JSContext* cx, uint32_t nbytes, HandleObject proto /* = nullptr */) {
|
JSContext* cx, uint32_t nbytes, HandleObject proto /* = nullptr */) {
|
||||||
return create(cx, nbytes, BufferContents::createPlain(nullptr),
|
return create(cx, nbytes, BufferContents::createPlainData(nullptr),
|
||||||
OwnsState::OwnsData, proto);
|
OwnsState::OwnsData, proto);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1261,7 +1278,7 @@ ArrayBufferObject* ArrayBufferObject::createEmpty(JSContext* cx) {
|
|||||||
obj->setByteLength(0);
|
obj->setByteLength(0);
|
||||||
obj->setFlags(0);
|
obj->setFlags(0);
|
||||||
obj->setFirstView(nullptr);
|
obj->setFirstView(nullptr);
|
||||||
obj->setDataPointer(BufferContents::createPlain(nullptr), DoesntOwnData);
|
obj->setDataPointer(BufferContents::createPlainData(nullptr), DoesntOwnData);
|
||||||
|
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
@ -1291,7 +1308,8 @@ ArrayBufferObject* ArrayBufferObject::createFromNewRawBuffer(
|
|||||||
ArrayBufferObject::externalizeContents(JSContext* cx,
|
ArrayBufferObject::externalizeContents(JSContext* cx,
|
||||||
Handle<ArrayBufferObject*> buffer,
|
Handle<ArrayBufferObject*> buffer,
|
||||||
bool hasStealableContents) {
|
bool hasStealableContents) {
|
||||||
MOZ_ASSERT(buffer->isPlain(), "Only support doing this on plain ABOs");
|
MOZ_ASSERT(buffer->isPlainData(),
|
||||||
|
"only support doing this on ABOs containing plain data");
|
||||||
MOZ_ASSERT(!buffer->isDetached(), "must have contents to externalize");
|
MOZ_ASSERT(!buffer->isDetached(), "must have contents to externalize");
|
||||||
MOZ_ASSERT_IF(hasStealableContents, buffer->hasStealableContents());
|
MOZ_ASSERT_IF(hasStealableContents, buffer->hasStealableContents());
|
||||||
|
|
||||||
@ -1307,7 +1325,7 @@ ArrayBufferObject::externalizeContents(JSContext* cx,
|
|||||||
BufferContents newContents =
|
BufferContents newContents =
|
||||||
AllocateArrayBufferContents(cx, buffer->byteLength());
|
AllocateArrayBufferContents(cx, buffer->byteLength());
|
||||||
if (!newContents) {
|
if (!newContents) {
|
||||||
return BufferContents::createPlain(nullptr);
|
return BufferContents::createFailed();
|
||||||
}
|
}
|
||||||
memcpy(newContents.data(), contents.data(), buffer->byteLength());
|
memcpy(newContents.data(), contents.data(), buffer->byteLength());
|
||||||
buffer->changeContents(cx, newContents, DoesntOwnData);
|
buffer->changeContents(cx, newContents, DoesntOwnData);
|
||||||
@ -1330,7 +1348,7 @@ ArrayBufferObject::externalizeContents(JSContext* cx,
|
|||||||
if (hasStealableContents) {
|
if (hasStealableContents) {
|
||||||
// Return the old contents and reset the detached buffer's data
|
// Return the old contents and reset the detached buffer's data
|
||||||
// pointer. This pointer should never be accessed.
|
// pointer. This pointer should never be accessed.
|
||||||
auto newContents = BufferContents::createPlain(nullptr);
|
auto newContents = BufferContents::createPlainData(nullptr);
|
||||||
buffer->setOwnsData(DoesntOwnData); // Do not free the stolen data.
|
buffer->setOwnsData(DoesntOwnData); // Do not free the stolen data.
|
||||||
ArrayBufferObject::detach(cx, buffer, newContents);
|
ArrayBufferObject::detach(cx, buffer, newContents);
|
||||||
buffer->setOwnsData(DoesntOwnData); // Do not free the nullptr.
|
buffer->setOwnsData(DoesntOwnData); // Do not free the nullptr.
|
||||||
@ -1342,7 +1360,7 @@ ArrayBufferObject::externalizeContents(JSContext* cx,
|
|||||||
BufferContents contentsCopy =
|
BufferContents contentsCopy =
|
||||||
AllocateArrayBufferContents(cx, buffer->byteLength());
|
AllocateArrayBufferContents(cx, buffer->byteLength());
|
||||||
if (!contentsCopy) {
|
if (!contentsCopy) {
|
||||||
return BufferContents::createPlain(nullptr);
|
return BufferContents::createFailed();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (buffer->byteLength() > 0) {
|
if (buffer->byteLength() > 0) {
|
||||||
@ -1361,7 +1379,7 @@ ArrayBufferObject::externalizeContents(JSContext* cx,
|
|||||||
}
|
}
|
||||||
|
|
||||||
switch (buffer.bufferKind()) {
|
switch (buffer.bufferKind()) {
|
||||||
case PLAIN:
|
case PLAIN_DATA:
|
||||||
if (buffer.isPreparedForAsmJS()) {
|
if (buffer.isPreparedForAsmJS()) {
|
||||||
info->objectsMallocHeapElementsAsmJS +=
|
info->objectsMallocHeapElementsAsmJS +=
|
||||||
mallocSizeOf(buffer.dataPointer());
|
mallocSizeOf(buffer.dataPointer());
|
||||||
@ -1370,6 +1388,11 @@ ArrayBufferObject::externalizeContents(JSContext* cx,
|
|||||||
mallocSizeOf(buffer.dataPointer());
|
mallocSizeOf(buffer.dataPointer());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case USER_OWNED:
|
||||||
|
MOZ_ASSERT_UNREACHABLE(
|
||||||
|
"user-owned data should never be owned by this, and such memory "
|
||||||
|
"should be accounted for by the code that provided it");
|
||||||
|
break;
|
||||||
case MAPPED:
|
case MAPPED:
|
||||||
info->objectsNonHeapElementsNormal += buffer.byteLength();
|
info->objectsNonHeapElementsNormal += buffer.byteLength();
|
||||||
break;
|
break;
|
||||||
@ -1378,7 +1401,12 @@ ArrayBufferObject::externalizeContents(JSContext* cx,
|
|||||||
MOZ_ASSERT(buffer.wasmMappedSize() >= buffer.byteLength());
|
MOZ_ASSERT(buffer.wasmMappedSize() >= buffer.byteLength());
|
||||||
info->wasmGuardPages += buffer.wasmMappedSize() - buffer.byteLength();
|
info->wasmGuardPages += buffer.wasmMappedSize() - buffer.byteLength();
|
||||||
break;
|
break;
|
||||||
case KIND_MASK:
|
case EXTERNAL:
|
||||||
|
MOZ_CRASH("external buffers not currently supported");
|
||||||
|
break;
|
||||||
|
case BAD1:
|
||||||
|
case BAD2:
|
||||||
|
case BAD3:
|
||||||
MOZ_CRASH("bad bufferKind()");
|
MOZ_CRASH("bad bufferKind()");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1403,25 +1431,6 @@ ArrayBufferObject::externalizeContents(JSContext* cx,
|
|||||||
fromBuffer->dataPointer() + fromIndex, count);
|
fromBuffer->dataPointer() + fromIndex, count);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* static */ void ArrayBufferObject::trace(JSTracer* trc, JSObject* obj) {
|
|
||||||
// If this buffer is associated with an inline typed object,
|
|
||||||
// fix up the data pointer if the typed object was moved.
|
|
||||||
ArrayBufferObject& buf = obj->as<ArrayBufferObject>();
|
|
||||||
|
|
||||||
if (!buf.forInlineTypedObject()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
JSObject* view = MaybeForwarded(buf.firstView());
|
|
||||||
MOZ_ASSERT(view && view->is<InlineTransparentTypedObject>());
|
|
||||||
|
|
||||||
TraceManuallyBarrieredEdge(trc, &view,
|
|
||||||
"array buffer inline typed object owner");
|
|
||||||
buf.setFixedSlot(
|
|
||||||
DATA_SLOT,
|
|
||||||
PrivateValue(view->as<InlineTransparentTypedObject>().inlineTypedMem()));
|
|
||||||
}
|
|
||||||
|
|
||||||
/* static */ size_t ArrayBufferObject::objectMoved(JSObject* obj,
|
/* static */ size_t ArrayBufferObject::objectMoved(JSObject* obj,
|
||||||
JSObject* old) {
|
JSObject* old) {
|
||||||
ArrayBufferObject& dst = obj->as<ArrayBufferObject>();
|
ArrayBufferObject& dst = obj->as<ArrayBufferObject>();
|
||||||
@ -1634,7 +1643,7 @@ JS_FRIEND_API bool JS_DetachArrayBuffer(JSContext* cx, HandleObject obj) {
|
|||||||
|
|
||||||
ArrayBufferObject::BufferContents newContents =
|
ArrayBufferObject::BufferContents newContents =
|
||||||
buffer->hasStealableContents()
|
buffer->hasStealableContents()
|
||||||
? ArrayBufferObject::BufferContents::createPlain(nullptr)
|
? ArrayBufferObject::BufferContents::createPlainData(nullptr)
|
||||||
: buffer->contents();
|
: buffer->contents();
|
||||||
|
|
||||||
ArrayBufferObject::detach(cx, buffer, newContents);
|
ArrayBufferObject::detach(cx, buffer, newContents);
|
||||||
@ -1665,8 +1674,9 @@ JS_PUBLIC_API JSObject* JS_NewArrayBufferWithContents(JSContext* cx,
|
|||||||
CHECK_THREAD(cx);
|
CHECK_THREAD(cx);
|
||||||
MOZ_ASSERT_IF(!data, nbytes == 0);
|
MOZ_ASSERT_IF(!data, nbytes == 0);
|
||||||
|
|
||||||
ArrayBufferObject::BufferContents contents =
|
using BufferContents = ArrayBufferObject::BufferContents;
|
||||||
ArrayBufferObject::BufferContents::create<ArrayBufferObject::PLAIN>(data);
|
|
||||||
|
BufferContents contents = BufferContents::createPlainData(data);
|
||||||
return ArrayBufferObject::create(cx, nbytes, contents,
|
return ArrayBufferObject::create(cx, nbytes, contents,
|
||||||
ArrayBufferObject::OwnsData,
|
ArrayBufferObject::OwnsData,
|
||||||
/* proto = */ nullptr, TenuredObject);
|
/* proto = */ nullptr, TenuredObject);
|
||||||
@ -1695,8 +1705,10 @@ JS_PUBLIC_API JSObject* JS_NewArrayBufferWithExternalContents(JSContext* cx,
|
|||||||
AssertHeapIsIdle();
|
AssertHeapIsIdle();
|
||||||
CHECK_THREAD(cx);
|
CHECK_THREAD(cx);
|
||||||
MOZ_ASSERT_IF(!data, nbytes == 0);
|
MOZ_ASSERT_IF(!data, nbytes == 0);
|
||||||
ArrayBufferObject::BufferContents contents =
|
|
||||||
ArrayBufferObject::BufferContents::create<ArrayBufferObject::PLAIN>(data);
|
using BufferContents = ArrayBufferObject::BufferContents;
|
||||||
|
|
||||||
|
BufferContents contents = BufferContents::createUserOwned(data);
|
||||||
return ArrayBufferObject::create(cx, nbytes, contents,
|
return ArrayBufferObject::create(cx, nbytes, contents,
|
||||||
ArrayBufferObject::DoesntOwnData,
|
ArrayBufferObject::DoesntOwnData,
|
||||||
/* proto = */ nullptr, TenuredObject);
|
/* proto = */ nullptr, TenuredObject);
|
||||||
@ -1731,8 +1743,9 @@ JS_PUBLIC_API void* JS_ExternalizeArrayBufferContents(JSContext* cx,
|
|||||||
}
|
}
|
||||||
|
|
||||||
Handle<ArrayBufferObject*> buffer = obj.as<ArrayBufferObject>();
|
Handle<ArrayBufferObject*> buffer = obj.as<ArrayBufferObject>();
|
||||||
if (!buffer->isPlain()) {
|
if (!buffer->isPlainData()) {
|
||||||
// This operation isn't supported on mapped or wsm ArrayBufferObjects.
|
// This operation isn't supported on mapped or wasm ArrayBufferObjects, or
|
||||||
|
// on ArrayBufferObjects with user-provided data.
|
||||||
JS_ReportErrorNumberASCII(cx, GetErrorMessage, nullptr,
|
JS_ReportErrorNumberASCII(cx, GetErrorMessage, nullptr,
|
||||||
JSMSG_TYPED_ARRAY_BAD_ARGS);
|
JSMSG_TYPED_ARRAY_BAD_ARGS);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
@ -1785,12 +1798,16 @@ JS_PUBLIC_API void* JS_StealArrayBufferContents(JSContext* cx,
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
// The caller assumes that a plain malloc'd buffer is returned.
|
// The caller assumes that a plain malloc'd buffer is returned. To steal
|
||||||
// hasStealableContents is true for mapped buffers, so we must additionally
|
// actual contents, then, we must have |hasStealableContents()| *and* the
|
||||||
// require that the buffer is plain. In the future, we could consider
|
// contents must be |isPlainData()|. (Mapped data would not be malloc'd;
|
||||||
// returning something that handles releasing the memory.
|
// user-provided data we flat-out know nothing about at all -- although it
|
||||||
|
// *should* have not passed the |hasStealableContents()| check anyway.)
|
||||||
|
//
|
||||||
|
// In the future, we could consider returning something that handles
|
||||||
|
// releasing the memory, in the mapped-data case.
|
||||||
bool hasStealableContents =
|
bool hasStealableContents =
|
||||||
buffer->hasStealableContents() && buffer->isPlain();
|
buffer->hasStealableContents() && buffer->isPlainData();
|
||||||
|
|
||||||
AutoRealm ar(cx, buffer);
|
AutoRealm ar(cx, buffer);
|
||||||
return ArrayBufferObject::stealContents(cx, buffer, hasStealableContents)
|
return ArrayBufferObject::stealContents(cx, buffer, hasStealableContents)
|
||||||
|
@ -175,12 +175,27 @@ class ArrayBufferObject : public ArrayBufferObjectMaybeShared {
|
|||||||
};
|
};
|
||||||
|
|
||||||
enum BufferKind {
|
enum BufferKind {
|
||||||
PLAIN = 0, // malloced or inline data
|
/** Malloced or inline data. */
|
||||||
WASM = 1,
|
PLAIN_DATA = 0b000,
|
||||||
MAPPED = 2,
|
|
||||||
EXTERNAL = 3,
|
|
||||||
|
|
||||||
KIND_MASK = 0x3
|
/**
|
||||||
|
* User-owned memory. The associated buffer must be manually detached
|
||||||
|
* before the user invalidates (deallocates, reuses the storage of, &c.)
|
||||||
|
* the user-owned memory.
|
||||||
|
*/
|
||||||
|
USER_OWNED = 0b001,
|
||||||
|
|
||||||
|
WASM = 0b010,
|
||||||
|
MAPPED = 0b011,
|
||||||
|
EXTERNAL = 0b100,
|
||||||
|
|
||||||
|
// These kind-values are currently invalid. We intend to expand valid
|
||||||
|
// BufferKinds in the future to either partly or fully use these values.
|
||||||
|
BAD1 = 0b101,
|
||||||
|
BAD2 = 0b110,
|
||||||
|
BAD3 = 0b111,
|
||||||
|
|
||||||
|
KIND_MASK = 0b111
|
||||||
};
|
};
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@ -188,7 +203,7 @@ class ArrayBufferObject : public ArrayBufferObjectMaybeShared {
|
|||||||
// The flags also store the BufferKind
|
// The flags also store the BufferKind
|
||||||
BUFFER_KIND_MASK = BufferKind::KIND_MASK,
|
BUFFER_KIND_MASK = BufferKind::KIND_MASK,
|
||||||
|
|
||||||
DETACHED = 0x4,
|
DETACHED = 0b1000,
|
||||||
|
|
||||||
// The dataPointer() is owned by this buffer and should be released
|
// The dataPointer() is owned by this buffer and should be released
|
||||||
// when no longer in use. Releasing the pointer may be done by freeing,
|
// when no longer in use. Releasing the pointer may be done by freeing,
|
||||||
@ -199,20 +214,15 @@ class ArrayBufferObject : public ArrayBufferObjectMaybeShared {
|
|||||||
// allocate their data inline, and buffers that are created lazily for
|
// allocate their data inline, and buffers that are created lazily for
|
||||||
// typed objects with inline storage, in which case the buffer points
|
// typed objects with inline storage, in which case the buffer points
|
||||||
// directly to the typed object's storage.
|
// directly to the typed object's storage.
|
||||||
OWNS_DATA = 0x8,
|
OWNS_DATA = 0b1'0000,
|
||||||
|
|
||||||
// This array buffer was created lazily for a typed object with inline
|
|
||||||
// data. This implies both that the typed object owns the buffer's data
|
|
||||||
// and that the list of views sharing this buffer's data might be
|
|
||||||
// incomplete. Any missing views will be typed objects.
|
|
||||||
FOR_INLINE_TYPED_OBJECT = 0x10,
|
|
||||||
|
|
||||||
// Views of this buffer might include typed objects.
|
// Views of this buffer might include typed objects.
|
||||||
TYPED_OBJECT_VIEWS = 0x20,
|
TYPED_OBJECT_VIEWS = 0b10'0000,
|
||||||
|
|
||||||
// This PLAIN or WASM buffer has been prepared for asm.js and cannot
|
// This PLAIN_DATA, MAPPED, or EXTERNAL buffer (only WASM and USER_OWNED
|
||||||
// henceforth be transferred/detached.
|
// are excluded) has been prepared for asm.js and cannot henceforth be
|
||||||
FOR_ASMJS = 0x40
|
// transferred/detached.
|
||||||
|
FOR_ASMJS = 0b100'0000,
|
||||||
};
|
};
|
||||||
|
|
||||||
static_assert(JS_ARRAYBUFFER_DETACHED_FLAG == DETACHED,
|
static_assert(JS_ARRAYBUFFER_DETACHED_FLAG == DETACHED,
|
||||||
@ -248,8 +258,12 @@ class ArrayBufferObject : public ArrayBufferObjectMaybeShared {
|
|||||||
return BufferContents(static_cast<uint8_t*>(data), Kind);
|
return BufferContents(static_cast<uint8_t*>(data), Kind);
|
||||||
}
|
}
|
||||||
|
|
||||||
static BufferContents createPlain(void* data) {
|
static BufferContents createPlainData(void* data) {
|
||||||
return BufferContents(static_cast<uint8_t*>(data), PLAIN);
|
return BufferContents(static_cast<uint8_t*>(data), PLAIN_DATA);
|
||||||
|
}
|
||||||
|
|
||||||
|
static BufferContents createUserOwned(void* data) {
|
||||||
|
return BufferContents(static_cast<uint8_t*>(data), USER_OWNED);
|
||||||
}
|
}
|
||||||
|
|
||||||
static BufferContents createExternal(void* data,
|
static BufferContents createExternal(void* data,
|
||||||
@ -259,6 +273,10 @@ class ArrayBufferObject : public ArrayBufferObjectMaybeShared {
|
|||||||
freeUserData);
|
freeUserData);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static BufferContents createFailed() {
|
||||||
|
return BufferContents(nullptr, PLAIN_DATA);
|
||||||
|
}
|
||||||
|
|
||||||
uint8_t* data() const { return data_; }
|
uint8_t* data() const { return data_; }
|
||||||
BufferKind kind() const { return kind_; }
|
BufferKind kind() const { return kind_; }
|
||||||
JS::BufferContentsFreeFunc freeFunc() const { return free_; }
|
JS::BufferContentsFreeFunc freeFunc() const { return free_; }
|
||||||
@ -304,7 +322,6 @@ class ArrayBufferObject : public ArrayBufferObjectMaybeShared {
|
|||||||
Handle<ArrayBufferObject*> fromBuffer,
|
Handle<ArrayBufferObject*> fromBuffer,
|
||||||
uint32_t fromIndex, uint32_t count);
|
uint32_t fromIndex, uint32_t count);
|
||||||
|
|
||||||
static void trace(JSTracer* trc, JSObject* obj);
|
|
||||||
static size_t objectMoved(JSObject* obj, JSObject* old);
|
static size_t objectMoved(JSObject* obj, JSObject* old);
|
||||||
|
|
||||||
static BufferContents externalizeContents(JSContext* cx,
|
static BufferContents externalizeContents(JSContext* cx,
|
||||||
@ -379,7 +396,10 @@ class ArrayBufferObject : public ArrayBufferObjectMaybeShared {
|
|||||||
BufferKind bufferKind() const {
|
BufferKind bufferKind() const {
|
||||||
return BufferKind(flags() & BUFFER_KIND_MASK);
|
return BufferKind(flags() & BUFFER_KIND_MASK);
|
||||||
}
|
}
|
||||||
bool isPlain() const { return bufferKind() == PLAIN; }
|
|
||||||
|
bool isPlainData() const { return bufferKind() == PLAIN_DATA; }
|
||||||
|
bool hasUserOwnedData() const { return bufferKind() == USER_OWNED; }
|
||||||
|
|
||||||
bool isWasm() const { return bufferKind() == WASM; }
|
bool isWasm() const { return bufferKind() == WASM; }
|
||||||
bool isMapped() const { return bufferKind() == MAPPED; }
|
bool isMapped() const { return bufferKind() == MAPPED; }
|
||||||
bool isExternal() const { return bufferKind() == EXTERNAL; }
|
bool isExternal() const { return bufferKind() == EXTERNAL; }
|
||||||
@ -409,15 +429,8 @@ class ArrayBufferObject : public ArrayBufferObjectMaybeShared {
|
|||||||
static size_t offsetOfFlagsSlot() { return getFixedSlotOffset(FLAGS_SLOT); }
|
static size_t offsetOfFlagsSlot() { return getFixedSlotOffset(FLAGS_SLOT); }
|
||||||
static size_t offsetOfDataSlot() { return getFixedSlotOffset(DATA_SLOT); }
|
static size_t offsetOfDataSlot() { return getFixedSlotOffset(DATA_SLOT); }
|
||||||
|
|
||||||
void setForInlineTypedObject() {
|
|
||||||
setFlags(flags() | FOR_INLINE_TYPED_OBJECT);
|
|
||||||
}
|
|
||||||
void setHasTypedObjectViews() { setFlags(flags() | TYPED_OBJECT_VIEWS); }
|
void setHasTypedObjectViews() { setFlags(flags() | TYPED_OBJECT_VIEWS); }
|
||||||
|
|
||||||
bool forInlineTypedObject() const {
|
|
||||||
return flags() & FOR_INLINE_TYPED_OBJECT;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void setDataPointer(BufferContents contents, OwnsState ownsState);
|
void setDataPointer(BufferContents contents, OwnsState ownsState);
|
||||||
void setByteLength(uint32_t length);
|
void setByteLength(uint32_t length);
|
||||||
@ -433,7 +446,12 @@ class ArrayBufferObject : public ArrayBufferObjectMaybeShared {
|
|||||||
bool hasTypedObjectViews() const { return flags() & TYPED_OBJECT_VIEWS; }
|
bool hasTypedObjectViews() const { return flags() & TYPED_OBJECT_VIEWS; }
|
||||||
|
|
||||||
void setIsDetached() { setFlags(flags() | DETACHED); }
|
void setIsDetached() { setFlags(flags() | DETACHED); }
|
||||||
void setIsPreparedForAsmJS() { setFlags(flags() | FOR_ASMJS); }
|
void setIsPreparedForAsmJS() {
|
||||||
|
MOZ_ASSERT(!isWasm());
|
||||||
|
MOZ_ASSERT(!hasUserOwnedData());
|
||||||
|
MOZ_ASSERT(isPlainData() || isMapped() || isExternal());
|
||||||
|
setFlags(flags() | FOR_ASMJS);
|
||||||
|
}
|
||||||
|
|
||||||
void initialize(size_t byteLength, BufferContents contents,
|
void initialize(size_t byteLength, BufferContents contents,
|
||||||
OwnsState ownsState) {
|
OwnsState ownsState) {
|
||||||
|
@ -36,12 +36,6 @@ using namespace js;
|
|||||||
uint32_t offset = uint32_t(obj->getFixedSlot(BYTEOFFSET_SLOT).toInt32());
|
uint32_t offset = uint32_t(obj->getFixedSlot(BYTEOFFSET_SLOT).toInt32());
|
||||||
MOZ_ASSERT(offset <= INT32_MAX);
|
MOZ_ASSERT(offset <= INT32_MAX);
|
||||||
|
|
||||||
// We don't expose the underlying ArrayBuffer for typed objects,
|
|
||||||
// and we don't allow constructing a TypedObject from an arbitrary
|
|
||||||
// ArrayBuffer, so we should never have a TypedArray/DataView with
|
|
||||||
// a buffer that has TypedObject views.
|
|
||||||
MOZ_RELEASE_ASSERT(!buf.forInlineTypedObject());
|
|
||||||
|
|
||||||
MOZ_ASSERT_IF(buf.dataPointer() == nullptr, offset == 0);
|
MOZ_ASSERT_IF(buf.dataPointer() == nullptr, offset == 0);
|
||||||
|
|
||||||
// The data may or may not be inline with the buffer. The buffer
|
// The data may or may not be inline with the buffer. The buffer
|
||||||
|
@ -2654,7 +2654,6 @@ static const JSFunctionSpec intrinsic_functions[] = {
|
|||||||
// See builtin/TypedObject.h for descriptors of the typedobj functions.
|
// See builtin/TypedObject.h for descriptors of the typedobj functions.
|
||||||
JS_FN("NewOpaqueTypedObject", js::NewOpaqueTypedObject, 1, 0),
|
JS_FN("NewOpaqueTypedObject", js::NewOpaqueTypedObject, 1, 0),
|
||||||
JS_FN("NewDerivedTypedObject", js::NewDerivedTypedObject, 3, 0),
|
JS_FN("NewDerivedTypedObject", js::NewDerivedTypedObject, 3, 0),
|
||||||
JS_FN("TypedObjectBuffer", TypedObject::GetBuffer, 1, 0),
|
|
||||||
JS_FN("TypedObjectByteOffset", TypedObject::GetByteOffset, 1, 0),
|
JS_FN("TypedObjectByteOffset", TypedObject::GetByteOffset, 1, 0),
|
||||||
JS_FN("AttachTypedObject", js::AttachTypedObject, 3, 0),
|
JS_FN("AttachTypedObject", js::AttachTypedObject, 3, 0),
|
||||||
JS_FN("TypedObjectIsAttached", js::TypedObjectIsAttached, 1, 0),
|
JS_FN("TypedObjectIsAttached", js::TypedObjectIsAttached, 1, 0),
|
||||||
|
@ -17,13 +17,13 @@
|
|||||||
#include "mozilla/ArenaAllocator.h"
|
#include "mozilla/ArenaAllocator.h"
|
||||||
#include "mozilla/ArrayUtils.h"
|
#include "mozilla/ArrayUtils.h"
|
||||||
#include "mozilla/Attributes.h"
|
#include "mozilla/Attributes.h"
|
||||||
|
#include "mozilla/Components.h"
|
||||||
#include "mozilla/dom/PContent.h"
|
#include "mozilla/dom/PContent.h"
|
||||||
#include "mozilla/HashFunctions.h"
|
#include "mozilla/HashFunctions.h"
|
||||||
#include "mozilla/HashTable.h"
|
#include "mozilla/HashTable.h"
|
||||||
#include "mozilla/Logging.h"
|
#include "mozilla/Logging.h"
|
||||||
#include "mozilla/Maybe.h"
|
#include "mozilla/Maybe.h"
|
||||||
#include "mozilla/MemoryReporting.h"
|
#include "mozilla/MemoryReporting.h"
|
||||||
#include "mozilla/ModuleUtils.h"
|
|
||||||
#include "mozilla/Omnijar.h"
|
#include "mozilla/Omnijar.h"
|
||||||
#include "mozilla/Preferences.h"
|
#include "mozilla/Preferences.h"
|
||||||
#include "mozilla/ResultExtensions.h"
|
#include "mozilla/ResultExtensions.h"
|
||||||
@ -5409,35 +5409,16 @@ static void InitVarCachePref(const nsACString& aName, float* aCache,
|
|||||||
// Module and factory stuff
|
// Module and factory stuff
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
|
|
||||||
NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(Preferences,
|
NS_IMPL_COMPONENT_FACTORY(nsPrefLocalizedString) {
|
||||||
Preferences::GetInstanceForService)
|
auto str = MakeRefPtr<nsPrefLocalizedString>();
|
||||||
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsPrefLocalizedString, Init)
|
if (NS_SUCCEEDED(str->Init())) {
|
||||||
|
return str.forget().downcast<nsISupports>();
|
||||||
|
}
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
static NS_DEFINE_CID(kPrefServiceCID, NS_PREFSERVICE_CID);
|
namespace mozilla {
|
||||||
static NS_DEFINE_CID(kPrefLocalizedStringCID, NS_PREFLOCALIZEDSTRING_CID);
|
|
||||||
|
|
||||||
static mozilla::Module::CIDEntry kPrefCIDs[] = {
|
void UnloadPrefsModule() { Preferences::Shutdown(); }
|
||||||
{&kPrefServiceCID, true, nullptr, PreferencesConstructor,
|
|
||||||
Module::ALLOW_IN_SOCKET_PROCESS},
|
|
||||||
{&kPrefLocalizedStringCID, false, nullptr,
|
|
||||||
nsPrefLocalizedStringConstructor},
|
|
||||||
{nullptr}};
|
|
||||||
|
|
||||||
static mozilla::Module::ContractIDEntry kPrefContracts[] = {
|
}
|
||||||
{NS_PREFSERVICE_CONTRACTID, &kPrefServiceCID,
|
|
||||||
Module::ALLOW_IN_SOCKET_PROCESS},
|
|
||||||
{NS_PREFLOCALIZEDSTRING_CONTRACTID, &kPrefLocalizedStringCID},
|
|
||||||
{nullptr}};
|
|
||||||
|
|
||||||
static void UnloadPrefsModule() { Preferences::Shutdown(); }
|
|
||||||
|
|
||||||
static const mozilla::Module kPrefModule = {mozilla::Module::kVersion,
|
|
||||||
kPrefCIDs,
|
|
||||||
kPrefContracts,
|
|
||||||
nullptr,
|
|
||||||
nullptr,
|
|
||||||
nullptr,
|
|
||||||
UnloadPrefsModule,
|
|
||||||
Module::ALLOW_IN_SOCKET_PROCESS};
|
|
||||||
|
|
||||||
NSMODULE_DEFN(nsPrefModule) = &kPrefModule;
|
|
||||||
|
@ -33,6 +33,8 @@ class nsPrefBranch;
|
|||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
|
|
||||||
|
void UnloadPrefsModule();
|
||||||
|
|
||||||
// A typesafe version of PrefChangeFunc, with its data argument type deduced
|
// A typesafe version of PrefChangeFunc, with its data argument type deduced
|
||||||
// from the type of the argument passed to RegisterCallback.
|
// from the type of the argument passed to RegisterCallback.
|
||||||
//
|
//
|
||||||
|
27
modules/libpref/components.conf
Normal file
27
modules/libpref/components.conf
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
# -*- 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/.
|
||||||
|
|
||||||
|
Headers = [
|
||||||
|
'mozilla/Preferences.h',
|
||||||
|
]
|
||||||
|
|
||||||
|
UnloadFunc = 'mozilla::UnloadPrefsModule'
|
||||||
|
|
||||||
|
Classes = [
|
||||||
|
{
|
||||||
|
'cid': '{91ca2441-050f-4f7c-9df8-75b40ea40156}',
|
||||||
|
'contract_ids': ['@mozilla.org/preferences-service;1'],
|
||||||
|
'singleton': True,
|
||||||
|
'type': 'mozilla::Preferences',
|
||||||
|
'headers': ['mozilla/Preferences.h'],
|
||||||
|
'constructor': 'mozilla::Preferences::GetInstanceForService',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'cid': '{064d9cee-1dd2-11b2-83e3-d25ab0193c26}',
|
||||||
|
'contract_ids': ['@mozilla.org/pref-localizedstring;1'],
|
||||||
|
'type': 'nsPrefLocalizedString',
|
||||||
|
},
|
||||||
|
]
|
@ -1442,6 +1442,9 @@ pref("privacy.firstparty.isolate.restrict_opener_access", true);
|
|||||||
// If you do set it, to work around some broken website, please file a bug with
|
// If you do set it, to work around some broken website, please file a bug with
|
||||||
// information so we can understand why it is needed.
|
// information so we can understand why it is needed.
|
||||||
pref("privacy.resistFingerprinting.autoDeclineNoUserInputCanvasPrompts", true);
|
pref("privacy.resistFingerprinting.autoDeclineNoUserInputCanvasPrompts", true);
|
||||||
|
// The log level for browser console messages logged in RFPHelper.jsm
|
||||||
|
// Change to 'All' and restart to see the messages
|
||||||
|
pref("privacy.resistFingerprinting.jsmloglevel", "Warn");
|
||||||
// A subset of Resist Fingerprinting protections focused specifically on timers for testing
|
// A subset of Resist Fingerprinting protections focused specifically on timers for testing
|
||||||
// This affects the Animation API, the performance APIs, Date.getTime, Event.timestamp,
|
// This affects the Animation API, the performance APIs, Date.getTime, Event.timestamp,
|
||||||
// File.lastModified, audioContext.currentTime, canvas.captureStream.currentTime
|
// File.lastModified, audioContext.currentTime, canvas.captureStream.currentTime
|
||||||
|
@ -36,6 +36,10 @@ UNIFIED_SOURCES += [
|
|||||||
'SharedPrefMap.cpp',
|
'SharedPrefMap.cpp',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
XPCOM_MANIFESTS += [
|
||||||
|
'components.conf',
|
||||||
|
]
|
||||||
|
|
||||||
include('/ipc/chromium/chromium-config.mozbuild')
|
include('/ipc/chromium/chromium-config.mozbuild')
|
||||||
|
|
||||||
FINAL_LIBRARY = 'xul'
|
FINAL_LIBRARY = 'xul'
|
||||||
|
@ -4,7 +4,14 @@
|
|||||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
# 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/.
|
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
|
|
||||||
Classes = []
|
Classes = [
|
||||||
|
{
|
||||||
|
'cid': '{14a50f2b-7ff6-48a5-88e3-615fd111f5d3}',
|
||||||
|
'contract_ids': ['@mozilla.org/toolkit/components/mdnsresponder/dns-info;1'],
|
||||||
|
'type': 'mozilla::net::nsDNSServiceInfo',
|
||||||
|
'headers': ['/netwerk/dns/mdns/libmdns/nsDNSServiceInfo.h'],
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
if buildconfig.substs['MOZ_WIDGET_TOOLKIT'] != 'cocoa':
|
if buildconfig.substs['MOZ_WIDGET_TOOLKIT'] != 'cocoa':
|
||||||
Classes += [
|
Classes += [
|
||||||
|
@ -34,7 +34,10 @@ else:
|
|||||||
|
|
||||||
UNIFIED_SOURCES += [
|
UNIFIED_SOURCES += [
|
||||||
'nsDNSServiceInfo.cpp',
|
'nsDNSServiceInfo.cpp',
|
||||||
'nsMulticastDNSModule.cpp',
|
]
|
||||||
|
|
||||||
|
XPCOM_MANIFESTS += [
|
||||||
|
'components.conf',
|
||||||
]
|
]
|
||||||
|
|
||||||
XPCOM_MANIFESTS += [
|
XPCOM_MANIFESTS += [
|
||||||
|
@ -1,63 +0,0 @@
|
|||||||
/* -*- Mode: C++; 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/. */
|
|
||||||
|
|
||||||
#if defined(MOZ_WIDGET_COCOA)
|
|
||||||
# define ENABLE_DNS_SERVICE_DISCOVERY
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "mozilla/ModuleUtils.h"
|
|
||||||
|
|
||||||
#ifdef ENABLE_DNS_SERVICE_DISCOVERY
|
|
||||||
# include "nsDNSServiceDiscovery.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "nsDNSServiceInfo.h"
|
|
||||||
|
|
||||||
#ifdef ENABLE_DNS_SERVICE_DISCOVERY
|
|
||||||
using mozilla::net::nsDNSServiceDiscovery;
|
|
||||||
# define DNSSERVICEDISCOVERY_CID \
|
|
||||||
{ \
|
|
||||||
0x8df43d23, 0xd3f9, 0x4dd5, { \
|
|
||||||
0xb9, 0x65, 0xde, 0x2c, 0xa3, 0xf6, 0xa4, 0x2c \
|
|
||||||
} \
|
|
||||||
}
|
|
||||||
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsDNSServiceDiscovery, Init)
|
|
||||||
NS_DEFINE_NAMED_CID(DNSSERVICEDISCOVERY_CID);
|
|
||||||
#endif // ENABLE_DNS_SERVICE_DISCOVERY
|
|
||||||
|
|
||||||
using mozilla::net::nsDNSServiceInfo;
|
|
||||||
#define DNSSERVICEINFO_CID \
|
|
||||||
{ \
|
|
||||||
0x14a50f2b, 0x7ff6, 0x48a5, { \
|
|
||||||
0x88, 0xe3, 0x61, 0x5f, 0xd1, 0x11, 0xf5, 0xd3 \
|
|
||||||
} \
|
|
||||||
}
|
|
||||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsDNSServiceInfo)
|
|
||||||
NS_DEFINE_NAMED_CID(DNSSERVICEINFO_CID);
|
|
||||||
|
|
||||||
static const mozilla::Module::CIDEntry knsDNSServiceDiscoveryCIDs[] = {
|
|
||||||
#ifdef ENABLE_DNS_SERVICE_DISCOVERY
|
|
||||||
{&kDNSSERVICEDISCOVERY_CID, false, nullptr,
|
|
||||||
nsDNSServiceDiscoveryConstructor},
|
|
||||||
#endif
|
|
||||||
{&kDNSSERVICEINFO_CID, false, nullptr, nsDNSServiceInfoConstructor},
|
|
||||||
{nullptr}};
|
|
||||||
|
|
||||||
static const mozilla::Module::ContractIDEntry
|
|
||||||
knsDNSServiceDiscoveryContracts[] = {
|
|
||||||
#ifdef ENABLE_DNS_SERVICE_DISCOVERY
|
|
||||||
{DNSSERVICEDISCOVERY_CONTRACT_ID, &kDNSSERVICEDISCOVERY_CID},
|
|
||||||
#endif
|
|
||||||
{DNSSERVICEINFO_CONTRACT_ID, &kDNSSERVICEINFO_CID},
|
|
||||||
{nullptr}};
|
|
||||||
|
|
||||||
static const mozilla::Module::CategoryEntry knsDNSServiceDiscoveryCategories[] =
|
|
||||||
{{nullptr}};
|
|
||||||
|
|
||||||
static const mozilla::Module knsDNSServiceDiscoveryModule = {
|
|
||||||
mozilla::Module::kVersion, knsDNSServiceDiscoveryCIDs,
|
|
||||||
knsDNSServiceDiscoveryContracts, knsDNSServiceDiscoveryCategories};
|
|
||||||
|
|
||||||
NSMODULE_DEFN(nsDNSServiceDiscoveryModule) = &knsDNSServiceDiscoveryModule;
|
|
13
netwerk/protocol/gio/components.conf
Normal file
13
netwerk/protocol/gio/components.conf
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
# -*- 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/.
|
||||||
|
|
||||||
|
Classes = [
|
||||||
|
{
|
||||||
|
'cid': '{ee706783-3af8-4d19-9e84-e2ebfe213480}',
|
||||||
|
'contract_ids': ['@mozilla.org/network/protocol;1?name=moz-gio'],
|
||||||
|
'type': 'nsGIOProtocolHandler',
|
||||||
|
},
|
||||||
|
]
|
@ -8,6 +8,10 @@ SOURCES += [
|
|||||||
'nsGIOProtocolHandler.cpp',
|
'nsGIOProtocolHandler.cpp',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
XPCOM_MANIFESTS += [
|
||||||
|
'components.conf',
|
||||||
|
]
|
||||||
|
|
||||||
FINAL_LIBRARY = 'xul'
|
FINAL_LIBRARY = 'xul'
|
||||||
|
|
||||||
CXXFLAGS += CONFIG['TK_CFLAGS']
|
CXXFLAGS += CONFIG['TK_CFLAGS']
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
* This code is based on original Mozilla gnome-vfs extension. It implements
|
* This code is based on original Mozilla gnome-vfs extension. It implements
|
||||||
* input stream provided by GVFS/GIO.
|
* input stream provided by GVFS/GIO.
|
||||||
*/
|
*/
|
||||||
#include "mozilla/ModuleUtils.h"
|
#include "mozilla/Components.h"
|
||||||
#include "mozilla/NullPrincipal.h"
|
#include "mozilla/NullPrincipal.h"
|
||||||
#include "nsIPrefService.h"
|
#include "nsIPrefService.h"
|
||||||
#include "nsIPrefBranch.h"
|
#include "nsIPrefBranch.h"
|
||||||
@ -32,6 +32,8 @@
|
|||||||
#include <gio/gio.h>
|
#include <gio/gio.h>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
|
using namespace mozilla;
|
||||||
|
|
||||||
#define MOZ_GIO_SCHEME "moz-gio"
|
#define MOZ_GIO_SCHEME "moz-gio"
|
||||||
#define MOZ_GIO_SUPPORTED_PROTOCOLS "network.gio.supported-protocols"
|
#define MOZ_GIO_SUPPORTED_PROTOCOLS "network.gio.supported-protocols"
|
||||||
|
|
||||||
@ -845,6 +847,14 @@ class nsGIOProtocolHandler final : public nsIProtocolHandler,
|
|||||||
|
|
||||||
NS_IMPL_ISUPPORTS(nsGIOProtocolHandler, nsIProtocolHandler, nsIObserver)
|
NS_IMPL_ISUPPORTS(nsGIOProtocolHandler, nsIProtocolHandler, nsIObserver)
|
||||||
|
|
||||||
|
NS_IMPL_COMPONENT_FACTORY(nsGIOProtocolHandler) {
|
||||||
|
auto inst = MakeRefPtr<nsGIOProtocolHandler>();
|
||||||
|
if (NS_SUCCEEDED(inst->Init())) {
|
||||||
|
return inst.forget().downcast<nsIProtocolHandler>();
|
||||||
|
}
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
nsresult nsGIOProtocolHandler::Init() {
|
nsresult nsGIOProtocolHandler::Init() {
|
||||||
nsCOMPtr<nsIPrefBranch> prefs = do_GetService(NS_PREFSERVICE_CONTRACTID);
|
nsCOMPtr<nsIPrefBranch> prefs = do_GetService(NS_PREFSERVICE_CONTRACTID);
|
||||||
if (prefs) {
|
if (prefs) {
|
||||||
@ -1008,30 +1018,3 @@ nsGIOProtocolHandler::Observe(nsISupports *aSubject, const char *aTopic,
|
|||||||
}
|
}
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
#define NS_GIOPROTOCOLHANDLER_CID \
|
|
||||||
{ /* ee706783-3af8-4d19-9e84-e2ebfe213480 */ \
|
|
||||||
0xee706783, 0x3af8, 0x4d19, { \
|
|
||||||
0x9e, 0x84, 0xe2, 0xeb, 0xfe, 0x21, 0x34, 0x80 \
|
|
||||||
} \
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsGIOProtocolHandler, Init)
|
|
||||||
NS_DEFINE_NAMED_CID(NS_GIOPROTOCOLHANDLER_CID);
|
|
||||||
|
|
||||||
static const mozilla::Module::CIDEntry kVFSCIDs[] = {
|
|
||||||
{&kNS_GIOPROTOCOLHANDLER_CID, false, nullptr,
|
|
||||||
nsGIOProtocolHandlerConstructor},
|
|
||||||
{nullptr}};
|
|
||||||
|
|
||||||
static const mozilla::Module::ContractIDEntry kVFSContracts[] = {
|
|
||||||
{NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX MOZ_GIO_SCHEME,
|
|
||||||
&kNS_GIOPROTOCOLHANDLER_CID},
|
|
||||||
{nullptr}};
|
|
||||||
|
|
||||||
static const mozilla::Module kVFSModule = {mozilla::Module::kVersion, kVFSCIDs,
|
|
||||||
kVFSContracts};
|
|
||||||
|
|
||||||
NSMODULE_DEFN(nsGIOModule) = &kVFSModule;
|
|
||||||
|
20
parser/htmlparser/components.conf
Normal file
20
parser/htmlparser/components.conf
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
# -*- 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/.
|
||||||
|
|
||||||
|
Headers = [
|
||||||
|
'nsHTMLTags.h',
|
||||||
|
]
|
||||||
|
|
||||||
|
UnloadFunc = 'nsHTMLTags::ReleaseTable'
|
||||||
|
|
||||||
|
Classes = [
|
||||||
|
{
|
||||||
|
'cid': '{2ce606b0-bee6-11d1-aad9-00805f8a3e14}',
|
||||||
|
'contract_ids': [],
|
||||||
|
'type': 'nsParser',
|
||||||
|
'headers': ['/parser/htmlparser/nsParser.h'],
|
||||||
|
},
|
||||||
|
]
|
@ -46,6 +46,10 @@ UNIFIED_SOURCES += [
|
|||||||
'nsScannerString.cpp',
|
'nsScannerString.cpp',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
XPCOM_MANIFESTS += [
|
||||||
|
'components.conf',
|
||||||
|
]
|
||||||
|
|
||||||
FINAL_LIBRARY = 'xul'
|
FINAL_LIBRARY = 'xul'
|
||||||
|
|
||||||
if CONFIG['CC_TYPE'] in ('clang', 'gcc'):
|
if CONFIG['CC_TYPE'] in ('clang', 'gcc'):
|
||||||
|
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