Merge mozilla-central to autoland. a=merge CLOSED TREE

This commit is contained in:
Brindusan Cristian 2018-08-23 06:43:53 +03:00
Родитель b0a1f4327b 7ac19aed65
Коммит 477abceb8a
107 изменённых файлов: 1215 добавлений и 2603 удалений

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

@ -1489,12 +1489,16 @@ pref("media.gmp-provider.enabled", true);
pref("browser.contentblocking.enabled", true);
pref("browser.contentblocking.cookies-site-data.ui.reject-trackers.recommended", true);
pref("browser.contentblocking.fastblock.control-center.ui.enabled", true);
pref("browser.contentblocking.trackingprotection.control-center.ui.enabled", true);
#ifdef NIGHTLY_BUILD
pref("browser.contentblocking.ui.enabled", true);
pref("browser.contentblocking.cookies-site-data.ui.reject-trackers.enabled", true);
pref("browser.contentblocking.rejecttrackers.control-center.ui.enabled", true);
#else
pref("browser.contentblocking.ui.enabled", false);
pref("browser.contentblocking.cookies-site-data.ui.reject-trackers.enabled", false);
pref("browser.contentblocking.rejecttrackers.control-center.ui.enabled", false);
#endif
#ifdef NIGHTLY_BUILD
pref("browser.contentblocking.reportBreakage.enabled", true);

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

@ -4,6 +4,7 @@
var FastBlock = {
PREF_ENABLED: "browser.fastblock.enabled",
PREF_UI_ENABLED: "browser.contentblocking.fastblock.control-center.ui.enabled",
get categoryItem() {
delete this.categoryItem;
@ -12,12 +13,14 @@ var FastBlock = {
init() {
XPCOMUtils.defineLazyPreferenceGetter(this, "enabled", this.PREF_ENABLED, false);
XPCOMUtils.defineLazyPreferenceGetter(this, "visible", this.PREF_UI_ENABLED, false);
},
};
var TrackingProtection = {
PREF_ENABLED_GLOBALLY: "privacy.trackingprotection.enabled",
PREF_ENABLED_IN_PRIVATE_WINDOWS: "privacy.trackingprotection.pbmode.enabled",
PREF_UI_ENABLED: "browser.contentblocking.trackingprotection.control-center.ui.enabled",
enabledGlobally: false,
enabledInPrivateWindows: false,
@ -61,6 +64,8 @@ var TrackingProtection = {
Services.prefs.addObserver(this.PREF_ENABLED_GLOBALLY, this);
Services.prefs.addObserver(this.PREF_ENABLED_IN_PRIVATE_WINDOWS, this);
XPCOMUtils.defineLazyPreferenceGetter(this, "visible", this.PREF_UI_ENABLED, false);
},
uninit() {
@ -125,6 +130,27 @@ var TrackingProtection = {
},
};
var ThirdPartyCookies = {
PREF_ENABLED: "network.cookie.cookieBehavior",
PREF_ENABLED_VALUE: Ci.nsICookieService.BEHAVIOR_REJECT_TRACKER,
PREF_UI_ENABLED: "browser.contentblocking.rejecttrackers.control-center.ui.enabled",
get categoryItem() {
delete this.categoryItem;
return this.categoryItem =
document.getElementById("identity-popup-content-blocking-category-3rdpartycookies");
},
init() {
XPCOMUtils.defineLazyPreferenceGetter(this, "behaviorPref", this.PREF_ENABLED,
Ci.nsICookieService.BEHAVIOR_ACCEPT);
XPCOMUtils.defineLazyPreferenceGetter(this, "visible", this.PREF_UI_ENABLED, false);
},
get enabled() {
return this.behaviorPref == this.PREF_ENABLED_VALUE;
},
};
var ContentBlocking = {
// If the user ignores the doorhanger, we stop showing it after some time.
@ -189,7 +215,7 @@ var ContentBlocking = {
//
// It may also contain an init() and uninit() function, which will be called
// on ContentBlocking.init() and ContentBlocking.uninit().
blockers: [FastBlock, TrackingProtection],
blockers: [FastBlock, TrackingProtection, ThirdPartyCookies],
get _baseURIForChannelClassifier() {
// Convert document URI into the format used by
@ -335,13 +361,16 @@ var ContentBlocking = {
body += "\n**Preferences**\n";
body += `${TrackingProtection.PREF_ENABLED_GLOBALLY}: ${Services.prefs.getBoolPref(TrackingProtection.PREF_ENABLED_GLOBALLY)}\n`;
body += `${TrackingProtection.PREF_ENABLED_IN_PRIVATE_WINDOWS}: ${Services.prefs.getBoolPref(TrackingProtection.PREF_ENABLED_IN_PRIVATE_WINDOWS)}\n`;
body += `${TrackingProtection.PREF_UI_ENABLED}: ${Services.prefs.getBoolPref(TrackingProtection.PREF_UI_ENABLED)}\n`;
body += `urlclassifier.trackingTable: ${Services.prefs.getStringPref("urlclassifier.trackingTable")}\n`;
body += `network.http.referer.defaultPolicy: ${Services.prefs.getIntPref("network.http.referer.defaultPolicy")}\n`;
body += `network.http.referer.defaultPolicy.pbmode: ${Services.prefs.getIntPref("network.http.referer.defaultPolicy.pbmode")}\n`;
body += `network.cookie.cookieBehavior: ${Services.prefs.getIntPref("network.cookie.cookieBehavior")}\n`;
body += `${ThirdPartyCookies.PREF_UI_ENABLED}: ${Services.prefs.getBoolPref(ThirdPartyCookies.PREF_UI_ENABLED)}\n`;
body += `${ThirdPartyCookies.PREF_ENABLED}: ${Services.prefs.getIntPref(ThirdPartyCookies.PREF_ENABLED)}\n`;
body += `network.cookie.lifetimePolicy: ${Services.prefs.getIntPref("network.cookie.lifetimePolicy")}\n`;
body += `privacy.restrict3rdpartystorage.expiration: ${Services.prefs.getIntPref("privacy.restrict3rdpartystorage.expiration")}\n`;
body += `${FastBlock.PREF_ENABLED}: ${Services.prefs.getBoolPref(FastBlock.PREF_ENABLED)}\n`;
body += `${FastBlock.PREF_UI_ENABLED}: ${Services.prefs.getBoolPref(FastBlock.PREF_UI_ENABLED)}\n`;
body += `browser.fastblock.timeout: ${Services.prefs.getIntPref("browser.fastblock.timeout")}\n`;
let comments = document.getElementById("identity-popup-breakageReportView-collection-comments");
@ -415,6 +444,7 @@ var ContentBlocking = {
for (let blocker of this.blockers) {
blocker.categoryItem.classList.toggle("blocked", this.enabled && blocker.enabled);
blocker.categoryItem.hidden = !blocker.visible;
}
// Check whether the user has added an exception for this site.

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

@ -553,8 +553,7 @@
for (let i = numPinned - 1; i >= 0; i--) {
let tab = this.children[i];
width += layoutData.pinnedTabWidth;
tab.style.setProperty("margin-inline-start",
-(width + layoutData.scrollButtonWidth) + "px", "important");
tab.style.marginInlineStart = -(width + layoutData.scrollButtonWidth) + "px";
tab._pinnedUnscrollable = true;
}
this.style.paddingInlineStart = width + "px";

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

@ -7,6 +7,10 @@ const CB_PREF = "browser.contentblocking.enabled";
const CB_UI_PREF = "browser.contentblocking.ui.enabled";
const TP_PREF = "privacy.trackingprotection.enabled";
const FB_PREF = "browser.fastblock.enabled";
const TPC_PREF = "network.cookie.cookieBehavior";
const FB_UI_PREF = "browser.contentblocking.fastblock.control-center.ui.enabled";
const TP_UI_PREF = "browser.contentblocking.trackingprotection.control-center.ui.enabled";
const RT_UI_PREF = "browser.contentblocking.rejecttrackers.control-center.ui.enabled";
const TRACKING_PAGE = "http://tracking.example.org/browser/browser/base/content/test/trackingUI/trackingPage.html";
async function waitAndAssertPreferencesShown() {
@ -55,6 +59,10 @@ add_task(async function testOpenPreferencesFromAddBlockingButtons() {
[CB_UI_PREF, true],
[FB_PREF, false],
[TP_PREF, false],
[TPC_PREF, Ci.nsICookieService.BEHAVIOR_ACCEPT],
[FB_UI_PREF, true],
[TP_UI_PREF, true],
[RT_UI_PREF, true],
]});
await BrowserTestUtils.withNewTab(TRACKING_PAGE, async function() {

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

@ -180,13 +180,16 @@ add_task(async function testReportBreakage() {
let prefs = [
"privacy.trackingprotection.enabled",
"privacy.trackingprotection.pbmode.enabled",
"browser.contentblocking.trackingprotection.control-center.ui.enabled",
"urlclassifier.trackingTable",
"network.http.referer.defaultPolicy",
"network.http.referer.defaultPolicy.pbmode",
"browser.contentblocking.rejecttrackers.control-center.ui.enabled",
"network.cookie.cookieBehavior",
"network.cookie.lifetimePolicy",
"privacy.restrict3rdpartystorage.expiration",
"browser.fastblock.enabled",
"browser.contentblocking.fastblock.control-center.ui.enabled",
"browser.fastblock.timeout",
];
let prefsBody = "";

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

@ -94,6 +94,14 @@
<label flex="1" class="identity-popup-content-blocking-category-add-blocking text-link"
onclick="ContentBlocking.openPreferences('identityPopup-CB-tracking-protection');">&contentBlocking.trackingProtection.add.label;</label>
</hbox>
<hbox id="identity-popup-content-blocking-category-3rdpartycookies"
class="identity-popup-content-blocking-category" align="center" role="group">
<image class="identity-popup-content-blocking-category-icon thirdpartycookies-icon"/>
<label flex="1" class="identity-popup-content-blocking-category-label">&contentBlocking.3rdPartyCookies.label;</label>
<label flex="1" class="identity-popup-content-blocking-category-state-label">&contentBlocking.3rdPartyCookies.blocked.label;</label>
<label flex="1" class="identity-popup-content-blocking-category-add-blocking text-link"
onclick="ContentBlocking.openPreferences('identityPopup-CB-3rdpartycookies');">&contentBlocking.3rdPartyCookies.add.label;</label>
</hbox>
</vbox>
<button id="tracking-action-unblock"

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

@ -30,13 +30,8 @@ add_task(async function test() {
await promiseTabState(tab, state);
await ContentTask.spawn(tab.linkedBrowser, null, function() {
function compareEntries(i, j, history) {
let e1 = history.getEntryAtIndex(i, false)
.QueryInterface(Ci.nsISHEntry)
.QueryInterface(Ci.nsISHContainer);
let e2 = history.getEntryAtIndex(j, false)
.QueryInterface(Ci.nsISHEntry)
.QueryInterface(Ci.nsISHContainer);
let e1 = history.getEntryAtIndex(i, false);
let e2 = history.getEntryAtIndex(j, false);
ok(e1.sharesDocumentWith(e2),
`${i} should share doc with ${j}`);

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

@ -25,7 +25,6 @@ function test() {
promiseTabState(tab, tabState).then(() => {
let sessionHistory = browser.sessionHistory;
let entry = sessionHistory.legacySHistory.getEntryAtIndex(0, false);
entry.QueryInterface(Ci.nsISHContainer);
whenChildCount(entry, 1, function() {
whenChildCount(entry, 2, function() {

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

@ -25,7 +25,6 @@ function test() {
promiseTabState(tab, tabState).then(() => {
let sessionHistory = browser.sessionHistory;
let entry = sessionHistory.legacySHistory.getEntryAtIndex(0, false);
entry.QueryInterface(Ci.nsISHContainer);
whenChildCount(entry, 1, function() {
whenChildCount(entry, 2, function() {

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

@ -941,7 +941,7 @@ you can use these alternative items. Otherwise, their values should be empty. -
<!ENTITY contentBlocking.trackingProtection.label "Trackers">
<!-- LOCALIZATION NOTE (contentBlocking.trackingProtection.blocked.label):
This label signals that this type of content blocking is turned
ON and is successfully blocking malicious/slow content, so this is
ON and is successfully blocking tracker content, so this is
a positive thing. It forms the end of the (imaginary) sentence
"Trackers [are] Blocked"-->
<!ENTITY contentBlocking.trackingProtection.blocked.label "Blocked">
@ -951,6 +951,19 @@ you can use these alternative items. Otherwise, their values should be empty. -
the type of content blocking is currently not enabled. -->
<!ENTITY contentBlocking.trackingProtection.add.label "Add Blocking…">
<!ENTITY contentBlocking.3rdPartyCookies.label "Third-Party Cookies">
<!-- LOCALIZATION NOTE (contentBlocking.3rdPartyCookies.blocked.label):
This label signals that this type of content blocking is turned
ON and is successfully blocking third-party cookies, so this is
a positive thing. It forms the end of the (imaginary) sentence
"Third-Party Cookies [are] Blocked"-->
<!ENTITY contentBlocking.3rdPartyCookies.blocked.label "Blocked">
<!-- LOCALIZATION NOTE (contentBlocking.3rdPartyCookies.add.label):
This is displayed as a link to preferences, where the user can add
this specific type of content blocking. When this text is shown
the type of content blocking is currently not enabled. -->
<!ENTITY contentBlocking.3rdPartyCookies.add.label "Add Blocking…">
<!ENTITY contentBlocking.openBreakageReportView.label "Report Problems">
<!ENTITY contentBlocking.breakageReportView.label "Report Problems">
<!ENTITY contentBlocking.breakageReportView.description "Content blocking can cause problems with some websites. When you report problems, youll help make &brandShortName; better for everyone. (This will send a URL as well as information about your privacy and content blocking settings to Mozilla.)">

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

@ -0,0 +1,7 @@
<!-- 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/. -->
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16" fill="context-fill" fill-opacity="context-fill-opacity">
<path d="M15.379,8a.142.142,0,0,0,.02,0,7.978,7.978,0,0,1-1.858-.356.981.981,0,0,1-.054.847,1,1,0,1,1-1.735-.994.981.981,0,0,1,.481-.407c-.069-.036-.13-.083-.2-.121L6.613,12.387a.977.977,0,0,1-.4.476.85.85,0,0,1-.117.04L4.031,14.969c.509.219,1,.24,1.161-.147-.424,1.025,2.823,1.668,2.822.558,0,1.11,3.246.461,2.821-.564.425,1.025,3.175-.816,2.39-1.6.785.784,2.621-1.97,1.6-2.394C15.846,11.246,16.489,8,15.379,8Zm-5.073,5a1,1,0,1,1,1-1A1,1,0,0,1,10.306,13Z"/>
<path d="M14.707,1.293a1,1,0,0,0-1.414,0L9.679,4.907A7.942,7.942,0,0,1,8,.61C8,.619,8,.626,8,.635,8-.474,4.753.174,5.179,1.2,4.753.174,2,2.016,2.788,2.8,2,2.016.167,4.77,1.193,5.193.167,4.77-.476,8.016.634,8.015c-1.11,0-.461,3.247.564,2.821-.639.265-.163,1.428.475,2.077l-.38.38a1,1,0,1,0,1.414,1.414l12-12A1,1,0,0,0,14.707,1.293Zm-9,1.7a1,1,0,1,1-1,1A1,1,0,0,1,5.706,3ZM2.524,7.508a1,1,0,1,1,.37,1.364A1,1,0,0,1,2.524,7.508Zm4.769-.215Z"/>
</svg>

После

Ширина:  |  Высота:  |  Размер: 1.2 KiB

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

@ -0,0 +1,6 @@
<!-- 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/. -->
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16" fill="context-fill" fill-opacity="context-fill-opacity">
<path d="M15.379,8a.142.142,0,0,0,.02,0,7.978,7.978,0,0,1-1.858-.356.981.981,0,0,1-.054.847,1,1,0,1,1-1.735-.994.981.981,0,0,1,.481-.407A8.02,8.02,0,0,1,8,.61C8,.619,8,.626,8,.635,8-.474,4.753.174,5.179,1.2,4.753.174,2,2.016,2.788,2.8,2,2.016.167,4.77,1.193,5.193.167,4.77-.476,8.016.634,8.015c-1.11,0-.461,3.247.564,2.821-1.025.426.817,3.175,1.6,2.39-.784.785,1.969,2.621,2.393,1.6-.424,1.025,2.823,1.668,2.822.558,0,1.11,3.246.461,2.821-.564.425,1.025,3.175-.816,2.39-1.6.785.784,2.621-1.97,1.6-2.394C15.846,11.246,16.489,8,15.379,8Zm-11.12.5a1,1,0,1,1-.37-1.365A1,1,0,0,1,4.259,8.5Zm1.955,4.361a1,1,0,1,1,.36-1.367A1,1,0,0,1,6.214,12.863ZM5.706,5a1,1,0,1,1,1-1A1,1,0,0,1,5.706,5ZM8,9A1,1,0,1,1,9,8,1,1,0,0,1,8,9Zm2.306,4a1,1,0,1,1,1-1A1,1,0,0,1,10.306,13Z"/>
</svg>

После

Ширина:  |  Высота:  |  Размер: 1.1 KiB

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

@ -459,6 +459,14 @@ description#identity-popup-content-verifier,
list-style-image: url(chrome://browser/skin/controlcenter/trackers-disabled.svg);
}
.thirdpartycookies-icon {
list-style-image: url(chrome://browser/skin/controlcenter/3rdpartycookies.svg);
}
#identity-popup-content-blocking-category-3rdpartycookies.blocked > .thirdpartycookies-icon {
list-style-image: url(chrome://browser/skin/controlcenter/3rdpartycookies-disabled.svg);
}
/* Content Blocking action button */
.tracking-protection-button {

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

@ -22,6 +22,8 @@
skin/classic/browser/addons/addon-install-error.svg (../shared/addons/addon-install-error.svg)
skin/classic/browser/addons/addon-install-installed.svg (../shared/addons/addon-install-installed.svg)
skin/classic/browser/addons/addon-install-warning.svg (../shared/addons/addon-install-warning.svg)
skin/classic/browser/controlcenter/3rdpartycookies.svg (../shared/controlcenter/3rdpartycookies.svg)
skin/classic/browser/controlcenter/3rdpartycookies-disabled.svg (../shared/controlcenter/3rdpartycookies-disabled.svg)
skin/classic/browser/controlcenter/conn-not-secure.svg (../shared/controlcenter/conn-not-secure.svg)
skin/classic/browser/controlcenter/connection.svg (../shared/controlcenter/connection.svg)
skin/classic/browser/controlcenter/mcb-disabled.svg (../shared/controlcenter/mcb-disabled.svg)

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

@ -70,8 +70,8 @@
background-color: transparent;
border-radius: 0;
border-width: 0;
margin: 0 !important /* override tabbox.css */;
padding: 0 !important /* override tabbox.css */;
margin: 0;
padding: 0;
-moz-box-align: stretch;
}

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

@ -1,9 +1,9 @@
This is the debugger.html project output.
See https://github.com/devtools-html/debugger.html
Version 84
Version 85
Comparison: https://github.com/devtools-html/debugger.html/compare/release-83...release-84
Comparison: https://github.com/devtools-html/debugger.html/compare/release-84...release-85
Packages:
- babel-plugin-transform-es2015-modules-commonjs @6.26.2

1900
devtools/client/debugger/new/dist/vendors.js поставляемый

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

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

@ -8,7 +8,6 @@ exports.selectSourceURL = selectSourceURL;
exports.selectSource = selectSource;
exports.selectLocation = selectLocation;
exports.selectSpecificLocation = selectSpecificLocation;
exports.selectSpecificSource = selectSpecificSource;
exports.jumpToMappedLocation = jumpToMappedLocation;
exports.jumpToMappedSelectedLocation = jumpToMappedSelectedLocation;
@ -106,7 +105,7 @@ function selectSource(sourceId) {
const location = (0, _location.createLocation)({
sourceId
});
return await dispatch(selectLocation(location));
return await dispatch(selectSpecificLocation(location));
};
}
/**
@ -196,22 +195,6 @@ function selectSpecificLocation(location) {
*/
function selectSpecificSource(sourceId) {
return async ({
dispatch
}) => {
const location = (0, _location.createLocation)({
sourceId
});
return await dispatch(selectSpecificLocation(location));
};
}
/**
* @memberof actions/sources
* @static
*/
function jumpToMappedLocation(location) {
return async function ({
dispatch,

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

@ -132,7 +132,7 @@ class Tab extends _react.PureComponent {
render() {
const {
selectedSource,
selectSpecificSource,
selectSource,
closeTab,
source,
tabSources
@ -149,7 +149,7 @@ class Tab extends _react.PureComponent {
function handleTabClick(e) {
e.preventDefault();
e.stopPropagation();
return selectSpecificSource(sourceId);
return selectSource(sourceId);
}
const className = (0, _classnames2.default)("source-tab", {
@ -190,7 +190,7 @@ const mapStateToProps = (state, {
};
exports.default = (0, _reactRedux.connect)(mapStateToProps, {
selectSpecificSource: _actions2.default.selectSpecificSource,
selectSource: _actions2.default.selectSource,
closeTab: _actions2.default.closeTab,
closeTabs: _actions2.default.closeTabs,
togglePrettyPrint: _actions2.default.togglePrettyPrint,

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

@ -67,11 +67,11 @@ class Tabs extends _react.PureComponent {
this.renderDropdownSource = source => {
const {
selectSpecificSource
selectSource
} = this.props;
const filename = (0, _source.getFilename)(source);
const onClick = () => selectSpecificSource(source.id);
const onClick = () => selectSource(source.id);
return _react2.default.createElement("li", {
key: source.id,
@ -206,7 +206,7 @@ const mapStateToProps = state => ({
});
exports.default = (0, _reactRedux.connect)(mapStateToProps, {
selectSpecificSource: _actions2.default.selectSpecificSource,
selectSource: _actions2.default.selectSource,
moveTab: _actions2.default.moveTab,
closeTab: _actions2.default.closeTab,
togglePaneCollapse: _actions2.default.togglePaneCollapse,

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

@ -247,17 +247,14 @@ var _initialiseProps = function () {
this.getPath = item => {
const path = `${item.path}/${item.name}`;
const source = this.getSource(item);
if ((0, _sourcesTree.isDirectory)(item)) {
if (!source || (0, _sourcesTree.isDirectory)(item)) {
return path;
}
const source = this.getSource(item);
const blackBoxedPart = source && source.isBlackBoxed ? ":blackboxed" : ""; // Original and generated sources can point to the same path
// therefore necessary to distinguish as path is used as keys.
const generatedPart = source && source.sourceMapURL ? ":generated" : "";
return `${path}${blackBoxedPart}${generatedPart}`;
const blackBoxedPart = source.isBlackBoxed ? ":blackboxed" : "";
return `${path}/${source.id}/${blackBoxedPart}`;
};
this.onExpand = (item, expandedState) => {

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

@ -21,14 +21,13 @@ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj;
* 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/>. */
function findSource(dbg, url) {
const sources = dbg.selectors.getSources();
const source = sources.find(s => (s.url || "").includes(url));
const sources = dbg.selectors.getSourceList();
return sources.find(s => (s.url || "").includes(url));
}
if (!source) {
return;
}
return source;
function findSources(dbg, url) {
const sources = dbg.selectors.getSourceList();
return sources.filter(s => (s.url || "").includes(url));
}
function sendPacket(dbg, packet, callback) {
@ -76,6 +75,7 @@ function setupHelper(obj) {
getCM,
helpers: {
findSource: url => findSource(dbg, url),
findSources: url => findSources(dbg, url),
evaluate: (expression, cbk) => evaluate(dbg, expression, cbk),
sendPacketToThread: (packet, cbk) => sendPacketToThread(dbg, packet, cbk),
sendPacket: (packet, cbk) => sendPacket(dbg, packet, cbk)

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

@ -31,8 +31,13 @@ async function buildMappedScopes(source, frame, scopes, sourceMaps, client) {
return null;
}
const generatedAstBindings = (0, _buildGeneratedBindingList.buildGeneratedBindingList)(scopes, generatedAstScopes, frame.this);
const originalRanges = await (0, _rangeMetadata.loadRangeMetadata)(source, frame, originalAstScopes, sourceMaps);
if (hasLineMappings(originalRanges)) {
return null;
}
const generatedAstBindings = (0, _buildGeneratedBindingList.buildGeneratedBindingList)(scopes, generatedAstScopes, frame.this);
const {
mappedOriginalScopes,
expressionLookup
@ -104,6 +109,10 @@ function isReliableScope(scope) {
return totalBindings === 0 || unknownBindings / totalBindings < 0.25;
}
function hasLineMappings(ranges) {
return ranges.every(range => range.columnStart === 0 && range.columnEnd === Infinity);
}
function batchScopeMappings(originalAstScopes, source, sourceMaps) {
const precalculatedRanges = new Map();
const precalculatedLocations = new Map(); // Explicitly dispatch all of the sourcemap requests synchronously up front so

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

@ -20,7 +20,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */
const prefsSchemaVersion = "1.0.3";
const prefsSchemaVersion = "1.0.4";
const pref = _devtoolsServices2.default.pref;
if ((0, _devtoolsEnvironment.isDevelopment)()) {
@ -128,5 +128,6 @@ const asyncStore = exports.asyncStore = (0, _asyncStoreHelper.asyncStoreHelper)(
if (prefs.debuggerPrefsSchemaVersion !== prefsSchemaVersion) {
// clear pending Breakpoints
prefs.pendingBreakpoints = {};
prefs.tabs = [];
prefs.debuggerPrefsSchemaVersion = prefsSchemaVersion;
}

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

@ -60,7 +60,7 @@ add_task(async function() {
]);
info(`Test that you can not preview in another original file`);
await selectSpecificSource(dbg, "output");
await selectSource(dbg, "output");
await hoverAtPos(dbg, { line: 2, ch: 16 });
await assertNoTooltip(dbg);
});

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

@ -49,7 +49,7 @@ add_task(async function() {
ok(true, "Original sources exist");
const bundleSrc = findSource(dbg, "bundle.js");
await selectSpecificSource(dbg, bundleSrc);
await selectSource(dbg, bundleSrc);
await clickGutter(dbg, 13);
await waitForDispatch(dbg, "ADD_BREAKPOINT");
@ -61,7 +61,7 @@ add_task(async function() {
const entrySrc = findSource(dbg, "entry.js");
await selectSpecificSource(dbg, entrySrc);
await selectSource(dbg, entrySrc);
ok(
getCM(dbg)
.getValue()

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

@ -24,7 +24,7 @@ add_task(async function() {
ok(true, "Original sources exist");
const mainSrc = findSource(dbg, "fib.c");
await selectSpecificSource(dbg, mainSrc);
await selectSource(dbg, mainSrc);
await addBreakpoint(dbg, "fib.c", 10);
resume(dbg);

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

@ -603,7 +603,7 @@ async function selectSource(dbg, url, line) {
return waitForSelectedSource(dbg, url);
}
async function selectSpecificSource(dbg, url, line) {
async function selectSource(dbg, url, line) {
const source = findSource(dbg, url);
await dbg.actions.selectLocation({ sourceId: source.id, line }, {keepContext: false});
return waitForSelectedSource(dbg, url);

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

@ -9,7 +9,7 @@ const dom = require("devtools/client/shared/vendor/react-dom-factories");
const PropTypes = require("devtools/client/shared/vendor/react-prop-types");
const { LocalizationHelper } = require("devtools/shared/l10n");
const ComputedProperty = createFactory(require("./ComputedProperty"));
const ComputedProperty = createFactory(require("devtools/client/inspector/layout/components/ComputedProperty"));
const Types = require("../types");
@ -86,8 +86,8 @@ class BoxModelProperties extends PureComponent {
const { referenceElement, referenceElementType } = this.getReferenceElement(info);
return ComputedProperty({
name: info,
key: info,
name: info,
onHideBoxModelHighlighter,
onShowBoxModelHighlighterForNode,
referenceElement,
@ -97,15 +97,15 @@ class BoxModelProperties extends PureComponent {
});
});
return dom.div({ className: "boxmodel-properties" },
return dom.div({ className: "layout-properties" },
dom.div(
{
className: "boxmodel-properties-header",
className: "layout-properties-header",
onDoubleClick: this.onToggleExpander,
},
dom.span(
{
className: "boxmodel-properties-expander theme-twisty",
className: "layout-properties-expander theme-twisty",
open: this.state.isOpen,
onClick: this.onToggleExpander,
}
@ -114,7 +114,7 @@ class BoxModelProperties extends PureComponent {
),
dom.div(
{
className: "boxmodel-properties-wrapper devtools-monospace",
className: "layout-properties-wrapper devtools-monospace",
hidden: !this.state.isOpen,
tabIndex: 0,
},

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

@ -1,113 +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/. */
"use strict";
const { PureComponent } = require("devtools/client/shared/vendor/react");
const dom = require("devtools/client/shared/vendor/react-dom-factories");
const PropTypes = require("devtools/client/shared/vendor/react-prop-types");
const { translateNodeFrontToGrip } = require("devtools/client/inspector/shared/utils");
const { REPS, MODE } = require("devtools/client/shared/components/reps/reps");
const { Rep } = REPS;
class ComputedProperty extends PureComponent {
static get propTypes() {
return {
name: PropTypes.string.isRequired,
referenceElement: PropTypes.object,
referenceElementType: PropTypes.string,
setSelectedNode: PropTypes.func.isRequired,
value: PropTypes.string,
onHideBoxModelHighlighter: PropTypes.func.isRequired,
onShowBoxModelHighlighterForNode: PropTypes.func.isRequired,
};
}
constructor(props) {
super(props);
this.renderReferenceElementPreview = this.renderReferenceElementPreview.bind(this);
this.onFocus = this.onFocus.bind(this);
}
renderReferenceElementPreview() {
const {
referenceElement,
referenceElementType,
setSelectedNode,
onShowBoxModelHighlighterForNode,
onHideBoxModelHighlighter
} = this.props;
if (!referenceElement) {
return null;
}
return dom.div(
{
className: "reference-element"
},
dom.span({ className: "reference-element-type" }, referenceElementType),
Rep({
defaultRep: referenceElement,
mode: MODE.TINY,
object: translateNodeFrontToGrip(referenceElement),
onInspectIconClick: () => setSelectedNode(referenceElement,
{ reason: "box-model" }),
onDOMNodeMouseOver: () => onShowBoxModelHighlighterForNode(referenceElement),
onDOMNodeMouseOut: () => onHideBoxModelHighlighter(),
})
);
}
onFocus() {
this.container.focus();
}
render() {
const { name, value } = this.props;
return dom.div(
{
className: "computed-property-view",
"data-property-name": name,
tabIndex: "0",
ref: container => {
this.container = container;
},
},
dom.div(
{
className: "computed-property-name-container",
},
dom.div(
{
className: "computed-property-name theme-fg-color5",
tabIndex: "",
title: name,
onClick: this.onFocus,
},
name
)
),
dom.div(
{
className: "computed-property-value-container",
},
dom.div(
{
className: "computed-property-value theme-fg-color1",
dir: "ltr",
tabIndex: "",
onClick: this.onFocus,
},
value
),
this.renderReferenceElementPreview()
)
);
}
}
module.exports = ComputedProperty;

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

@ -10,5 +10,4 @@ DevToolsModules(
'BoxModelInfo.js',
'BoxModelMain.js',
'BoxModelProperties.js',
'ComputedProperty.js',
)

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

@ -115,6 +115,6 @@ async function testChangingValues(inspector, boxmodel, testActor) {
}
function getPropertySelector(propertyName) {
return `.boxmodel-properties-wrapper .computed-property-view` +
return `.boxmodel-container .computed-property-view` +
`[data-property-name=${propertyName}] .computed-property-value`;
}

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

@ -33,7 +33,7 @@ module.exports = {
},
/**
* Update the color used for the flexbox's highlighter.
* Updates the color used for the flexbox's highlighter.
*
* @param {String} color
* The color to use for this nodeFront's flexbox highlighter.

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

@ -14,7 +14,7 @@ createEnum([
// Updates the flexbox state with the newly selected flexbox.
"UPDATE_FLEXBOX",
// Update the color used for the overlay of a flexbox.
// Updates the color used for the overlay of a flexbox.
"UPDATE_FLEXBOX_COLOR",
// Updates the flexbox highlighted state.

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

@ -17,25 +17,25 @@ const ElementNode = REPS.ElementNode;
const Types = require("../types");
class FlexboxItem extends PureComponent {
class FlexContainerItem extends PureComponent {
static get propTypes() {
return {
flexbox: PropTypes.shape(Types.flexbox).isRequired,
getSwatchColorPickerTooltip: PropTypes.func.isRequired,
setSelectedNode: PropTypes.func.isRequired,
onHideBoxModelHighlighter: PropTypes.func.isRequired,
onSetFlexboxOverlayColor: PropTypes.func.isRequired,
onShowBoxModelHighlighterForNode: PropTypes.func.isRequired,
onToggleFlexboxHighlighter: PropTypes.func.isRequired,
setSelectedNode: PropTypes.func.isRequired,
};
}
constructor(props) {
super(props);
this.setFlexboxColor = this.setFlexboxColor.bind(this);
this.onFlexboxCheckboxClick = this.onFlexboxCheckboxClick.bind(this);
this.onFlexboxInspectIconClick = this.onFlexboxInspectIconClick.bind(this);
this.setFlexboxColor = this.setFlexboxColor.bind(this);
}
componentDidMount() {
@ -109,45 +109,45 @@ class FlexboxItem extends PureComponent {
nodeFront,
} = flexbox;
return dom.li(
{},
dom.label(
{},
dom.input(
return (
dom.li({},
dom.label({},
dom.input(
{
type: "checkbox",
value: actorID,
checked: highlighted,
onChange: this.onFlexboxCheckboxClick,
}
),
Rep(
{
defaultRep: ElementNode,
mode: MODE.TINY,
object: translateNodeFrontToGrip(nodeFront),
onDOMNodeMouseOut: () => onHideBoxModelHighlighter(),
onDOMNodeMouseOver: () => onShowBoxModelHighlighterForNode(nodeFront),
onInspectIconClick: () => this.onFlexboxInspectIconClick(nodeFront),
}
)
),
dom.div(
{
type: "checkbox",
value: actorID,
checked: highlighted,
onChange: this.onFlexboxCheckboxClick,
className: "flexbox-color-swatch",
style: {
backgroundColor: color,
},
title: color,
}
),
Rep(
{
defaultRep: ElementNode,
mode: MODE.TINY,
object: translateNodeFrontToGrip(nodeFront),
onDOMNodeMouseOut: () => onHideBoxModelHighlighter(),
onDOMNodeMouseOver: () => onShowBoxModelHighlighterForNode(nodeFront),
onInspectIconClick: () => this.onFlexboxInspectIconClick(nodeFront),
}
)
),
dom.div(
{
className: "flexbox-color-swatch",
style: {
backgroundColor: color,
},
title: color,
}
),
// The SwatchColorPicker relies on the nextSibling of the swatch element to apply
// the selected color. This is why we use a span in display: none for now.
// Ideally we should modify the SwatchColorPickerTooltip to bypass this requirement.
// See https://bugzilla.mozilla.org/show_bug.cgi?id=1341578
dom.span({ className: "flexbox-color-value" }, color)
// The SwatchColorPicker relies on the nextSibling of the swatch element to apply
// the selected color. This is why we use a span in display: none for now.
// Ideally we should modify the SwatchColorPickerTooltip to bypass this
// requirement. See https://bugzilla.mozilla.org/show_bug.cgi?id=1341578
dom.span({ className: "flexbox-color-value" }, color)
)
);
}
}
module.exports = FlexboxItem;
module.exports = FlexContainerItem;

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

@ -0,0 +1,64 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
const { createFactory, PureComponent } = require("devtools/client/shared/vendor/react");
const dom = require("devtools/client/shared/vendor/react-dom-factories");
const PropTypes = require("devtools/client/shared/vendor/react-prop-types");
const { getStr } = require("devtools/client/inspector/layout/utils/l10n");
const FlexContainerItem = createFactory(require("./FlexContainerItem"));
const Types = require("../types");
class FlexContainerList extends PureComponent {
static get propTypes() {
return {
flexbox: PropTypes.shape(Types.flexbox).isRequired,
getSwatchColorPickerTooltip: PropTypes.func.isRequired,
onHideBoxModelHighlighter: PropTypes.func.isRequired,
onSetFlexboxOverlayColor: PropTypes.func.isRequired,
onShowBoxModelHighlighterForNode: PropTypes.func.isRequired,
onToggleFlexboxHighlighter: PropTypes.func.isRequired,
setSelectedNode: PropTypes.func.isRequired,
};
}
render() {
const {
flexbox,
getSwatchColorPickerTooltip,
onHideBoxModelHighlighter,
onSetFlexboxOverlayColor,
onShowBoxModelHighlighterForNode,
onToggleFlexboxHighlighter,
setSelectedNode,
} = this.props;
return (
dom.div({ className: "flexbox-container" },
dom.span({}, getStr("flexbox.overlayFlexbox")),
dom.ul(
{
id: "flexbox-list",
className: "devtools-monospace",
},
FlexContainerItem({
key: flexbox.id,
flexbox,
getSwatchColorPickerTooltip,
onHideBoxModelHighlighter,
onSetFlexboxOverlayColor,
onShowBoxModelHighlighterForNode,
onToggleFlexboxHighlighter,
setSelectedNode,
})
)
)
);
}
}
module.exports = FlexContainerList;

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

@ -0,0 +1,82 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
const { createFactory, PureComponent } = require("devtools/client/shared/vendor/react");
const dom = require("devtools/client/shared/vendor/react-dom-factories");
const PropTypes = require("devtools/client/shared/vendor/react-prop-types");
const { getStr } = require("devtools/client/inspector/layout/utils/l10n");
const ComputedProperty = createFactory(require("devtools/client/inspector/layout/components/ComputedProperty"));
class FlexContainerProperties extends PureComponent {
static get propTypes() {
return {
properties: PropTypes.object.isRequired,
};
}
constructor(props) {
super(props);
this.state = {
// Whether or not the properties are shown.
isShown: true,
};
this.onToggleExpander = this.onToggleExpander.bind(this);
}
onToggleExpander(event) {
event.stopPropagation();
this.setState((prevState) => {
return {
isShown: !prevState.isShown,
};
});
}
render() {
const { properties } = this.props;
return (
dom.div(
{
id: "flex-container-properties",
className: "flexbox-container",
},
dom.div(
{
className: "layout-properties-header",
onDoubleClick: this.onToggleExpander,
},
dom.span(
{
className: "layout-properties-expander theme-twisty",
open: this.state.isShown,
onClick: this.onToggleExpander,
}
),
getStr("flexbox.flexContainerProperties")
),
dom.div(
{
className: "layout-properties-wrapper devtools-monospace",
hidden: !this.state.isShown,
tabIndex: 0,
},
Object.entries(properties).map(([name, value]) => ComputedProperty({
key: name,
name,
value,
}))
)
)
);
}
}
module.exports = FlexContainerProperties;

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

@ -9,7 +9,12 @@ const dom = require("devtools/client/shared/vendor/react-dom-factories");
const PropTypes = require("devtools/client/shared/vendor/react-prop-types");
const { getStr } = require("devtools/client/inspector/layout/utils/l10n");
const FlexboxItem = createFactory(require("./FlexboxItem"));
loader.lazyGetter(this, "FlexContainerList", function() {
return createFactory(require("./FlexContainerList"));
});
loader.lazyGetter(this, "FlexContainerProperties", function() {
return createFactory(require("./FlexContainerProperties"));
});
const Types = require("../types");
@ -18,11 +23,11 @@ class Flexbox extends PureComponent {
return {
flexbox: PropTypes.shape(Types.flexbox).isRequired,
getSwatchColorPickerTooltip: PropTypes.func.isRequired,
setSelectedNode: PropTypes.func.isRequired,
onHideBoxModelHighlighter: PropTypes.func.isRequired,
onSetFlexboxOverlayColor: PropTypes.func.isRequired,
onShowBoxModelHighlighterForNode: PropTypes.func.isRequired,
onToggleFlexboxHighlighter: PropTypes.func.isRequired,
setSelectedNode: PropTypes.func.isRequired,
};
}
@ -30,41 +35,39 @@ class Flexbox extends PureComponent {
const {
flexbox,
getSwatchColorPickerTooltip,
setSelectedNode,
onHideBoxModelHighlighter,
onSetFlexboxOverlayColor,
onShowBoxModelHighlighterForNode,
onToggleFlexboxHighlighter,
setSelectedNode,
} = this.props;
return flexbox.actorID ?
if (!flexbox.actorID) {
return (
dom.div({ className: "devtools-sidepanel-no-result" },
getStr("flexbox.noFlexboxeOnThisPage")
)
);
}
return (
dom.div({ id: "layout-flexbox-container" },
dom.div({ className: "flexbox-content" },
dom.div({ className: "flexbox-container" },
dom.span({}, getStr("flexbox.overlayFlexbox")),
dom.ul(
{
id: "flexbox-list",
className: "devtools-monospace",
},
FlexboxItem({
key: flexbox.id,
flexbox,
getSwatchColorPickerTooltip,
setSelectedNode,
onHideBoxModelHighlighter,
onSetFlexboxOverlayColor,
onShowBoxModelHighlighterForNode,
onToggleFlexboxHighlighter,
})
)
)
)
FlexContainerList({
flexbox,
getSwatchColorPickerTooltip,
onHideBoxModelHighlighter,
onSetFlexboxOverlayColor,
onShowBoxModelHighlighterForNode,
onToggleFlexboxHighlighter,
setSelectedNode,
})
),
FlexContainerProperties({
properties: flexbox.properties,
})
)
:
dom.div({ className: "devtools-sidepanel-no-result" },
getStr("flexbox.noFlexboxeOnThisPage")
);
);
}
}

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

@ -6,5 +6,7 @@
DevToolsModules(
'Flexbox.js',
'FlexboxItem.js',
'FlexContainerItem.js',
'FlexContainerList.js',
'FlexContainerProperties.js',
)

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

@ -93,7 +93,6 @@ class FlexboxInspector {
getComponentProps() {
return {
getSwatchColorPickerTooltip: this.getSwatchColorPickerTooltip,
onSetFlexboxOverlayColor: this.onSetFlexboxOverlayColor,
onToggleFlexboxHighlighter: this.onToggleFlexboxHighlighter,
};
@ -347,6 +346,7 @@ class FlexboxInspector {
color,
highlighted,
nodeFront,
properties: flexboxFront.properties,
}));
}
}

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

@ -20,6 +20,8 @@ const INITIAL_FLEXBOX = {
highlighted: false,
// The NodeFront of the flex container.
nodeFront: null,
// The computed style properties of the flex container.
properties: {},
};
const reducers = {

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

@ -20,4 +20,7 @@ exports.flexbox = {
// The NodeFront of the flex container.
nodeFront: PropTypes.object,
// The computed style properties of the flex container.
properties: PropTypes.object,
};

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

@ -109,16 +109,14 @@ class GridItem extends PureComponent {
onChange: this.onGridCheckboxClick,
}
),
Rep(
{
defaultRep: ElementNode,
mode: MODE.TINY,
object: translateNodeFrontToGrip(nodeFront),
onDOMNodeMouseOut: () => onHideBoxModelHighlighter(),
onDOMNodeMouseOver: () => onShowBoxModelHighlighterForNode(nodeFront),
onInspectIconClick: () => this.onGridInspectIconClick(nodeFront),
}
)
Rep({
defaultRep: ElementNode,
mode: MODE.TINY,
object: translateNodeFrontToGrip(nodeFront),
onDOMNodeMouseOut: () => onHideBoxModelHighlighter(),
onDOMNodeMouseOver: () => onShowBoxModelHighlighterForNode(nodeFront),
onInspectIconClick: () => this.onGridInspectIconClick(nodeFront),
})
),
dom.div(
{

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

@ -195,17 +195,16 @@ class GridOutline extends PureComponent {
* Displays a message text "Cannot show outline for this grid".
*/
renderCannotShowOutlineText() {
return dom.div(
{
className: "grid-outline-text"
},
dom.span(
{
className: "grid-outline-text-icon",
title: getStr("layout.cannotShowGridOutline.title")
}
),
getStr("layout.cannotShowGridOutline")
return (
dom.div({ className: "grid-outline-text" },
dom.span(
{
className: "grid-outline-text-icon",
title: getStr("layout.cannotShowGridOutline.title")
}
),
getStr("layout.cannotShowGridOutline")
)
);
}
@ -296,8 +295,8 @@ class GridOutline extends PureComponent {
*/
renderGridCell(id, gridFragmentIndex, x, y, rowNumber, columnNumber, color,
gridAreaName, width, height) {
return dom.rect(
{
return (
dom.rect({
key: `${id}-${rowNumber}-${columnNumber}`,
className: "grid-outline-cell",
"data-grid-area-name": gridAreaName,
@ -312,33 +311,35 @@ class GridOutline extends PureComponent {
fill: "none",
onMouseEnter: this.onHighlightCell,
onMouseLeave: this.onHighlightCell,
}
})
);
}
renderGridOutline(grid) {
const { color } = grid;
return dom.g(
{
id: "grid-outline-group",
className: "grid-outline-group",
style: { color }
},
this.renderGrid(grid)
return (
dom.g(
{
id: "grid-outline-group",
className: "grid-outline-group",
style: { color }
},
this.renderGrid(grid)
)
);
}
renderGridOutlineBorder(borderWidth, borderHeight, color) {
return dom.rect(
{
return (
dom.rect({
key: "border",
className: "grid-outline-border",
x: 0,
y: 0,
width: borderWidth,
height: borderHeight
}
})
);
}

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

@ -23,7 +23,7 @@ add_task(async function() {
const { inspector, gridInspector, layoutView } = await openLayoutView();
const { document: doc } = gridInspector;
const { store } = inspector;
const cPicker = layoutView.getSwatchColorPickerTooltip();
const cPicker = layoutView.swatchColorPickerTooltip;
const spectrum = cPicker.spectrum;
const swatch = doc.querySelector(".grid-color-swatch");

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

@ -23,7 +23,7 @@ add_task(async function() {
const { inspector, gridInspector, layoutView } = await openLayoutView();
const { document: doc } = gridInspector;
const { store } = inspector;
const cPicker = layoutView.getSwatchColorPickerTooltip();
const cPicker = layoutView.swatchColorPickerTooltip;
const spectrum = cPicker.spectrum;
const swatch = doc.querySelector(".grid-color-swatch");

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

@ -23,7 +23,7 @@ add_task(async function() {
const { inspector, gridInspector, layoutView } = await openLayoutView();
const { document: doc } = gridInspector;
const { store } = inspector;
const cPicker = layoutView.getSwatchColorPickerTooltip();
const cPicker = layoutView.swatchColorPickerTooltip;
const spectrum = cPicker.spectrum;
const swatch = doc.querySelector(".grid-color-swatch");

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

@ -23,7 +23,7 @@ add_task(async function() {
const { inspector, gridInspector, layoutView, toolbox } = await openLayoutView();
const { document: doc } = gridInspector;
const { store } = inspector;
const cPicker = layoutView.getSwatchColorPickerTooltip();
const cPicker = layoutView.swatchColorPickerTooltip;
const swatch = doc.querySelector(".grid-color-swatch");
info("Scrolling into view of the #grid color swatch.");

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

@ -0,0 +1,109 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
const { PureComponent } = require("devtools/client/shared/vendor/react");
const dom = require("devtools/client/shared/vendor/react-dom-factories");
const PropTypes = require("devtools/client/shared/vendor/react-prop-types");
const { translateNodeFrontToGrip } = require("devtools/client/inspector/shared/utils");
const { REPS, MODE } = require("devtools/client/shared/components/reps/reps");
const { Rep } = REPS;
class ComputedProperty extends PureComponent {
static get propTypes() {
return {
name: PropTypes.string.isRequired,
onHideBoxModelHighlighter: PropTypes.func,
onShowBoxModelHighlighterForNode: PropTypes.func,
referenceElement: PropTypes.object,
referenceElementType: PropTypes.string,
setSelectedNode: PropTypes.func,
value: PropTypes.string,
};
}
constructor(props) {
super(props);
this.onFocus = this.onFocus.bind(this);
this.renderReferenceElementPreview = this.renderReferenceElementPreview.bind(this);
}
onFocus() {
this.container.focus();
}
renderReferenceElementPreview() {
const {
onShowBoxModelHighlighterForNode,
onHideBoxModelHighlighter,
referenceElement,
referenceElementType,
setSelectedNode,
} = this.props;
if (!referenceElement) {
return null;
}
return (
dom.div({ className: "reference-element" },
dom.span({ className: "reference-element-type" }, referenceElementType),
Rep({
defaultRep: referenceElement,
mode: MODE.TINY,
object: translateNodeFrontToGrip(referenceElement),
onInspectIconClick: () => setSelectedNode(referenceElement,
{ reason: "box-model" }),
onDOMNodeMouseOver: () => onShowBoxModelHighlighterForNode(referenceElement),
onDOMNodeMouseOut: () => onHideBoxModelHighlighter(),
})
)
);
}
render() {
const { name, value } = this.props;
return (
dom.div(
{
className: "computed-property-view",
"data-property-name": name,
tabIndex: "0",
ref: container => {
this.container = container;
},
},
dom.div({ className: "computed-property-name-container" },
dom.div(
{
className: "computed-property-name theme-fg-color5",
tabIndex: "",
title: name,
onClick: this.onFocus,
},
name
)
),
dom.div({ className: "computed-property-value-container" },
dom.div(
{
className: "computed-property-value theme-fg-color1",
dir: "ltr",
tabIndex: "",
onClick: this.onFocus,
},
value
),
this.renderReferenceElementPreview()
)
)
);
}
}
module.exports = ComputedProperty;

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

@ -16,6 +16,7 @@ const Flexbox = createFactory(require("devtools/client/inspector/flexbox/compone
const Grid = createFactory(require("devtools/client/inspector/grids/components/Grid"));
const BoxModelTypes = require("devtools/client/inspector/boxmodel/types");
const FlexboxTypes = require("devtools/client/inspector/flexbox/types");
const GridTypes = require("devtools/client/inspector/grids/types");
const Accordion = createFactory(require("./Accordion"));
@ -35,6 +36,7 @@ class LayoutApp extends PureComponent {
static get propTypes() {
return {
boxModel: PropTypes.shape(BoxModelTypes.boxModel).isRequired,
flexbox: PropTypes.shape(FlexboxTypes.flexbox).isRequired,
getSwatchColorPickerTooltip: PropTypes.func.isRequired,
grids: PropTypes.arrayOf(PropTypes.shape(GridTypes.grid)).isRequired,
highlighterSettings: PropTypes.shape(GridTypes.highlighterSettings).isRequired,
@ -44,7 +46,11 @@ class LayoutApp extends PureComponent {
onShowBoxModelEditor: PropTypes.func.isRequired,
onShowBoxModelHighlighter: PropTypes.func.isRequired,
onShowBoxModelHighlighterForNode: PropTypes.func.isRequired,
onShowGridOutlineHighlight: PropTypes.func.isRequired,
onToggleFlexboxHighlighter: PropTypes.func.isRequired,
onToggleGeometryEditor: PropTypes.func.isRequired,
onToggleGridHighlighter: PropTypes.func.isRequired,
onToggleShowGridAreas: PropTypes.func.isRequired,
onToggleShowGridLineNumbers: PropTypes.func.isRequired,
onToggleShowInfiniteLines: PropTypes.func.isRequired,
setSelectedNode: PropTypes.func.isRequired,

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

@ -7,5 +7,6 @@
DevToolsModules(
'Accordion.css',
'Accordion.js',
'ComputedProperty.js',
'LayoutApp.js',
)

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

@ -23,8 +23,6 @@ class LayoutView {
this.inspector = inspector;
this.store = inspector.store;
this.getSwatchColorPickerTooltip = this.getSwatchColorPickerTooltip.bind(this);
this.init();
}
@ -62,7 +60,7 @@ class LayoutView {
} = this.gridInspector.getComponentProps();
const layoutApp = LayoutApp({
getSwatchColorPickerTooltip: this.getSwatchColorPickerTooltip,
getSwatchColorPickerTooltip: () => this.swatchColorPickerTooltip,
onHideBoxModelHighlighter,
onSetFlexboxOverlayColor,
onSetGridOverlayColor,
@ -112,13 +110,6 @@ class LayoutView {
this.store = null;
}
/**
* Retrieve the shared SwatchColorPicker instance.
*/
getSwatchColorPickerTooltip() {
return this.swatchColorPickerTooltip;
}
get swatchColorPickerTooltip() {
if (!this._swatchColorPickerTooltip) {
this._swatchColorPickerTooltip = new SwatchColorPickerTooltip(

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

@ -16,6 +16,10 @@ flexbox.noFlexboxeOnThisPage=Select a Flex container or item to continue.
# elements if only one item can be selected.
flexbox.overlayFlexbox=Overlay Flexbox
# LOCALIZATION NOTE (flexbox.flexContainerProperties): Header for the flex container
# properties in the Flexbox panel.
flexbox.flexContainerProperties=Flex Container Properties
# LOCALIZATION NOTE (layout.cannotShowGridOutline, layout.cannotSHowGridOutline.title):
# In the case where the grid outline cannot be effectively displayed.
layout.cannotShowGridOutline=Cannot show outline for this grid

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

@ -364,37 +364,7 @@
align-items: center;
}
/* Box Model Properties: contains a list of relevant box model properties */
.boxmodel-properties-header {
padding: 2px 3px;
}
.boxmodel-properties-expander {
vertical-align: middle;
display: inline-block;
margin-inline-start: 2px;
margin-inline-end: 1px;
}
.boxmodel-properties-wrapper {
column-width: 250px;
column-gap: 20px;
column-rule: 1px solid var(--theme-splitter-color);
}
.boxmodel-properties-wrapper .computed-property-view {
padding-inline-start: 20px;
}
.boxmodel-properties-wrapper .computed-property-name-container {
flex: 1;
}
.boxmodel-properties-wrapper .computed-property-value-container {
flex: 1;
display: block;
}
/* Tag displayed next to DOM Node previews (used to display reference elements) */
.boxmodel-container .reference-element {
margin-inline-start: 14px;
@ -402,8 +372,6 @@
display: block;
}
/* Tag displayed next to DOM Node previews (used to display reference elements) */
.boxmodel-container .reference-element-type {
background: var(--theme-highlight-purple);
color: white;

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

@ -56,6 +56,47 @@
margin-inline-start: -3px;
}
/* Layout Properties: Common styles used for the Box Model and Flexbox Properties */
.layout-properties-header {
padding: 2px 3px;
-moz-user-select: none;
}
.layout-properties-expander {
vertical-align: middle;
display: inline-block;
margin-inline-start: 2px;
margin-inline-end: 1px;
}
.layout-properties-wrapper {
column-width: 250px;
column-gap: 20px;
column-rule: 1px solid var(--theme-splitter-color);
}
.layout-properties-wrapper .computed-property-view {
padding-inline-start: 20px;
}
.layout-properties-wrapper .computed-property-name-container {
flex: 1;
}
.layout-properties-wrapper .computed-property-value-container {
flex: 1;
display: block;
}
/**
* Flex Container Properties
*/
#flex-container-properties {
margin: 0 0 5px 0;
}
/**
* Grid Container
*/

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

@ -52,8 +52,18 @@ const FlexboxActor = ActorClassWithSpec(flexboxSpec, {
return this.actorID;
}
const styles = CssLogic.getComputedStyle(this.containerEl);
const form = {
actor: this.actorID,
// The computed style properties of the flex container.
properties: {
"align-content": styles.alignContent,
"align-items": styles.alignItems,
"flex-direction": styles.flexDirection,
"flex-wrap": styles.flexWrap,
"justify-content": styles.justifyContent,
},
};
// If the WalkerActor already knows the container element, then also return its

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

@ -65,8 +65,8 @@ var PromisesActor = protocol.ActorClassWithSpec(promisesSpec, {
this._newPromises = [];
this._promisesSettled = [];
this.dbg.findScripts().forEach(s => {
this.parentActor.sources.createSourceActors(s.source);
this.dbg.findSources().forEach(source => {
this.parentActor.sources.createSourceActors(source);
});
this.dbg.onNewScript = s => {

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

@ -1111,22 +1111,12 @@ const ThreadActor = ActorClassWithSpec(threadSpec, {
},
/**
* Get the script and source lists from the debugger.
* Get the source lists from the debugger.
*/
_discoverSources: function() {
// Only get one script per Debugger.Source.
const sourcesToScripts = new Map();
const scripts = this.dbg.findScripts();
for (let i = 0, len = scripts.length; i < len; i++) {
const s = scripts[i];
if (s.source) {
sourcesToScripts.set(s.source, s);
}
}
return Promise.all([...sourcesToScripts.values()].map(script => {
return this.sources.createSourceActors(script.source);
const sources = this.dbg.findSources();
return Promise.all(sources.map(source => {
return this.sources.createSourceActors(source);
}));
},

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

@ -27,6 +27,13 @@ const FlexboxFront = FrontClassWithSpec(flexboxSpec, {
return this.conn.getActor(this._form.containerNodeActorID);
},
/**
* Get the computed style properties for the flex container.
*/
get properties() {
return this._form.properties;
},
});
const GridFront = FrontClassWithSpec(gridSpec, {

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

@ -117,7 +117,6 @@
#include "nsISecurityUITelemetry.h"
#include "nsISeekableStream.h"
#include "nsISelectionDisplay.h"
#include "nsISHContainer.h"
#include "nsISHEntry.h"
#include "nsISHistory.h"
#include "nsISHistoryInternal.h"
@ -1069,10 +1068,9 @@ nsDocShell::FirePageHideNotificationInternal(bool aIsUnload,
// If the document is unloading, remove all dynamic subframe entries.
if (aIsUnload && !aSkipCheckingDynEntries) {
RefPtr<ChildSHistory> rootSH = GetRootSessionHistory();
nsCOMPtr<nsISHContainer> container(do_QueryInterface(mOSHE));
if (rootSH && container) {
if (rootSH && mOSHE) {
int32_t index = rootSH->Index();
rootSH->LegacySHistoryInternal()->RemoveDynEntries(index, container);
rootSH->LegacySHistoryInternal()->RemoveDynEntries(index, mOSHE);
}
}
@ -3729,13 +3727,10 @@ nsDocShell::GetChildSHEntry(int32_t aChildOffset, nsISHEntry** aResult)
return rv;
}
nsCOMPtr<nsISHContainer> container(do_QueryInterface(mLSHE));
if (container) {
// Get the child subframe from session history.
rv = container->GetChildAt(aChildOffset, aResult);
if (*aResult) {
(*aResult)->SetLoadType(loadType);
}
// Get the child subframe from session history.
rv = mLSHE->GetChildAt(aChildOffset, aResult);
if (*aResult) {
(*aResult)->SetLoadType(loadType);
}
}
return rv;
@ -3752,17 +3747,13 @@ nsDocShell::AddChildSHEntry(nsISHEntry* aCloneRef, nsISHEntry* aNewEntry,
/* You get here if you are currently building a
* hierarchy ie.,you just visited a frameset page
*/
nsCOMPtr<nsISHContainer> container(do_QueryInterface(mLSHE, &rv));
if (container) {
if (NS_FAILED(container->ReplaceChild(aNewEntry))) {
rv = container->AddChild(aNewEntry, aChildOffset);
}
if (NS_FAILED(mLSHE->ReplaceChild(aNewEntry))) {
rv = mLSHE->AddChild(aNewEntry, aChildOffset);
}
} else if (!aCloneRef) {
/* This is an initial load in some subframe. Just append it if we can */
nsCOMPtr<nsISHContainer> container(do_QueryInterface(mOSHE, &rv));
if (container) {
rv = container->AddChild(aNewEntry, aChildOffset);
if (mOSHE) {
rv = mOSHE->AddChild(aNewEntry, aChildOffset);
}
} else {
rv = AddChildSHEntryInternal(aCloneRef, aNewEntry, aChildOffset,
@ -3997,18 +3988,17 @@ nsDocShell::GetDeviceSizeIsPageSize(bool* aValue)
void
nsDocShell::ClearFrameHistory(nsISHEntry* aEntry)
{
nsCOMPtr<nsISHContainer> shcontainer = do_QueryInterface(aEntry);
RefPtr<ChildSHistory> rootSH = GetRootSessionHistory();
if (!rootSH || !shcontainer) {
if (!rootSH || !aEntry) {
return;
}
int32_t count = 0;
shcontainer->GetChildCount(&count);
aEntry->GetChildCount(&count);
AutoTArray<nsID, 16> ids;
for (int32_t i = 0; i < count; ++i) {
nsCOMPtr<nsISHEntry> child;
shcontainer->GetChildAt(i, getter_AddRefs(child));
aEntry->GetChildAt(i, getter_AddRefs(child));
if (child) {
ids.AppendElement(child->DocshellID());
}
@ -12044,15 +12034,14 @@ nsDocShell::AddToSessionHistory(nsIURI* aURI, nsIChannel* aChannel,
root != static_cast<nsIDocShellTreeItem*>(this)) {
// This is a subframe
entry = mOSHE;
nsCOMPtr<nsISHContainer> shContainer(do_QueryInterface(entry));
if (shContainer) {
if (entry) {
int32_t childCount = 0;
shContainer->GetChildCount(&childCount);
entry->GetChildCount(&childCount);
// Remove all children of this entry
for (int32_t i = childCount - 1; i >= 0; i--) {
nsCOMPtr<nsISHEntry> child;
shContainer->GetChildAt(i, getter_AddRefs(child));
shContainer->RemoveChild(child);
entry->GetChildAt(i, getter_AddRefs(child));
entry->RemoveChild(child);
}
entry->AbandonBFCacheEntry();
}

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

@ -6,7 +6,6 @@
XPIDL_SOURCES += [
'nsIBFCacheEntry.idl',
'nsISHContainer.idl',
'nsISHEntry.idl',
'nsISHistory.idl',
'nsISHistoryInternal.idl',

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

@ -1,49 +0,0 @@
/* -*- Mode: IDL; 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 "nsISupports.idl"
interface nsISHEntry;
/**
* The nsISHEntryContainer. The interface to access child entries
* of an nsISHEntry.
*
*/
[scriptable, uuid(67dd0357-8372-4122-bff6-217435e8b7e4)]
interface nsISHContainer : nsISupports
{
/**
* The current number of nsISHEntries which are immediate children of the
* current SHEntry
*/
readonly attribute long childCount;
/**
* Add a new child SHEntry. If offset is -1 adds to the end of the list.
*/
void AddChild(in nsISHEntry child, in long offset);
/**
* Removes a child SHEntry
*/
void RemoveChild(in nsISHEntry child);
/**
* Get child at an index
*/
nsISHEntry GetChildAt(in long index);
/**
* Replaces a child which is for the same docshell as aNewChild
* with aNewChild.
* @throw if nothing was replaced.
*/
void ReplaceChild(in nsISHEntry aNewChild);
};

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

@ -4,10 +4,9 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/**
* The interface to nsISHentry. Each document or subframe in
* The interface to nsISHentry. Each document or subframe in
* Session History will have a nsISHEntry associated with it which will
* hold all information required to recreate the document from history
*
*/
#include "nsISupports.idl"
@ -180,7 +179,7 @@ interface nsISHEntry : nsISupports
* attribute to indicate the content-type of the document that this
* is a session history entry for
*/
attribute ACString contentType;
attribute ACString contentType;
/**
* If we created this SHEntry via history.pushState or modified it via
@ -194,7 +193,7 @@ interface nsISHEntry : nsISupports
*
*/
attribute boolean URIWasModified;
/** Set/Get scrollers' positon in anchored pages */
void setScrollPosition(in long x, in long y);
void getScrollPosition(out long x, out long y);
@ -357,18 +356,11 @@ interface nsISHEntry : nsISupports
* in js, but easier to maintain and less opaque.
*/
void setAsHistoryLoad();
};
[scriptable, uuid(bb66ac35-253b-471f-a317-3ece940f04c5)]
interface nsISHEntryInternal : nsISupports
{
[notxpcom] void RemoveFromBFCacheAsync();
[notxpcom] void RemoveFromBFCacheSync();
/**
* A number that is assigned by the sHistory when the entry is activated
*/
attribute unsigned long lastTouched;
[noscript] attribute unsigned long lastTouched;
/**
* Some state, particularly that related to the back/forward cache, is
@ -380,6 +372,34 @@ interface nsISHEntryInternal : nsISupports
*/
[noscript, notxpcom]
nsSHEntryShared getSharedState();
/**
* The current number of nsISHEntries which are immediate children of this
* SHEntry.
*/
readonly attribute long childCount;
/**
* Add a new child SHEntry. If offset is -1 adds to the end of the list.
*/
void AddChild(in nsISHEntry aChild, in long aOffset);
/**
* Remove a child SHEntry.
*/
void RemoveChild(in nsISHEntry aChild);
/**
* Get child at an index.
*/
nsISHEntry GetChildAt(in long aIndex);
/**
* Replaces a child which is for the same docshell as aNewChild
* with aNewChild.
* @throw if nothing was replaced.
*/
void ReplaceChild(in nsISHEntry aNewChild);
};
%{ C++
@ -389,6 +409,5 @@ interface nsISHEntryInternal : nsISupports
#define NS_SHENTRY_CONTRACTID \
"@mozilla.org/browser/session-history-entry;1"
%}

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

@ -6,7 +6,6 @@
#include "nsISupports.idl"
interface nsIBFCacheEntry;
interface nsISHContainer;
interface nsISHEntry;
interface nsISHistoryListener;
interface nsISHTransaction;
@ -106,13 +105,13 @@ interface nsISHistoryInternal: nsISupports
* @param aIndex
* Index to remove dynamic entries from. It will be passed to
* RemoveEntries as aStartIndex.
* @param aContainer (optional)
* The container to start looking for dynamic entries. Only the
* dynamic descendants of the container will be removed. If not given,
* @param aEntry (optional)
* The entry to start looking in for dynamic entries. Only the
* dynamic descendants of the entry will be removed. If not given,
* all dynamic entries at the index will be removed.
*/
[noscript, notxpcom] void RemoveDynEntries(in long aIndex,
in nsISHContainer aContainer);
in nsISHEntry aEntry);
/**
* Similar to RemoveDynEntries, but instead of specifying an index, use the

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

@ -76,7 +76,7 @@ nsSHEntry::~nsSHEntry()
}
}
NS_IMPL_ISUPPORTS(nsSHEntry, nsISHContainer, nsISHEntry, nsISHEntryInternal)
NS_IMPL_ISUPPORTS(nsSHEntry, nsISHEntry)
NS_IMETHODIMP
nsSHEntry::SetScrollPosition(int32_t aX, int32_t aY)
@ -589,10 +589,7 @@ nsSHEntry::HasBFCacheEntry(nsIBFCacheEntry* aEntry)
NS_IMETHODIMP
nsSHEntry::AdoptBFCacheEntry(nsISHEntry* aEntry)
{
nsCOMPtr<nsISHEntryInternal> shEntry = do_QueryInterface(aEntry);
NS_ENSURE_STATE(shEntry);
nsSHEntryShared* shared = shEntry->GetSharedState();
nsSHEntryShared* shared = aEntry->GetSharedState();
NS_ENSURE_STATE(shared);
mShared = shared;
@ -604,10 +601,7 @@ nsSHEntry::SharesDocumentWith(nsISHEntry* aEntry, bool* aOut)
{
NS_ENSURE_ARG_POINTER(aOut);
nsCOMPtr<nsISHEntryInternal> internal = do_QueryInterface(aEntry);
NS_ENSURE_STATE(internal);
*aOut = mShared == internal->GetSharedState();
*aOut = mShared == aEntry->GetSharedState();
return NS_OK;
}
@ -887,18 +881,6 @@ nsSHEntry::SyncPresentationState()
return mShared->SyncPresentationState();
}
void
nsSHEntry::RemoveFromBFCacheSync()
{
mShared->RemoveFromBFCacheSync();
}
void
nsSHEntry::RemoveFromBFCacheAsync()
{
mShared->RemoveFromBFCacheAsync();
}
nsDocShellEditorData*
nsSHEntry::ForgetEditorData()
{

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

@ -9,7 +9,6 @@
#include "nsCOMArray.h"
#include "nsCOMPtr.h"
#include "nsISHContainer.h"
#include "nsISHEntry.h"
#include "nsString.h"
@ -19,9 +18,7 @@ class nsSHEntryShared;
class nsIInputStream;
class nsIURI;
class nsSHEntry final : public nsISHEntry,
public nsISHContainer,
public nsISHEntryInternal
class nsSHEntry final : public nsISHEntry
{
public:
nsSHEntry();
@ -29,8 +26,6 @@ public:
NS_DECL_ISUPPORTS
NS_DECL_NSISHENTRY
NS_DECL_NSISHENTRYINTERNAL
NS_DECL_NSISHCONTAINER
void DropPresentationState();

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

@ -17,7 +17,6 @@
#include "nsIDocShellTreeItem.h"
#include "nsILayoutHistoryState.h"
#include "nsIObserverService.h"
#include "nsISHContainer.h"
#include "nsISHEntry.h"
#include "nsISHistoryListener.h"
#include "nsISHTransaction.h"
@ -233,8 +232,7 @@ nsSHistory::EvictContentViewerForTransaction(nsISHTransaction* aTrans)
int32_t index = -1;
GetIndexOfEntry(entry, &index);
if (index != -1) {
nsCOMPtr<nsISHContainer> container(do_QueryInterface(entry));
RemoveDynEntries(index, container);
RemoveDynEntries(index, entry);
}
}
@ -419,16 +417,11 @@ nsSHistory::WalkHistoryEntries(nsISHEntry* aRootEntry,
{
NS_ENSURE_TRUE(aRootEntry, NS_ERROR_FAILURE);
nsCOMPtr<nsISHContainer> container(do_QueryInterface(aRootEntry));
if (!container) {
return NS_ERROR_FAILURE;
}
int32_t childCount;
container->GetChildCount(&childCount);
aRootEntry->GetChildCount(&childCount);
for (int32_t i = 0; i < childCount; i++) {
nsCOMPtr<nsISHEntry> childEntry;
container->GetChildAt(i, getter_AddRefs(childEntry));
aRootEntry->GetChildAt(i, getter_AddRefs(childEntry));
if (!childEntry) {
// childEntry can be null for valid reasons, for example if the
// docshell at index i never loaded anything useful.
@ -493,10 +486,9 @@ nsSHistory::CloneAndReplaceChild(nsISHEntry* aEntry,
uint32_t cloneID = data->cloneID;
nsISHEntry* replaceEntry = data->replaceEntry;
nsCOMPtr<nsISHContainer> container = do_QueryInterface(data->destTreeParent);
if (!aEntry) {
if (container) {
container->AddChild(nullptr, aEntryIndex);
if (data->destTreeParent) {
data->destTreeParent->AddChild(nullptr, aEntryIndex);
}
return NS_OK;
}
@ -528,8 +520,8 @@ nsSHistory::CloneAndReplaceChild(nsISHEntry* aEntry,
aShell->SwapHistoryEntries(aEntry, dest);
}
if (container) {
container->AddChild(dest, aEntryIndex);
if (data->destTreeParent) {
data->destTreeParent->AddChild(dest, aEntryIndex);
}
data->resultEntry = dest;
@ -570,9 +562,8 @@ nsSHistory::SetChildHistoryEntry(nsISHEntry* aEntry, nsDocShell* aShell,
nsISHEntry* destTreeRoot = data->destTreeRoot;
nsCOMPtr<nsISHEntry> destEntry;
nsCOMPtr<nsISHContainer> container = do_QueryInterface(data->destTreeParent);
if (container) {
if (data->destTreeParent) {
// aEntry is a clone of some child of destTreeParent, but since the
// trees aren't necessarily in sync, we'll have to locate it.
// Note that we could set aShell's entry to null if we don't find a
@ -583,14 +574,14 @@ nsSHistory::SetChildHistoryEntry(nsISHEntry* aEntry, nsDocShell* aShell,
// First look at the given index, since this is the common case.
nsCOMPtr<nsISHEntry> entry;
container->GetChildAt(aEntryIndex, getter_AddRefs(entry));
data->destTreeParent->GetChildAt(aEntryIndex, getter_AddRefs(entry));
if (entry && NS_SUCCEEDED(entry->GetID(&id)) && id == targetID) {
destEntry.swap(entry);
} else {
int32_t childCount;
container->GetChildCount(&childCount);
data->destTreeParent->GetChildCount(&childCount);
for (int32_t i = 0; i < childCount; ++i) {
container->GetChildAt(i, getter_AddRefs(entry));
data->destTreeParent->GetChildAt(i, getter_AddRefs(entry));
if (!entry) {
continue;
}
@ -1303,12 +1294,7 @@ public:
nsCOMPtr<nsISHEntry> shentry;
mTransaction->GetSHEntry(getter_AddRefs(shentry));
nsCOMPtr<nsISHEntryInternal> shentryInternal = do_QueryInterface(shentry);
if (shentryInternal) {
shentryInternal->GetLastTouched(&mLastTouched);
} else {
NS_WARNING("Can't cast to nsISHEntryInternal?");
}
shentry->GetLastTouched(&mLastTouched);
}
bool operator<(const TransactionAndDistance& aOther) const
@ -1526,15 +1512,15 @@ nsSHistory::GloballyEvictAllContentViewers()
}
void
GetDynamicChildren(nsISHContainer* aContainer,
GetDynamicChildren(nsISHEntry* aEntry,
nsTArray<nsID>& aDocshellIDs,
bool aOnlyTopLevelDynamic)
{
int32_t count = 0;
aContainer->GetChildCount(&count);
aEntry->GetChildCount(&count);
for (int32_t i = 0; i < count; ++i) {
nsCOMPtr<nsISHEntry> child;
aContainer->GetChildAt(i, getter_AddRefs(child));
aEntry->GetChildAt(i, getter_AddRefs(child));
if (child) {
bool dynAdded = false;
child->IsDynamicallyAdded(&dynAdded);
@ -1543,42 +1529,30 @@ GetDynamicChildren(nsISHContainer* aContainer,
aDocshellIDs.AppendElement(docshellID);
}
if (!dynAdded || !aOnlyTopLevelDynamic) {
nsCOMPtr<nsISHContainer> childAsContainer = do_QueryInterface(child);
if (childAsContainer) {
GetDynamicChildren(childAsContainer, aDocshellIDs,
aOnlyTopLevelDynamic);
}
GetDynamicChildren(child, aDocshellIDs, aOnlyTopLevelDynamic);
}
}
}
}
bool
RemoveFromSessionHistoryContainer(nsISHContainer* aContainer,
nsTArray<nsID>& aDocshellIDs)
RemoveFromSessionHistoryEntry(nsISHEntry* aRoot, nsTArray<nsID>& aDocshellIDs)
{
nsCOMPtr<nsISHEntry> root = do_QueryInterface(aContainer);
NS_ENSURE_TRUE(root, false);
bool didRemove = false;
int32_t childCount = 0;
aContainer->GetChildCount(&childCount);
aRoot->GetChildCount(&childCount);
for (int32_t i = childCount - 1; i >= 0; --i) {
nsCOMPtr<nsISHEntry> child;
aContainer->GetChildAt(i, getter_AddRefs(child));
aRoot->GetChildAt(i, getter_AddRefs(child));
if (child) {
nsID docshelldID = child->DocshellID();
if (aDocshellIDs.Contains(docshelldID)) {
didRemove = true;
aContainer->RemoveChild(child);
aRoot->RemoveChild(child);
} else {
nsCOMPtr<nsISHContainer> container = do_QueryInterface(child);
if (container) {
bool childRemoved =
RemoveFromSessionHistoryContainer(container, aDocshellIDs);
if (childRemoved) {
didRemove = true;
}
bool childRemoved = RemoveFromSessionHistoryEntry(child, aDocshellIDs);
if (childRemoved) {
didRemove = true;
}
}
}
@ -1590,10 +1564,9 @@ bool
RemoveChildEntries(nsISHistory* aHistory, int32_t aIndex,
nsTArray<nsID>& aEntryIDs)
{
nsCOMPtr<nsISHEntry> rootHE;
aHistory->GetEntryAtIndex(aIndex, false, getter_AddRefs(rootHE));
nsCOMPtr<nsISHContainer> root = do_QueryInterface(rootHE);
return root ? RemoveFromSessionHistoryContainer(root, aEntryIDs) : false;
nsCOMPtr<nsISHEntry> root;
aHistory->GetEntryAtIndex(aIndex, false, getter_AddRefs(root));
return root ? RemoveFromSessionHistoryEntry(root, aEntryIDs) : false;
}
bool
@ -1612,17 +1585,15 @@ IsSameTree(nsISHEntry* aEntry1, nsISHEntry* aEntry2)
return false;
}
nsCOMPtr<nsISHContainer> container1 = do_QueryInterface(aEntry1);
nsCOMPtr<nsISHContainer> container2 = do_QueryInterface(aEntry2);
int32_t count1, count2;
container1->GetChildCount(&count1);
container2->GetChildCount(&count2);
aEntry1->GetChildCount(&count1);
aEntry2->GetChildCount(&count2);
// We allow null entries in the end of the child list.
int32_t count = std::max(count1, count2);
for (int32_t i = 0; i < count; ++i) {
nsCOMPtr<nsISHEntry> child1, child2;
container1->GetChildAt(i, getter_AddRefs(child1));
container2->GetChildAt(i, getter_AddRefs(child2));
aEntry1->GetChildAt(i, getter_AddRefs(child1));
aEntry2->GetChildAt(i, getter_AddRefs(child2));
if (!IsSameTree(child1, child2)) {
return false;
}
@ -1727,19 +1698,17 @@ nsSHistory::RemoveEntries(nsTArray<nsID>& aIDs, int32_t aStartIndex)
}
void
nsSHistory::RemoveDynEntries(int32_t aIndex, nsISHContainer* aContainer)
nsSHistory::RemoveDynEntries(int32_t aIndex, nsISHEntry* aEntry)
{
// Remove dynamic entries which are at the index and belongs to the container.
nsCOMPtr<nsISHContainer> container(aContainer);
if (!container) {
nsCOMPtr<nsISHEntry> entry;
nsCOMPtr<nsISHEntry> entry(aEntry);
if (!entry) {
GetEntryAtIndex(aIndex, false, getter_AddRefs(entry));
container = do_QueryInterface(entry);
}
if (container) {
if (entry) {
AutoTArray<nsID, 16> toBeRemovedEntries;
GetDynamicChildren(container, toBeRemovedEntries, true);
GetDynamicChildren(entry, toBeRemovedEntries, true);
if (toBeRemovedEntries.Length()) {
RemoveEntries(toBeRemovedEntries, aIndex);
}
@ -1755,8 +1724,7 @@ nsSHistory::RemoveDynEntriesForBFCacheEntry(nsIBFCacheEntry* aEntry)
if (trans) {
nsCOMPtr<nsISHEntry> entry;
trans->GetSHEntry(getter_AddRefs(entry));
nsCOMPtr<nsISHContainer> container(do_QueryInterface(entry));
RemoveDynEntries(index, container);
RemoveDynEntries(index, entry);
}
}
@ -1896,11 +1864,8 @@ nsSHistory::LoadEntry(int32_t aIndex, long aLoadType, uint32_t aHistCmd)
}
// Remember that this entry is getting loaded at this point in the sequence
nsCOMPtr<nsISHEntryInternal> entryInternal = do_QueryInterface(nextEntry);
if (entryInternal) {
entryInternal->SetLastTouched(++gTouchCounter);
}
nextEntry->SetLastTouched(++gTouchCounter);
// Get the uri for the entry we are about to visit
nextEntry->GetURI(getter_AddRefs(nextURI));
@ -1975,15 +1940,9 @@ nsSHistory::LoadDifferingEntries(nsISHEntry* aPrevEntry, nsISHEntry* aNextEntry,
int32_t pcnt = 0;
int32_t ncnt = 0;
int32_t dsCount = 0;
nsCOMPtr<nsISHContainer> prevContainer(do_QueryInterface(aPrevEntry));
nsCOMPtr<nsISHContainer> nextContainer(do_QueryInterface(aNextEntry));
if (!prevContainer || !nextContainer) {
return NS_ERROR_FAILURE;
}
prevContainer->GetChildCount(&pcnt);
nextContainer->GetChildCount(&ncnt);
aPrevEntry->GetChildCount(&pcnt);
aNextEntry->GetChildCount(&ncnt);
aParent->GetChildCount(&dsCount);
// Create an array for child docshells.
@ -2001,7 +1960,7 @@ nsSHistory::LoadDifferingEntries(nsISHEntry* aPrevEntry, nsISHEntry* aNextEntry,
for (int32_t i = 0; i < ncnt; ++i) {
// First get an entry which may cause a new page to be loaded.
nsCOMPtr<nsISHEntry> nChild;
nextContainer->GetChildAt(i, getter_AddRefs(nChild));
aNextEntry->GetChildAt(i, getter_AddRefs(nChild));
if (!nChild) {
continue;
}
@ -2027,7 +1986,7 @@ nsSHistory::LoadDifferingEntries(nsISHEntry* aPrevEntry, nsISHEntry* aNextEntry,
nsCOMPtr<nsISHEntry> pChild;
for (int32_t k = 0; k < pcnt; ++k) {
nsCOMPtr<nsISHEntry> child;
prevContainer->GetChildAt(k, getter_AddRefs(child));
aPrevEntry->GetChildAt(k, getter_AddRefs(child));
if (child) {
nsID dID = child->DocshellID();
if (dID == docshellID) {

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

@ -50,9 +50,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1375833
is(newFrameDocShellId, frameDocShellId, "check docshell ID remains after reload");
let entry = shistory.legacySHistory.getEntryAtIndex(shistory.index, false);
let frameEntry = SpecialPowers.wrap(entry)
.QueryInterface(SpecialPowers.Ci.nsISHContainer)
.GetChildAt(0);
let frameEntry = entry.GetChildAt(0);
is(String(frameEntry.docshellID), frameDocShellId, "check newly added shentry uses the same docshell ID");
webNav.goBack();

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

@ -111,7 +111,6 @@ function dumpSHistory(theWindow)
for (let i = 0; i < sh.count; i++) {
let shentry = sh.legacySHistory.getEntryAtIndex(i, false);
dump(" " + i + ": " + shentry.URI.spec + '\n');
shentry.QueryInterface(SpecialPowers.Ci.nsISHContainer);
for (let j = 0; j < shentry.childCount; j++) {
let child = shentry.GetChildAt(j);
dump(" child " + j + ": " + child.URI.spec + '\n');

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

@ -17,7 +17,6 @@
#include "nsIWebNavigation.h"
#include "nsISHistory.h"
#include "nsISHEntry.h"
#include "nsISHContainer.h"
#include "nsIWindowWatcher.h"
#include "mozilla/Services.h"
#include "nsIXULWindow.h"
@ -233,15 +232,13 @@ MarkSHEntry(nsISHEntry* aSHEntry, bool aCleanupJS)
MarkDocShell(child, aCleanupJS);
}
nsCOMPtr<nsISHContainer> shCont = do_QueryInterface(aSHEntry);
int32_t count;
shCont->GetChildCount(&count);
aSHEntry->GetChildCount(&count);
for (i = 0; i < count; ++i) {
nsCOMPtr<nsISHEntry> childEntry;
shCont->GetChildAt(i, getter_AddRefs(childEntry));
aSHEntry->GetChildAt(i, getter_AddRefs(childEntry));
MarkSHEntry(childEntry, aCleanupJS);
}
}
void

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

@ -2,16 +2,14 @@
// it to our newly made class, we will be sure to set it up with the correct name
// and .prototype, so that everything works properly.
// The template classes should have all their code on a single line, so that
// bytecodes' line offsets within the script don't contribute spurious offsets
// when we transplant them into the real class definition. Punting on column numbers.
var DefaultDerivedClassConstructor =
class extends null {
constructor(...args) {
super(...allowContentIter(args));
}
};
class extends null { constructor(...args) { super(...allowContentIter(args)); } };
MakeDefaultConstructor(DefaultDerivedClassConstructor);
var DefaultBaseClassConstructor =
class {
constructor() { }
};
class { constructor() { } };
MakeDefaultConstructor(DefaultBaseClassConstructor);

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

@ -304,22 +304,22 @@ js::intl_FormatRelativeTime(JSContext* cx, unsigned argc, Value* vp)
if (!unit)
return false;
if (StringEqualsAscii(unit, "second")) {
if (StringEqualsAscii(unit, "second") || StringEqualsAscii(unit, "seconds")) {
relDateTimeUnit = UDAT_REL_UNIT_SECOND;
} else if (StringEqualsAscii(unit, "minute")) {
} else if (StringEqualsAscii(unit, "minute") || StringEqualsAscii(unit, "minutes")) {
relDateTimeUnit = UDAT_REL_UNIT_MINUTE;
} else if (StringEqualsAscii(unit, "hour")) {
} else if (StringEqualsAscii(unit, "hour") || StringEqualsAscii(unit, "hours")) {
relDateTimeUnit = UDAT_REL_UNIT_HOUR;
} else if (StringEqualsAscii(unit, "day")) {
} else if (StringEqualsAscii(unit, "day") || StringEqualsAscii(unit, "days")) {
relDateTimeUnit = UDAT_REL_UNIT_DAY;
} else if (StringEqualsAscii(unit, "week")) {
} else if (StringEqualsAscii(unit, "week") || StringEqualsAscii(unit, "weeks")) {
relDateTimeUnit = UDAT_REL_UNIT_WEEK;
} else if (StringEqualsAscii(unit, "month")) {
} else if (StringEqualsAscii(unit, "month") || StringEqualsAscii(unit, "months")) {
relDateTimeUnit = UDAT_REL_UNIT_MONTH;
} else if (StringEqualsAscii(unit, "quarter")) {
} else if (StringEqualsAscii(unit, "quarter") || StringEqualsAscii(unit, "quarters")) {
relDateTimeUnit = UDAT_REL_UNIT_QUARTER;
} else {
MOZ_ASSERT(StringEqualsAscii(unit, "year"));
MOZ_ASSERT(StringEqualsAscii(unit, "year") || StringEqualsAscii(unit, "years"));
relDateTimeUnit = UDAT_REL_UNIT_YEAR;
}
}

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

@ -188,13 +188,21 @@ function Intl_RelativeTimeFormat_format(value, unit) {
switch (u) {
case "second":
case "seconds":
case "minute":
case "minutes":
case "hour":
case "hours":
case "day":
case "days":
case "week":
case "weeks":
case "month":
case "months":
case "quarter":
case "quarters":
case "year":
case "years":
break;
default:
ThrowRangeError(JSMSG_INVALID_OPTION_VALUE, "unit", u);

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

@ -357,26 +357,10 @@ other kinds of objects.
[visible frame][vf] currently on the calling thread's stack, or `null`
if there are no visible frames on the stack.
<code>findSources([<i>query</i>]) <i>(not yet implemented)</i></code>
: Return an array of all [`Debugger.Source`][source] instances matching
<i>query</i>. Each source appears only once in the array. <i>Query</i>
is an object whose properties restrict which sources are returned; a
source must meet all the criteria given by <i>query</i> to be returned.
If <i>query</i> is omitted, we return all sources of all debuggee
<code>findSources()</code>
: Return an array of all [`Debugger.Source`][source] instances of all debuggee
scripts.
<i>Query</i> may have the following properties:
`url`
: The source's `url` property must be equal to this value.
`global`
: The source must have been evaluated in the scope of the given global
object. If this property's value is a [`Debugger.Object`][object] instance
belonging to this `Debugger` instance, then its referent is used. If the
object is not a global object, then the global in whose scope it was
allocated is used.
Note that the result may include sources that can no longer ever be
used by the debuggee: say, eval code that has finished running, or
source for unreachable functions. Whether such sources appear can be

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

@ -1,5 +1,3 @@
// |jit-test| error:TypeError
// Binary: cache/js-dbg-32-0428dbdf3d58-linux
// Flags:
//

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

@ -0,0 +1,24 @@
// Test the source location info in a derived-class default constructor.
function W() { test(); }
class Z extends W {} // line 4
class Y extends Z {} // line 5
class X extends Y {} // line 7
function test() {
for (let frame of new Error().stack.split('\n')) {
function lineNumber(frame) {
return +frame.match(/(\d+):\d+$/)[1];
}
if (frame.startsWith("Z@"))
assertEq(lineNumber(frame), 4);
if (frame.startsWith("Y@"))
assertEq(lineNumber(frame), 5);
if (frame.startsWith("X@"))
assertEq(lineNumber(frame), 7);
}
}
new X;

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

@ -0,0 +1,4 @@
// In a debugger with no debuggees, findSources should return no scripts.
const dbg = new Debugger;
assertEq(dbg.findSources().length, 0);

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

@ -0,0 +1,15 @@
// In a debugger with scripts, findSources finds the script source.
const g = newGlobal();
// Declare a function in order to keep the script source alive across GC.
g.evaluate(`function fa() {}`, { fileName: "a.js" });
g.evaluate(`function fb() {}`, { fileName: "b.js" });
g.evaluate(`function fc() {}`, { fileName: "c.js" });
const dbg = new Debugger();
const gw = dbg.addDebuggee(g);
const sources = dbg.findSources();
assertEq(sources.filter(s => s.url == "a.js").length, 1);
assertEq(sources.filter(s => s.url == "b.js").length, 1);
assertEq(sources.filter(s => s.url == "c.js").length, 1);

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

@ -0,0 +1,19 @@
// In a debugger with multiple debuggees, findSources finds script sources across all debuggees.
const g1 = newGlobal();
const g2 = newGlobal();
// Declare a function in order to keep the script source alive across GC.
g1.evaluate(`function fa() {}`, { fileName: "a.js" });
g1.evaluate(`function fb() {}`, { fileName: "b.js" });
g2.evaluate(`function fc() {}`, { fileName: "c.js" });
g2.evaluate(`function fd() {}`, { fileName: "d.js" });
const dbg = new Debugger();
const g1w = dbg.addDebuggee(g1);
const g2w = dbg.addDebuggee(g2);
const sources = dbg.findSources();
assertEq(dbg.findSources().filter(s => s.url == "a.js").length, 1);
assertEq(dbg.findSources().filter(s => s.url == "b.js").length, 1);
assertEq(dbg.findSources().filter(s => s.url == "c.js").length, 1);
assertEq(dbg.findSources().filter(s => s.url == "d.js").length, 1);

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

@ -0,0 +1,34 @@
// We should be able to retrieve the script of a class's default constructor.
var g = newGlobal();
var dbg = new Debugger;
var gDO = dbg.addDebuggee(g);
// Class definitions go in the global's lexical environment, so we can't use
// getOwnPropertyDescriptor or g.X to retrieve their constructor.
//
// Derived clasess use a different script from the self-hosted compartment, so
// check those too.
gDO.executeInGlobal(` // 1729
class X {}; // 1730
// 1731
// 1732
class Y extends X {}; // 1733
`, { lineNumber: 1729 });
function check(name, text, startLine) {
print(`checking ${name}`);
var desc = gDO.executeInGlobal(name).return;
assertEq(desc.class, 'Function');
assertEq(desc.name, name);
var script = desc.script;
assertEq(script instanceof Debugger.Script, true,
"default constructor's script should be available");
assertEq(script.startLine, startLine,
"default constructor's starting line should be set");
var source = script.source;
assertEq(source.text.substr(script.sourceStart, script.sourceLength), text);
}
check('X', 'class X {}', 1730);
check('Y', 'class Y extends X {}', 1733);

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

@ -89,6 +89,18 @@ addIntlExtras(Intl);
assertEq(rtf.format(1, "year"), "next year");
}
{
// Plural specifier
rtf = new Intl.RelativeTimeFormat("en-US");
assertEq(rtf.format(1, "seconds"), "in 1 second");
assertEq(rtf.format(1, "minutes"), "in 1 minute");
assertEq(rtf.format(1, "hours"), "in 1 hour");
assertEq(rtf.format(1, "days"), "in 1 day");
assertEq(rtf.format(1, "weeks"), "in 1 week");
assertEq(rtf.format(1, "months"), "in 1 month");
assertEq(rtf.format(1, "years"), "in 1 year");
}
rtf = new Intl.RelativeTimeFormat("de", {numeric: "auto"});
assertEq(rtf.format(-1, "day"), "gestern");
assertEq(rtf.format(1, "day"), "morgen");

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

@ -1,11 +1,7 @@
var ab = new ArrayBuffer(5);
var p = new Proxy(ab, {});
var ps = Object.getOwnPropertyDescriptor(Object.prototype, "__proto__").set;
var threw = 0;
try {
ps.call(p, {});
} catch(ex) {
threw = 1;
}
var new_proto = {};
ps.call(p, new_proto);
reportCompare(1, threw, "Setting __proto__ on a proxy to an ArrayBuffer must throw.");
reportCompare(ab.__proto__, new_proto);

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

@ -9,8 +9,11 @@ try {
}
}
// assert cycle doesn't work
assertEq(test(x), true);
assertEq(test({}), true);
assertEq(test(null), true);
// works
assertEq(test({}), false);
assertEq(test(null), false);
reportCompare(true, true);

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

@ -4188,19 +4188,73 @@ Debugger::removeDebuggeeGlobal(FreeOp* fop, GlobalObject* global,
static inline DebuggerSourceReferent GetSourceReferent(JSObject* obj);
class MOZ_STACK_CLASS Debugger::QueryBase
{
protected:
QueryBase(JSContext* cx, Debugger* dbg)
: cx(cx),
debugger(dbg),
iterMarker(&cx->runtime()->gc),
realms(cx->zone()),
oom(false)
{}
// The context in which we should do our work.
JSContext* cx;
// The debugger for which we conduct queries.
Debugger* debugger;
// Require the set of realms to stay fixed while this query is alive.
gc::AutoEnterIteration iterMarker;
using RealmSet = HashSet<Realm*, DefaultHasher<Realm*>, ZoneAllocPolicy>;
// A script must be in one of these realms to match the query.
RealmSet realms;
// Indicates whether OOM has occurred while matching.
bool oom;
bool addRealm(Realm* realm) {
return realms.put(realm);
}
// Arrange for this query to match only scripts that run in |global|.
bool matchSingleGlobal(GlobalObject* global) {
MOZ_ASSERT(realms.count() == 0);
if (!addRealm(global->realm())) {
ReportOutOfMemory(cx);
return false;
}
return true;
}
// Arrange for this ScriptQuery to match all scripts running in debuggee
// globals.
bool matchAllDebuggeeGlobals() {
MOZ_ASSERT(realms.count() == 0);
// Build our realm set from the debugger's set of debuggee globals.
for (WeakGlobalObjectSet::Range r = debugger->debuggees.all(); !r.empty(); r.popFront()) {
if (!addRealm(r.front()->realm())) {
ReportOutOfMemory(cx);
return false;
}
}
return true;
}
};
/*
* A class for parsing 'findScripts' query arguments and searching for
* scripts that match the criteria they represent.
*/
class MOZ_STACK_CLASS Debugger::ScriptQuery
class MOZ_STACK_CLASS Debugger::ScriptQuery : public Debugger::QueryBase
{
public:
/* Construct a ScriptQuery to use matching scripts for |dbg|. */
ScriptQuery(JSContext* cx, Debugger* dbg):
cx(cx),
debugger(dbg),
iterMarker(&cx->runtime()->gc),
realms(cx->zone()),
ScriptQuery(JSContext* cx, Debugger* dbg)
: QueryBase(cx, dbg),
url(cx),
displayURLString(cx),
hasSource(false),
@ -4211,8 +4265,7 @@ class MOZ_STACK_CLASS Debugger::ScriptQuery
innermostForRealm(cx->zone()),
scriptVector(cx, ScriptVector(cx)),
lazyScriptVector(cx, LazyScriptVector(cx)),
wasmInstanceVector(cx, WasmInstanceObjectVector(cx)),
oom(false)
wasmInstanceVector(cx, WasmInstanceObjectVector(cx))
{}
/*
@ -4436,20 +4489,6 @@ class MOZ_STACK_CLASS Debugger::ScriptQuery
}
private:
/* The context in which we should do our work. */
JSContext* cx;
/* The debugger for which we conduct queries. */
Debugger* debugger;
/* Require the set of realms to stay fixed while the ScriptQuery is alive. */
gc::AutoEnterIteration iterMarker;
using RealmSet = HashSet<Realm*, DefaultHasher<Realm*>, ZoneAllocPolicy>;
/* A script must be in one of these realms to match the query. */
RealmSet realms;
/* If this is a string, matching scripts have urls equal to it. */
RootedValue url;
@ -4499,39 +4538,6 @@ class MOZ_STACK_CLASS Debugger::ScriptQuery
*/
Rooted<WasmInstanceObjectVector> wasmInstanceVector;
/* Indicates whether OOM has occurred while matching. */
bool oom;
bool addRealm(Realm* realm) {
return realms.put(realm);
}
/* Arrange for this ScriptQuery to match only scripts that run in |global|. */
bool matchSingleGlobal(GlobalObject* global) {
MOZ_ASSERT(realms.count() == 0);
if (!addRealm(global->realm())) {
ReportOutOfMemory(cx);
return false;
}
return true;
}
/*
* Arrange for this ScriptQuery to match all scripts running in debuggee
* globals.
*/
bool matchAllDebuggeeGlobals() {
MOZ_ASSERT(realms.count() == 0);
// Build our realm set from the debugger's set of debuggee globals.
for (WeakGlobalObjectSet::Range r = debugger->debuggees.all(); !r.empty(); r.popFront()) {
if (!addRealm(r.front()->realm())) {
ReportOutOfMemory(cx);
return false;
}
}
return true;
}
/*
* Given that parseQuery or omittedQuery has been called, prepare to match
* scripts. Set urlCString and displayURLChars as appropriate.
@ -4765,6 +4771,160 @@ Debugger::findScripts(JSContext* cx, unsigned argc, Value* vp)
return true;
}
/*
* A class for searching sources for 'findSources'.
*/
class MOZ_STACK_CLASS Debugger::SourceQuery : public Debugger::QueryBase
{
public:
using SourceSet = JS::GCHashSet<JSObject*,
js::MovableCellHasher<JSObject*>,
ZoneAllocPolicy>;
SourceQuery(JSContext* cx, Debugger* dbg)
: QueryBase(cx, dbg),
sources(cx, SourceSet(cx->zone()))
{}
bool findSources() {
if (!matchAllDebuggeeGlobals())
return false;
Realm* singletonRealm = nullptr;
if (realms.count() == 1)
singletonRealm = realms.all().front();
// Search each realm for debuggee scripts.
MOZ_ASSERT(sources.empty());
oom = false;
IterateScripts(cx, singletonRealm, this, considerScript);
IterateLazyScripts(cx, singletonRealm, this, considerLazyScript);
if (oom) {
ReportOutOfMemory(cx);
return false;
}
// TODO: Until such time that wasm modules are real ES6 modules,
// unconditionally consider all wasm toplevel instance scripts.
for (WeakGlobalObjectSet::Range r = debugger->allDebuggees(); !r.empty(); r.popFront()) {
for (wasm::Instance* instance : r.front()->realm()->wasm.instances()) {
consider(instance->object());
if (oom) {
ReportOutOfMemory(cx);
return false;
}
}
}
return true;
}
Handle<SourceSet> foundSources() const {
return sources;
}
private:
Rooted<SourceSet> sources;
static void considerScript(JSRuntime* rt, void* data, JSScript* script,
const JS::AutoRequireNoGC& nogc) {
SourceQuery* self = static_cast<SourceQuery*>(data);
self->consider(script, nogc);
}
static void considerLazyScript(JSRuntime* rt, void* data, LazyScript* lazyScript,
const JS::AutoRequireNoGC& nogc) {
SourceQuery* self = static_cast<SourceQuery*>(data);
self->consider(lazyScript, nogc);
}
void consider(JSScript* script, const JS::AutoRequireNoGC& nogc) {
if (oom || script->selfHosted())
return;
Realm* realm = script->realm();
if (!realms.has(realm))
return;
if (!script->sourceObject())
return;
ScriptSourceObject* source =
&UncheckedUnwrap(script->sourceObject())->as<ScriptSourceObject>();
if (!sources.put(source))
oom = true;
}
void consider(LazyScript* lazyScript, const JS::AutoRequireNoGC& nogc) {
if (oom)
return;
Realm* realm = lazyScript->realm();
if (!realms.has(realm))
return;
// If the script is already delazified, it should already be handled.
if (lazyScript->maybeScript())
return;
ScriptSourceObject* source = &lazyScript->sourceObject();
if (!sources.put(source))
oom = true;
}
void consider(WasmInstanceObject* instanceObject) {
if (oom)
return;
if (!sources.put(instanceObject))
oom = true;
}
};
static inline DebuggerSourceReferent
AsSourceReferent(JSObject* obj)
{
if (obj->is<ScriptSourceObject>()) {
return AsVariant(&obj->as<ScriptSourceObject>());
}
return AsVariant(&obj->as<WasmInstanceObject>());
}
/* static */ bool
Debugger::findSources(JSContext* cx, unsigned argc, Value* vp)
{
THIS_DEBUGGER(cx, argc, vp, "findSources", args, dbg);
if (gc::GCRuntime::temporaryAbortIfWasmGc(cx)) {
JS_ReportErrorASCII(cx, "API temporarily unavailable under wasm gc");
return false;
}
SourceQuery query(cx, dbg);
if (!query.findSources())
return false;
Handle<SourceQuery::SourceSet> sources(query.foundSources());
size_t resultLength = sources.count();
RootedArrayObject result(cx, NewDenseFullyAllocatedArray(cx, resultLength));
if (!result)
return false;
result->ensureDenseInitializedLength(cx, 0, resultLength);
size_t i = 0;
for (auto iter = sources.get().iter(); !iter.done(); iter.next()) {
Rooted<DebuggerSourceReferent> sourceReferent(cx, AsSourceReferent(iter.get()));
RootedObject sourceObject(cx, dbg->wrapVariantReferent(cx, sourceReferent));
if (!sourceObject)
return false;
result->setDenseElement(i, ObjectValue(*sourceObject));
i++;
}
args.rval().setObject(*result);
return true;
}
/*
* A class for parsing 'findObjects' query arguments and searching for objects
* that match the criteria they represent.
@ -5181,6 +5341,7 @@ const JSFunctionSpec Debugger::methods[] = {
JS_FN("getNewestFrame", Debugger::getNewestFrame, 0, 0),
JS_FN("clearAllBreakpoints", Debugger::clearAllBreakpoints, 0, 0),
JS_FN("findScripts", Debugger::findScripts, 1, 0),
JS_FN("findSources", Debugger::findSources, 1, 0),
JS_FN("findObjects", Debugger::findObjects, 1, 0),
JS_FN("findAllGlobals", Debugger::findAllGlobals, 0, 0),
JS_FN("makeGlobalObjectReference", Debugger::makeGlobalObjectReference, 1, 0),

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

@ -566,7 +566,9 @@ class Debugger : private mozilla::LinkedListElement<Debugger>
uint32_t traceLoggerScriptedCallsLastDrainedSize;
uint32_t traceLoggerScriptedCallsLastDrainedIteration;
class QueryBase;
class ScriptQuery;
class SourceQuery;
class ObjectQuery;
MOZ_MUST_USE bool addDebuggeeGlobal(JSContext* cx, Handle<GlobalObject*> obj);
@ -718,6 +720,7 @@ class Debugger : private mozilla::LinkedListElement<Debugger>
static bool getNewestFrame(JSContext* cx, unsigned argc, Value* vp);
static bool clearAllBreakpoints(JSContext* cx, unsigned argc, Value* vp);
static bool findScripts(JSContext* cx, unsigned argc, Value* vp);
static bool findSources(JSContext* cx, unsigned argc, Value* vp);
static bool findObjects(JSContext* cx, unsigned argc, Value* vp);
static bool findAllGlobals(JSContext* cx, unsigned argc, Value* vp);
static bool makeGlobalObjectReference(JSContext* cx, unsigned argc, Value* vp);

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

@ -309,8 +309,11 @@ js::MakeDefaultConstructor(JSContext* cx, HandleScript script, jsbytecode* pc, H
return nullptr;
uint32_t classStartOffset = GetSrcNoteOffset(classNote, 0);
uint32_t classEndOffset = GetSrcNoteOffset(classNote, 1);
ctorScript->setDefaultClassConstructorSpan(script->sourceObject(), classStartOffset,
classEndOffset);
unsigned column;
unsigned line = PCToLineNumber(script, pc, &column);
ctorScript->setDefaultClassConstructorSpan(script->sourceObject(),
classStartOffset, classEndOffset,
line, column);
return ctor;
}

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

@ -2683,17 +2683,6 @@ js::SetPrototype(JSContext* cx, HandleObject obj, HandleObject proto, JS::Object
if (obj->staticPrototypeIsImmutable())
return result.fail(JSMSG_CANT_SET_PROTO);
/*
* Disallow mutating the [[Prototype]] on ArrayBuffer objects, which
* due to their complicated delegate-object shenanigans can't easily
* have a mutable [[Prototype]].
*/
if (obj->is<ArrayBufferObject>()) {
JS_ReportErrorNumberASCII(cx, GetErrorMessage, nullptr, JSMSG_CANT_SET_PROTO_OF,
"incompatible ArrayBuffer");
return false;
}
/*
* Disallow mutating the [[Prototype]] on Typed Objects, per the spec.
*/

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

@ -1002,12 +1002,20 @@ JSScript::setSourceObject(JSObject* object)
}
void
JSScript::setDefaultClassConstructorSpan(JSObject* sourceObject, uint32_t start, uint32_t end)
JSScript::setDefaultClassConstructorSpan(JSObject* sourceObject, uint32_t start, uint32_t end,
unsigned line, unsigned column)
{
MOZ_ASSERT(isDefaultClassConstructor());
setSourceObject(sourceObject);
toStringStart_ = start;
toStringEnd_ = end;
sourceStart_ = start;
sourceEnd_ = end;
lineno_ = line;
column_ = column;
// Since this script has been changed to point into the user's source, we
// can clear its self-hosted flag, allowing Debugger to see it.
bitFields_.selfHosted_ = false;
}
js::ScriptSourceObject&

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

@ -1726,7 +1726,8 @@ class JSScript : public js::gc::TenuredCell
js::ScriptSource* scriptSource() const;
js::ScriptSource* maybeForwardedScriptSource() const;
void setDefaultClassConstructorSpan(JSObject* sourceObject, uint32_t start, uint32_t end);
void setDefaultClassConstructorSpan(JSObject* sourceObject, uint32_t start, uint32_t end,
unsigned line, unsigned column);
bool mutedErrors() const { return scriptSource()->mutedErrors(); }
const char* filename() const { return scriptSource()->filename(); }

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

@ -1,9 +1,19 @@
commit 9a8e518bedcf171d99eb1c00eef4beb1ecc20a4b
Merge: ae9ad90 da420c3
Author: Florian Loitsch <floitsch@google.com>
Date: Tue May 22 11:24:13 2018 +0200
commit 4e8b3b553c58d6afa78cc212a80c830812431132
Author: thomaslmiller <41446875+thomaslmiller@users.noreply.github.com>
Date: Thu Aug 2 01:32:25 2018 -0700
Merge pull request #68 from floitschG/static_size_assert
Use `static_assert` with newer compilers.
Add support for Windows on ARM and ARM64 (#76)
diff --git a/double-conversion/utils.h b/double-conversion/utils.h
index 28bb694..98a2a11 100644
--- a/double-conversion/utils.h
+++ b/double-conversion/utils.h
@@ -68,7 +68,7 @@ inline void abort_noreturn() { abort(); }
// disabled.)
// On Linux,x86 89255e-22 != Div_double(89255.0/1e22)
#if defined(_M_X64) || defined(__x86_64__) || \
- defined(__ARMEL__) || defined(__avr32__) || \
+ defined(__ARMEL__) || defined(__avr32__) || defined(_M_ARM) || defined(_M_ARM64) || \
defined(__hppa__) || defined(__ia64__) || \
defined(__mips__) || \
defined(__powerpc__) || defined(__ppc__) || defined(__ppc64__) || \

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

@ -68,7 +68,7 @@ inline void abort_noreturn() { MOZ_CRASH(); }
// disabled.)
// On Linux,x86 89255e-22 != Div_double(89255.0/1e22)
#if defined(_M_X64) || defined(__x86_64__) || \
defined(__ARMEL__) || defined(__avr32__) || \
defined(__ARMEL__) || defined(__avr32__) || defined(_M_ARM) || defined(_M_ARM64) || \
defined(__hppa__) || defined(__ia64__) || \
defined(__mips__) || \
defined(__powerpc__) || defined(__ppc__) || defined(__ppc64__) || \

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

@ -7,11 +7,13 @@
#ifndef mozilla_glue_WindowsDllServices_h
#define mozilla_glue_WindowsDllServices_h
#include "mozilla/Assertions.h"
#include "mozilla/Authenticode.h"
#include "mozilla/WindowsDllBlocklist.h"
#if defined(MOZILLA_INTERNAL_API)
#include "MainThreadUtils.h"
#include "mozilla/SystemGroup.h"
#include "nsISupportsImpl.h"
#include "nsString.h"
@ -42,7 +44,14 @@ public:
mAuthenticode = aAuthenticode;
}
// In debug builds, we override GetBinaryOrgName to add a Gecko-specific
// assertion. OTOH, we normally do not want people overriding this function,
// so we'll make it final in the release case, thus covering all bases.
#if defined(DEBUG)
UniquePtr<wchar_t[]> GetBinaryOrgName(const wchar_t* aFilePath) override
#else
UniquePtr<wchar_t[]> GetBinaryOrgName(const wchar_t* aFilePath) final
#endif // defined(DEBUG)
{
if (!mAuthenticode) {
return nullptr;
@ -98,6 +107,16 @@ public:
SystemGroup::Dispatch(TaskCategory::Other, runnable.forget());
}
#if defined(DEBUG)
UniquePtr<wchar_t[]> GetBinaryOrgName(const wchar_t* aFilePath) final
{
// This function may perform disk I/O, so we should never call it on the
// main thread.
MOZ_ASSERT(!NS_IsMainThread());
return detail::DllServicesBase::GetBinaryOrgName(aFilePath);
}
#endif // defined(DEBUG)
NS_INLINE_DECL_THREADSAFE_VIRTUAL_REFCOUNTING(DllServices)
protected:

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

@ -17,11 +17,6 @@ config = {
"log_name": "raptor",
"installer_path": INSTALLER_PATH,
"virtualenv_path": VENV_PATH,
"find_links": [
"http://pypi.pvt.build.mozilla.org/pub",
"http://pypi.pub.build.mozilla.org/pub",
],
"pip_index": False,
"exes": exes,
"title": os.uname()[1].lower().split('.')[0],
"default_actions": [

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

@ -13,11 +13,6 @@ config = {
"log_name": "raptor",
"installer_path": "installer.exe",
"virtualenv_path": VENV_PATH,
"find_links": [
"https://pypi.pvt.build.mozilla.org/pub",
"https://pypi.pub.build.mozilla.org/pub",
],
"pip_index": False,
"title": os.uname()[1].lower().split('.')[0],
"default_actions": [
"clobber",

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

@ -16,11 +16,6 @@ config = {
"log_name": "raptor",
"installer_path": "installer.exe",
"virtualenv_path": VENV_PATH,
"find_links": [
"http://pypi.pvt.build.mozilla.org/pub",
"http://pypi.pub.build.mozilla.org/pub",
],
"pip_index": False,
"title": os.uname()[1].lower().split('.')[0],
"default_actions": [
"clobber",

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

@ -10,11 +10,6 @@ config = {
"log_name": "raptor",
"installer_path": "installer.exe",
"virtualenv_path": VENV_PATH,
"pip_index": False,
"find_links": [
"http://pypi.pvt.build.mozilla.org/pub",
"http://pypi.pub.build.mozilla.org/pub",
],
"virtualenv_modules": ['pywin32', 'raptor', 'mozinstall'],
"exes": {
'python': PYTHON,

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

@ -10,11 +10,6 @@ config = {
"log_name": "raptor",
"installer_path": "installer.exe",
"virtualenv_path": VENV_PATH,
"pip_index": False,
"find_links": [
"http://pypi.pvt.build.mozilla.org/pub",
"http://pypi.pub.build.mozilla.org/pub",
],
"virtualenv_modules": ['pywin32', 'raptor', 'mozinstall'],
"exes": {
'python': PYTHON,

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

@ -0,0 +1,2 @@
[border-image-017.xht]
disabled: if (os == "linux"): https://bugzilla.mozilla.org/show_bug.cgi?id=1480278

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

@ -0,0 +1,2 @@
[border-image-019.xht]
disabled: if (os == 'linux'): https://bugzilla.mozilla.org/show_bug.cgi?id=1471792

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

@ -1,5 +1,6 @@
[DEFAULT]
support-files =
embedder.html
head.js
page.html
3rdParty.html
@ -22,6 +23,7 @@ support-files = server.sjs
[browser_existingCookiesForSubresources.js]
[browser_imageCache.js]
support-files = image.sjs
[browser_onModifyRequestNotificationForTrackingResources.js]
[browser_subResources.js]
support-files = subResources.sjs
[browser_script.js]

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше