зеркало из https://github.com/mozilla/gecko-dev.git
Merge autoland to m-c, a=merge
MozReview-Commit-ID: AdEwRLzhsHr
This commit is contained in:
Коммит
898435da51
|
@ -134,8 +134,6 @@ devtools/shared/*.js
|
|||
!devtools/shared/indentation.js
|
||||
!devtools/shared/loader-plugin-raw.jsm
|
||||
!devtools/shared/task.js
|
||||
devtools/shared/*.jsm
|
||||
!devtools/shared/Loader.jsm
|
||||
devtools/shared/apps/**
|
||||
devtools/shared/client/**
|
||||
devtools/shared/discovery/**
|
||||
|
@ -243,7 +241,6 @@ toolkit/components/reader/JSDOMParser.js
|
|||
# Uses preprocessing
|
||||
toolkit/content/widgets/wizard.xml
|
||||
toolkit/components/jsdownloads/src/DownloadIntegration.jsm
|
||||
toolkit/components/search/nsSearchService.js
|
||||
toolkit/components/url-classifier/**
|
||||
toolkit/components/urlformatter/nsURLFormatter.js
|
||||
toolkit/identity/FirefoxAccounts.jsm
|
||||
|
|
|
@ -1,46 +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";
|
||||
|
||||
|
||||
Cu.import("resource:///modules/TabGroupsMigrator.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "PlacesUtils",
|
||||
"resource://gre/modules/PlacesUtils.jsm");
|
||||
|
||||
const SUPPORT_URL = "https://support.mozilla.org/kb/tab-groups-removal";
|
||||
|
||||
function createLink() {
|
||||
let link = document.getElementById("sumolink");
|
||||
link.href = SUPPORT_URL;
|
||||
link.target = "_blank";
|
||||
}
|
||||
|
||||
let loadPromise = new Promise(resolve => {
|
||||
let loadHandler = e => {
|
||||
window.removeEventListener("DOMContentLoaded", loadHandler);
|
||||
createLink();
|
||||
resolve();
|
||||
};
|
||||
window.addEventListener("DOMContentLoaded", loadHandler, false);
|
||||
});
|
||||
|
||||
let tabGroupsBookmarkItemId;
|
||||
// If the session wasn't restored this run/session, this might be null.
|
||||
// Then we shouldn't show the button:
|
||||
if (TabGroupsMigrator.bookmarkedGroupsPromise) {
|
||||
let bookmarkPromise = TabGroupsMigrator.bookmarkedGroupsPromise.then(bm => {
|
||||
return PlacesUtils.promiseItemId(bm.guid);
|
||||
}).then(itemId => { tabGroupsBookmarkItemId = itemId });
|
||||
|
||||
Promise.all([bookmarkPromise, loadPromise]).then(function() {
|
||||
document.getElementById("show-migrated-bookmarks-button").style.removeProperty("display");
|
||||
});
|
||||
}
|
||||
|
||||
function showMigratedGroups() {
|
||||
let browserWin = getBrowserWindow();
|
||||
browserWin.PlacesCommandHook.showPlacesOrganizer(["BookmarksMenu", tabGroupsBookmarkItemId]);
|
||||
}
|
||||
|
|
@ -1,82 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
# 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/.
|
||||
-->
|
||||
<!DOCTYPE html [
|
||||
<!ENTITY % htmlDTD PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
|
||||
%htmlDTD;
|
||||
<!ENTITY % netErrorDTD SYSTEM "chrome://global/locale/netError.dtd">
|
||||
%netErrorDTD;
|
||||
<!ENTITY % globalDTD SYSTEM "chrome://global/locale/global.dtd">
|
||||
%globalDTD;
|
||||
<!ENTITY % restorepageDTD SYSTEM "chrome://browser/locale/aboutSessionRestore.dtd">
|
||||
%restorepageDTD;
|
||||
]>
|
||||
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
<head>
|
||||
<title>&tabgroupsmigration.tabtitle;</title>
|
||||
<link rel="stylesheet" href="chrome://global/skin/in-content/info-pages.css" type="text/css" media="all"/>
|
||||
<link rel="stylesheet" href="chrome://browser/skin/aboutSessionRestore.css" type="text/css" media="all"/>
|
||||
<link rel="icon" type="image/png" href="chrome://global/skin/icons/warning-16.png"/>
|
||||
|
||||
<script type="application/javascript;version=1.8" src="chrome://browser/content/aboutSessionRestore.js"/>
|
||||
<script type="application/javascript;version=1.8" src="chrome://browser/content/aboutTabGroupsMigration.js"/>
|
||||
</head>
|
||||
|
||||
<body dir="&locale.dir;">
|
||||
|
||||
<div class="container restore-chosen">
|
||||
|
||||
<div class="title">
|
||||
<h1 class="title-text">&tabgroupsmigration.pagetitle2;</h1>
|
||||
</div>
|
||||
<div class="description">
|
||||
<p id="mainDescription">&tabgroupsmigration.description2;<br /><a id="sumolink">&tabgroupsmigration.learnaboutaddons;</a></p>
|
||||
<button id="show-migrated-bookmarks-button" style="display:none" onclick="showMigratedGroups()">&tabgroupsmigration.bookmarkbutton;</button>
|
||||
|
||||
<p>&tabgroupsmigration.restoredescription;</p>
|
||||
</div>
|
||||
<div class="tree-container" available="true">
|
||||
<xul:tree id="tabList" seltype="single" hidecolumnpicker="true"
|
||||
onclick="onListClick(event);" onkeydown="onListKeyDown(event);"
|
||||
_window_label="&restorepage.windowLabel;">
|
||||
<xul:treecols>
|
||||
<xul:treecol cycler="true" id="restore" type="checkbox" label="&restorepage.restoreHeader;"/>
|
||||
<xul:splitter class="tree-splitter"/>
|
||||
<xul:treecol primary="true" id="title" label="&restorepage.listHeader;" flex="1"/>
|
||||
</xul:treecols>
|
||||
<xul:treechildren flex="1"/>
|
||||
</xul:tree>
|
||||
</div>
|
||||
<div class="button-container">
|
||||
#ifdef XP_UNIX
|
||||
<xul:button id="errorCancel"
|
||||
label="&restorepage.closeButton;"
|
||||
accesskey="&restorepage.close.access;"
|
||||
oncommand="startNewSession();"/>
|
||||
<xul:button class="primary"
|
||||
id="errorTryAgain"
|
||||
label="&restorepage.tryagainButton;"
|
||||
accesskey="&restorepage.restore.access;"
|
||||
oncommand="restoreSession();"/>
|
||||
#else
|
||||
<xul:button class="primary"
|
||||
id="errorTryAgain"
|
||||
label="&restorepage.tryagainButton;"
|
||||
accesskey="&restorepage.restore.access;"
|
||||
oncommand="restoreSession();"/>
|
||||
<xul:button id="errorCancel"
|
||||
label="&restorepage.closeButton;"
|
||||
accesskey="&restorepage.close.access;"
|
||||
oncommand="startNewSession();"/>
|
||||
#endif
|
||||
</div>
|
||||
<!-- holds the session data for when the tab is closed -->
|
||||
<input type="text" id="sessionData" style="display: none;"/>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -94,11 +94,9 @@ var gEMEHandler = {
|
|||
case "cdm-not-supported":
|
||||
// Not to pop up user-level notification because they cannot do anything
|
||||
// about it.
|
||||
case "error":
|
||||
// Fall through and do the same for unknown messages:
|
||||
return;
|
||||
default:
|
||||
let typeOfIssue = status == "error" ? "error" : "message ('" + status + "')";
|
||||
Cu.reportError("Unknown " + typeOfIssue + " dealing with EME key request: " + data);
|
||||
Cu.reportError(new Error("Unknown message ('" + status + "') dealing with EME key request: " + data));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -145,7 +143,6 @@ var gEMEHandler = {
|
|||
// We're playing EME content! Remove any "we can't play because..." messages.
|
||||
var box = gBrowser.getNotificationBox(browser);
|
||||
["drmContentDisabled",
|
||||
"drmContentCDMInsufficientVersion",
|
||||
"drmContentCDMInstalling"
|
||||
].forEach(function (value) {
|
||||
var notification = box.getNotificationWithValue(value);
|
||||
|
|
|
@ -68,8 +68,6 @@ browser.jar:
|
|||
content/browser/aboutTabCrashed.css (content/aboutTabCrashed.css)
|
||||
content/browser/aboutTabCrashed.js (content/aboutTabCrashed.js)
|
||||
content/browser/aboutTabCrashed.xhtml (content/aboutTabCrashed.xhtml)
|
||||
* content/browser/aboutTabGroupsMigration.xhtml (content/aboutTabGroupsMigration.xhtml)
|
||||
content/browser/aboutTabGroupsMigration.js (content/aboutTabGroupsMigration.js)
|
||||
* content/browser/browser.css (content/browser.css)
|
||||
content/browser/browser.js (content/browser.js)
|
||||
* content/browser/browser.xul (content/browser.xul)
|
||||
|
|
|
@ -62,7 +62,6 @@ XPCOMUtils.defineLazyServiceGetter(this, "AlertsService", "@mozilla.org/alerts-s
|
|||
["ShellService", "resource:///modules/ShellService.jsm"],
|
||||
["SimpleServiceDiscovery", "resource://gre/modules/SimpleServiceDiscovery.jsm"],
|
||||
["TabCrashHandler", "resource:///modules/ContentCrashHandlers.jsm"],
|
||||
["TabGroupsMigrator", "resource:///modules/TabGroupsMigrator.jsm"],
|
||||
["Task", "resource://gre/modules/Task.jsm"],
|
||||
["UITour", "resource:///modules/UITour.jsm"],
|
||||
["URLBarZoom", "resource:///modules/URLBarZoom.jsm"],
|
||||
|
@ -655,9 +654,6 @@ BrowserGlue.prototype = {
|
|||
try {
|
||||
currentUIVersion = Services.prefs.getIntPref("browser.migration.version");
|
||||
} catch (ex) {}
|
||||
if (currentUIVersion < 35) {
|
||||
this._maybeMigrateTabGroups();
|
||||
}
|
||||
Services.ww.openWindow(null, "chrome://browser/content/safeMode.xul",
|
||||
"_blank", "chrome,centerscreen,modal,resizable=no", null);
|
||||
}
|
||||
|
@ -1257,14 +1253,6 @@ BrowserGlue.prototype = {
|
|||
}
|
||||
},
|
||||
|
||||
_maybeMigrateTabGroups() {
|
||||
let migrationObserver = (stateAsSupportsString, topic) => {
|
||||
Services.obs.removeObserver(migrationObserver, "sessionstore-state-read");
|
||||
TabGroupsMigrator.migrate(stateAsSupportsString);
|
||||
};
|
||||
Services.obs.addObserver(migrationObserver, "sessionstore-state-read", false);
|
||||
},
|
||||
|
||||
_onQuitRequest: function BG__onQuitRequest(aCancelQuit, aQuitType) {
|
||||
// If user has already dismissed quit request, then do nothing
|
||||
if ((aCancelQuit instanceof Ci.nsISupportsPRBool) && aCancelQuit.data)
|
||||
|
@ -1785,7 +1773,7 @@ BrowserGlue.prototype = {
|
|||
},
|
||||
|
||||
_migrateUI: function BG__migrateUI() {
|
||||
const UI_VERSION = 41;
|
||||
const UI_VERSION = 42;
|
||||
const BROWSER_DOCURL = "chrome://browser/content/browser.xul";
|
||||
|
||||
let currentUIVersion;
|
||||
|
@ -2069,10 +2057,7 @@ BrowserGlue.prototype = {
|
|||
this._notifyNotificationsUpgrade().catch(Cu.reportError);
|
||||
}
|
||||
|
||||
// Only do this outside of safe mode, because in safe mode we do this earlier.
|
||||
if (currentUIVersion < 35 && !Services.appinfo.inSafeMode) {
|
||||
this._maybeMigrateTabGroups();
|
||||
}
|
||||
// version 35 migrated tab groups data.
|
||||
|
||||
if (currentUIVersion < 36) {
|
||||
xulStore.removeValue("chrome://passwordmgr/content/passwordManager.xul",
|
||||
|
@ -2116,6 +2101,12 @@ BrowserGlue.prototype = {
|
|||
Preferences.resetBranch("loop.");
|
||||
}
|
||||
|
||||
if (currentUIVersion < 42) {
|
||||
let backupFile = Services.dirsvc.get("ProfD", Ci.nsIFile);
|
||||
backupFile.append("tabgroups-session-backup.json");
|
||||
OS.File.remove(backupFile.path, {ignoreAbsent: true}).catch(ex => Cu.reportError(ex));
|
||||
}
|
||||
|
||||
// Update the migration version.
|
||||
Services.prefs.setIntPref("browser.migration.version", UI_VERSION);
|
||||
},
|
||||
|
|
|
@ -70,7 +70,7 @@ function initTreeView() {
|
|||
gTreeData = [];
|
||||
gStateObject.windows.forEach(function(aWinData, aIx) {
|
||||
var winState = {
|
||||
label: aWinData.tabGroupsMigrationTitle || winLabel.replace("%S", (aIx + 1)),
|
||||
label: winLabel.replace("%S", (aIx + 1)),
|
||||
open: true,
|
||||
checked: true,
|
||||
ix: aIx
|
||||
|
|
|
@ -49,12 +49,3 @@ their language.
|
|||
|
||||
<!ENTITY welcomeback2.link.pageInfo2 "learn more about what you can do.">
|
||||
|
||||
<!-- LOCALIZATION NOTE: The following 'tabgroupsmigration' strings are for
|
||||
the tab groups (panorama) migration page, not about:sessionrestore -->
|
||||
<!ENTITY tabgroupsmigration.tabtitle "Migrate your other Tab Groups">
|
||||
<!ENTITY tabgroupsmigration.pagetitle2 "We’ve removed Tab Groups, but saved your tabs">
|
||||
<!ENTITY tabgroupsmigration.learnaboutaddons "Learn about Tab Groups replacement add-ons.">
|
||||
<!ENTITY tabgroupsmigration.description2 "&brandShortName; has bookmarked all your groups so you haven’t lost anything.">
|
||||
<!ENTITY tabgroupsmigration.bookmarkbutton "Show Bookmarked Tab Groups">
|
||||
<!ENTITY tabgroupsmigration.restoredescription "You can also choose to restore some or all background groups into windows now:">
|
||||
|
||||
|
|
|
@ -600,9 +600,6 @@ emeNotifications.drmContentDisabled.button.accesskey = E
|
|||
# LOCALIZATION NOTE(emeNotifications.drmContentDisabled.learnMoreLabel): NB: inserted via innerHTML, so please don't use <, > or & in this string.
|
||||
emeNotifications.drmContentDisabled.learnMoreLabel = Learn More
|
||||
|
||||
# LOCALIZATION NOTE(emeNotifications.drmContentCDMInsufficientVersion.message): NB: inserted via innerHTML, so please don't use <, > or & in this string. %S is brandShortName
|
||||
emeNotifications.drmContentCDMInsufficientVersion.message = %S is installing updates needed to play the audio or video on this page. Please try again later.
|
||||
|
||||
# LOCALIZATION NOTE(emeNotifications.drmContentCDMInstalling.message): NB: inserted via innerHTML, so please don't use <, > or & in this string. %S is brandShortName
|
||||
emeNotifications.drmContentCDMInstalling.message = %S is installing components needed to play the audio or video on this page. Please try again later.
|
||||
|
||||
|
@ -713,11 +710,6 @@ certErrorDetailsHSTS.label = HTTP Strict Transport Security: %S
|
|||
certErrorDetailsKeyPinning.label = HTTP Public Key Pinning: %S
|
||||
certErrorDetailsCertChain.label = Certificate chain:
|
||||
|
||||
# LOCALIZATION NOTE (tabgroups.migration.anonGroup):
|
||||
# %S is the group number/ID
|
||||
tabgroups.migration.anonGroup = Group %S
|
||||
tabgroups.migration.tabGroupBookmarkFolderName = Bookmarked Tab Groups
|
||||
|
||||
# LOCALIZATION NOTE (pendingCrashReports2.label): Semi-colon list of plural forms
|
||||
# See: http://developer.mozilla.org/en/docs/Localization_and_Plurals
|
||||
# #1 is the number of pending crash reports
|
||||
|
|
|
@ -1,297 +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";
|
||||
|
||||
this.EXPORTED_SYMBOLS = ["TabGroupsMigrator"];
|
||||
|
||||
const { classes: Cc, interfaces: Ci, results: Cr, utils: Cu } = Components;
|
||||
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "Services", "resource://gre/modules/Services.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "PlacesUtils", "resource://gre/modules/PlacesUtils.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "Task", "resource://gre/modules/Task.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "OS", "resource://gre/modules/osfile.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "AsyncShutdown", "resource://gre/modules/AsyncShutdown.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "gBrowserBundle", function() {
|
||||
return Services.strings.createBundle('chrome://browser/locale/browser.properties');
|
||||
});
|
||||
|
||||
const RECOVERY_URL = "chrome://browser/content/aboutTabGroupsMigration.xhtml";
|
||||
|
||||
|
||||
this.TabGroupsMigrator = {
|
||||
bookmarkedGroupsPromise: null,
|
||||
|
||||
/**
|
||||
* If this state contains tab groups, migrate the user's data. This means:
|
||||
* - make a backup of the user's data.
|
||||
* - create bookmarks of all the user's tab groups in a single folder
|
||||
* - append a tab to the active window that lets the user restore background
|
||||
* groups.
|
||||
* - remove all the tabs hidden through tab groups from the state data.
|
||||
*/
|
||||
migrate(stateAsSupportsString) {
|
||||
stateAsSupportsString.QueryInterface(Ci.nsISupportsString);
|
||||
let stateStr = stateAsSupportsString.data;
|
||||
// If this is the very first startup of this profile, this is going to be empty:
|
||||
if (!stateStr) {
|
||||
return;
|
||||
}
|
||||
let state;
|
||||
try {
|
||||
state = JSON.parse(stateStr);
|
||||
} catch (ex) {
|
||||
Cu.reportError("Failed to parse sessionstore state JSON to migrate tab groups: " + ex);
|
||||
return; // can't recover from invalid JSON
|
||||
}
|
||||
|
||||
let groupData = this._gatherGroupData(state);
|
||||
|
||||
// This strips out the hidden tab groups and puts them in a different object.
|
||||
// It also removes all tabview metadata.
|
||||
// We always do this, and always reassign the new state back into the
|
||||
// nsISupportsString for use by sessionstore, in order to tidy up the state
|
||||
// object.
|
||||
let hiddenTabState = this._removeHiddenTabGroupsFromState(state, groupData);
|
||||
|
||||
// However, we will only create a backup file, bookmarks and a new tab to
|
||||
// restore hidden tabs if tabs were actually removed from |state| by
|
||||
// _removeHiddenTabGroupsFromState.
|
||||
if (hiddenTabState.windows.length) {
|
||||
// We create the backup with the original string, from before all our
|
||||
// changes:
|
||||
this._createBackup(stateStr);
|
||||
|
||||
this._createBackgroundTabGroupRestorationPage(state, hiddenTabState);
|
||||
|
||||
// Bookmark creation is async. We need to return synchronously,
|
||||
// so we purposefully don't wait for this to be finished here. We do
|
||||
// store the promise it creates and use that in the session restore page
|
||||
// to be able to link to the bookmarks folder...
|
||||
let bookmarksFinishedPromise = this._bookmarkAllGroupsFromState(groupData);
|
||||
// ... and we make sure we finish before shutting down:
|
||||
AsyncShutdown.profileBeforeChange.addBlocker(
|
||||
"Tab groups migration bookmarks",
|
||||
bookmarksFinishedPromise
|
||||
);
|
||||
}
|
||||
|
||||
// We always write this back to ensure that any spurious tab groups data is
|
||||
// removed:
|
||||
stateAsSupportsString.data = JSON.stringify(state);
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns a Map from window state objects to per-window group data.
|
||||
* Specifically, the values in the Map are themselves Maps from group IDs to
|
||||
* JS Objects which have these properties:
|
||||
* - tabGroupsMigrationTitle: the title of the group (or empty string)
|
||||
* - tabs: an array of the tabs objects in this group.
|
||||
*/
|
||||
_gatherGroupData(state) {
|
||||
let allGroupData = new Map();
|
||||
let globalAnonGroupID = 0;
|
||||
for (let win of state.windows) {
|
||||
if (win.extData && win.extData["tabview-group"]) {
|
||||
let groupInfo = {};
|
||||
try {
|
||||
groupInfo = JSON.parse(win.extData["tabview-group"]);
|
||||
} catch (ex) {
|
||||
// This is annoying, but we'll try to deal with this.
|
||||
}
|
||||
|
||||
let windowGroupData = new Map();
|
||||
let activeGroupID = null;
|
||||
let tabsWithoutGroup = [];
|
||||
for (let tab of win.tabs) {
|
||||
let group;
|
||||
// Get a string group ID:
|
||||
try {
|
||||
let tabViewData = tab.extData && tab.extData["tabview-tab"] &&
|
||||
JSON.parse(tab.extData["tabview-tab"]);
|
||||
if (tabViewData && ("groupID" in tabViewData)) {
|
||||
group = tabViewData.groupID + "";
|
||||
}
|
||||
} catch (ex) {
|
||||
// Ignore errors reading group info, treat as active group
|
||||
}
|
||||
if (!group) {
|
||||
// We didn't find group info. If we already have an active group,
|
||||
// pretend this is part of that group:
|
||||
if (activeGroupID) {
|
||||
group = activeGroupID;
|
||||
} else {
|
||||
if (!tabsWithoutGroup) {
|
||||
Cu.reportError("ERROR: the list of tabs without groups was " +
|
||||
"nulled out, but there's no active group ID? " +
|
||||
"This should never happen!");
|
||||
tabsWithoutGroup = [];
|
||||
}
|
||||
// Otherwise, add to the list of tabs with no group and move to
|
||||
// the next tab immediately. We'll add all these tabs at the
|
||||
// beginning of the active group as soon as we find a tab in it,
|
||||
// so as to preserve their order.
|
||||
tabsWithoutGroup.push(tab);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
let groupData = windowGroupData.get(group);
|
||||
if (!groupData) {
|
||||
let title = (groupInfo[group] && groupInfo[group].title) || "";
|
||||
groupData = {
|
||||
tabs: [],
|
||||
tabGroupsMigrationTitle: title,
|
||||
};
|
||||
if (!title) {
|
||||
groupData.anonGroupID = ++globalAnonGroupID;
|
||||
groupData.tabGroupsMigrationTitle =
|
||||
gBrowserBundle.formatStringFromName("tabgroups.migration.anonGroup",
|
||||
[groupData.anonGroupID], 1);
|
||||
}
|
||||
// If this is the active group, set the active group ID and add
|
||||
// all the already-known tabs (that didn't list a group ID), if any.
|
||||
if (!activeGroupID && !tab.hidden) {
|
||||
activeGroupID = group;
|
||||
groupData.tabs = tabsWithoutGroup;
|
||||
tabsWithoutGroup = null;
|
||||
}
|
||||
windowGroupData.set(group, groupData);
|
||||
}
|
||||
groupData.tabs.push(tab);
|
||||
}
|
||||
|
||||
// If we found tabs but no active group, assume there's just 1 group:
|
||||
if (tabsWithoutGroup && tabsWithoutGroup.length) {
|
||||
windowGroupData.set("active group", {
|
||||
tabs: tabsWithoutGroup,
|
||||
anonGroupID: ++globalAnonGroupID,
|
||||
});
|
||||
}
|
||||
|
||||
allGroupData.set(win, windowGroupData);
|
||||
}
|
||||
}
|
||||
return allGroupData;
|
||||
},
|
||||
|
||||
_createBackup(stateStr) {
|
||||
let dest = Services.dirsvc.get("ProfD", Ci.nsIFile);
|
||||
dest.append("tabgroups-session-backup.json");
|
||||
let promise = OS.File.writeAtomic(dest.path, stateStr, {encoding: "utf-8"});
|
||||
AsyncShutdown.webWorkersShutdown.addBlocker("TabGroupsMigrator", promise);
|
||||
return promise;
|
||||
},
|
||||
|
||||
_groupSorter(a, b) {
|
||||
if (!a.anonGroupID) {
|
||||
return -1;
|
||||
}
|
||||
if (!b.anonGroupID) {
|
||||
return 1;
|
||||
}
|
||||
return a.anonGroupID - b.anonGroupID;
|
||||
},
|
||||
|
||||
_bookmarkAllGroupsFromState: Task.async(function*(groupData) {
|
||||
// First create a folder in which to put all these bookmarks:
|
||||
this.bookmarkedGroupsPromise = PlacesUtils.bookmarks.insert({
|
||||
parentGuid: PlacesUtils.bookmarks.menuGuid,
|
||||
type: PlacesUtils.bookmarks.TYPE_FOLDER,
|
||||
index: 0,
|
||||
title: gBrowserBundle.GetStringFromName("tabgroups.migration.tabGroupBookmarkFolderName"),
|
||||
}).catch(Cu.reportError);
|
||||
let tabgroupsFolder = yield this.bookmarkedGroupsPromise;
|
||||
|
||||
for (let [, windowGroupMap] of groupData) {
|
||||
let windowGroups = [... windowGroupMap.values()].sort(this._groupSorter);
|
||||
for (let group of windowGroups) {
|
||||
let groupFolder = yield PlacesUtils.bookmarks.insert({
|
||||
parentGuid: tabgroupsFolder.guid,
|
||||
type: PlacesUtils.bookmarks.TYPE_FOLDER,
|
||||
title: group.tabGroupsMigrationTitle
|
||||
}).catch(Cu.reportError);
|
||||
|
||||
for (let tab of group.tabs) {
|
||||
let entry = tab.entries[tab.index - 1];
|
||||
yield PlacesUtils.bookmarks.insert({
|
||||
parentGuid: groupFolder.guid,
|
||||
title: tab.title || entry.title,
|
||||
url: entry.url,
|
||||
}).catch(Cu.reportError);
|
||||
}
|
||||
}
|
||||
}
|
||||
}),
|
||||
|
||||
_removeHiddenTabGroupsFromState(state, groups) {
|
||||
let stateToReturn = {windows: []};
|
||||
for (let win of state.windows) {
|
||||
let groupInfoForWindow = groups.get(win);
|
||||
let hiddenGroupIDs = new Set();
|
||||
for (let i = win.tabs.length - 1; i >= 0; i--) {
|
||||
let tab = win.tabs[i];
|
||||
// Determine whether the tab is grouped:
|
||||
let tabGroupInfo = null;
|
||||
try {
|
||||
tabGroupInfo = tab.extData && tab.extData["tabview-tab"] &&
|
||||
JSON.parse(tab.extData["tabview-tab"]);
|
||||
} catch (ex) {}
|
||||
|
||||
// Then remove this data.
|
||||
if (tab.extData) {
|
||||
delete tab.extData["tabview-tab"];
|
||||
if (Object.keys(tab.extData).length == 0) {
|
||||
delete tab.extData;
|
||||
}
|
||||
}
|
||||
|
||||
// If the tab was grouped and hidden, remove it:
|
||||
if (tabGroupInfo && tab.hidden) {
|
||||
hiddenGroupIDs.add(tabGroupInfo.groupID);
|
||||
win.tabs.splice(i, 1);
|
||||
// Make sure we unhide it, or it won't get restored correctly
|
||||
tab.hidden = false;
|
||||
}
|
||||
}
|
||||
|
||||
// We then convert any hidden groups into windows for the state object
|
||||
// we show in about:tabgroupsdata
|
||||
if (groupInfoForWindow) {
|
||||
let windowsToReturn = [];
|
||||
for (let groupID of hiddenGroupIDs) {
|
||||
let group = groupInfoForWindow.get("" + groupID);
|
||||
if (group) {
|
||||
windowsToReturn.push(group);
|
||||
}
|
||||
}
|
||||
windowsToReturn.sort(this._groupSorter);
|
||||
stateToReturn.windows = stateToReturn.windows.concat(windowsToReturn);
|
||||
}
|
||||
|
||||
// Finally we remove tab groups data from the window:
|
||||
if (win.extData) {
|
||||
delete win.extData["tabview-group"];
|
||||
delete win.extData["tabview-groups"];
|
||||
delete win.extData["tabview-ui"];
|
||||
delete win.extData["tabview-visibility"];
|
||||
if (Object.keys(win.extData).length == 0) {
|
||||
delete win.extData;
|
||||
}
|
||||
}
|
||||
}
|
||||
return stateToReturn;
|
||||
},
|
||||
|
||||
_createBackgroundTabGroupRestorationPage(state, backgroundData) {
|
||||
let win = state.windows[(state.selectedWindow || 1) - 1];
|
||||
let formdata = {id: {sessionData: JSON.stringify(backgroundData)}, url: RECOVERY_URL};
|
||||
let newTab = { entries: [{url: RECOVERY_URL}], formdata, index: 1 };
|
||||
// Add tab and mark it as selected:
|
||||
win.selected = win.tabs.push(newTab);
|
||||
},
|
||||
};
|
||||
|
|
@ -44,7 +44,6 @@ EXTRA_JS_MODULES += [
|
|||
'SitePermissions.jsm',
|
||||
'Social.jsm',
|
||||
'SocialService.jsm',
|
||||
'TabGroupsMigrator.jsm',
|
||||
'TransientPrefs.jsm',
|
||||
'URLBarZoom.jsm',
|
||||
'webrtcUI.jsm',
|
||||
|
|
|
@ -1,406 +0,0 @@
|
|||
"use strict";
|
||||
|
||||
Components.utils.import("resource://gre/modules/Services.jsm");
|
||||
Components.utils.import("resource://gre/modules/PlacesUtils.jsm");
|
||||
Components.utils.import("resource://gre/modules/osfile.jsm");
|
||||
Components.utils.import("resource:///modules/TabGroupsMigrator.jsm");
|
||||
|
||||
var gProfD = do_get_profile();
|
||||
|
||||
const TEST_STATES = {
|
||||
TWO_GROUPS: {
|
||||
selectedWindow: 1,
|
||||
windows: [
|
||||
{
|
||||
tabs: [
|
||||
{
|
||||
entries: [{
|
||||
url: "about:robots",
|
||||
title: "Robots 1",
|
||||
}],
|
||||
index: 1,
|
||||
hidden: false,
|
||||
extData: {
|
||||
"tabview-tab": "{\"groupID\":2,\"active\":true}",
|
||||
},
|
||||
},
|
||||
{
|
||||
entries: [{
|
||||
url: "about:robots",
|
||||
title: "Robots 2",
|
||||
}],
|
||||
index: 1,
|
||||
hidden: false,
|
||||
extData: {
|
||||
"tabview-tab": "{\"groupID\":2}",
|
||||
},
|
||||
},
|
||||
{
|
||||
entries: [{
|
||||
url: "about:robots",
|
||||
title: "Robots 3",
|
||||
}],
|
||||
index: 1,
|
||||
hidden: true,
|
||||
extData: {
|
||||
"tabview-tab": "{\"groupID\":13}",
|
||||
},
|
||||
}
|
||||
],
|
||||
extData: {
|
||||
"tabview-group": "{\"2\":{},\"13\":{\"title\":\"Foopy\"}}",
|
||||
"tabview-groups": "{\"nextID\":20,\"activeGroupId\":2,\"totalNumber\":2}",
|
||||
"tabview-visibility": "false"
|
||||
},
|
||||
},
|
||||
]
|
||||
},
|
||||
NAMED_ACTIVE_GROUP: {
|
||||
selectedWindow: 1,
|
||||
windows: [
|
||||
{
|
||||
tabs: [
|
||||
{
|
||||
entries: [{
|
||||
url: "about:mozilla",
|
||||
title: "Mozilla 1",
|
||||
}],
|
||||
index: 1,
|
||||
hidden: false,
|
||||
extData: {
|
||||
"tabview-tab": "{\"groupID\":2,\"active\":true}",
|
||||
},
|
||||
},
|
||||
],
|
||||
extData: {
|
||||
"tabview-group": "{\"2\":{\"title\":\"Foopy\"}}",
|
||||
"tabview-groups": "{\"nextID\":20,\"activeGroupId\":2,\"totalNumber\":1}",
|
||||
"tabview-visibility": "false"
|
||||
},
|
||||
}
|
||||
],
|
||||
},
|
||||
TAB_WITHOUT_GROUP: {
|
||||
selectedWindow: 1,
|
||||
windows: [
|
||||
{
|
||||
tabs: [
|
||||
{
|
||||
entries: [{
|
||||
url: "about:robots",
|
||||
title: "Robots 1",
|
||||
}],
|
||||
index: 1,
|
||||
hidden: false,
|
||||
},
|
||||
{
|
||||
entries: [{
|
||||
url: "about:robots",
|
||||
title: "Robots 2",
|
||||
}],
|
||||
index: 1,
|
||||
hidden: false,
|
||||
extData: {
|
||||
"tabview-tab": "{\"groupID\":2}",
|
||||
},
|
||||
},
|
||||
{
|
||||
entries: [{
|
||||
url: "about:robots",
|
||||
title: "Robots 3",
|
||||
}],
|
||||
index: 1,
|
||||
hidden: true,
|
||||
extData: {
|
||||
"tabview-tab": "{\"groupID\":1}",
|
||||
},
|
||||
}
|
||||
],
|
||||
extData: {
|
||||
"tabview-group": "{\"2\":{}, \"1\": {}}",
|
||||
"tabview-groups": "{\"nextID\":20,\"activeGroupId\":2,\"totalNumber\":2}",
|
||||
"tabview-visibility": "false"
|
||||
},
|
||||
}
|
||||
],
|
||||
},
|
||||
ONLY_UNGROUPED_TABS: {
|
||||
selectedWindow: 1,
|
||||
windows: [
|
||||
{
|
||||
tabs: [
|
||||
{
|
||||
entries: [{
|
||||
url: "about:robots",
|
||||
title: "Robots 1",
|
||||
}],
|
||||
index: 1,
|
||||
hidden: false,
|
||||
},
|
||||
{
|
||||
entries: [{
|
||||
url: "about:robots",
|
||||
title: "Robots 2",
|
||||
}],
|
||||
index: 1,
|
||||
hidden: false,
|
||||
extData: {
|
||||
"tabview-tab": "{}",
|
||||
},
|
||||
},
|
||||
{
|
||||
entries: [{
|
||||
url: "about:robots",
|
||||
title: "Robots 3",
|
||||
}],
|
||||
index: 1,
|
||||
hidden: true,
|
||||
extData: {
|
||||
},
|
||||
}
|
||||
],
|
||||
extData: {
|
||||
"tabview-group": "{\"2\":{}}",
|
||||
},
|
||||
}
|
||||
],
|
||||
},
|
||||
SORTING_NAMING_RESTORE_PAGE: {
|
||||
windows: [
|
||||
{
|
||||
tabs: [
|
||||
{
|
||||
entries: [{
|
||||
url: "about:robots",
|
||||
title: "Robots 1",
|
||||
}],
|
||||
index: 1,
|
||||
hidden: false,
|
||||
extData: {
|
||||
"tabview-tab": "{\"groupID\":2,\"active\":true}",
|
||||
},
|
||||
},
|
||||
{
|
||||
entries: [{
|
||||
url: "about:robots",
|
||||
title: "Robots 2",
|
||||
}],
|
||||
index: 1,
|
||||
hidden: false,
|
||||
extData: {
|
||||
"tabview-tab": "{\"groupID\":2}",
|
||||
},
|
||||
},
|
||||
{
|
||||
entries: [{
|
||||
url: "about:robots",
|
||||
title: "Robots 3",
|
||||
}],
|
||||
index: 1,
|
||||
hidden: true,
|
||||
extData: {
|
||||
"tabview-tab": "{\"groupID\":13}",
|
||||
},
|
||||
},
|
||||
{
|
||||
entries: [{
|
||||
url: "about:robots",
|
||||
title: "Robots 4",
|
||||
}],
|
||||
index: 1,
|
||||
hidden: true,
|
||||
extData: {
|
||||
"tabview-tab": "{\"groupID\":15}",
|
||||
},
|
||||
},
|
||||
{
|
||||
entries: [{
|
||||
url: "about:robots",
|
||||
title: "Robots 5",
|
||||
}],
|
||||
index: 1,
|
||||
hidden: true,
|
||||
extData: {
|
||||
"tabview-tab": "{\"groupID\":16}",
|
||||
},
|
||||
},
|
||||
{
|
||||
entries: [{
|
||||
url: "about:robots",
|
||||
title: "Robots 6",
|
||||
}],
|
||||
index: 1,
|
||||
hidden: true,
|
||||
extData: {
|
||||
"tabview-tab": "{\"groupID\":17}",
|
||||
},
|
||||
}
|
||||
],
|
||||
extData: {
|
||||
"tabview-group": "{\"2\":{},\"13\":{\"title\":\"Foopy\"}, \"15\":{\"title\":\"Barry\"}, \"16\":{}, \"17\":{}}",
|
||||
"tabview-groups": "{\"nextID\":20,\"activeGroupId\":2,\"totalNumber\":5}",
|
||||
"tabview-visibility": "false"
|
||||
},
|
||||
},
|
||||
]
|
||||
},
|
||||
};
|
||||
|
||||
add_task(function* gatherGroupDataTest() {
|
||||
let groupInfo = TabGroupsMigrator._gatherGroupData(TEST_STATES.TWO_GROUPS);
|
||||
Assert.equal(groupInfo.size, 1, "Information about 1 window");
|
||||
let singleWinGroups = [... groupInfo.values()][0];
|
||||
Assert.equal(singleWinGroups.size, 2, "2 groups");
|
||||
let group2 = singleWinGroups.get("2");
|
||||
Assert.ok(!!group2, "group 2 should exist");
|
||||
Assert.equal(group2.tabs.length, 2, "2 tabs in group 2");
|
||||
// Note that this has groupID 2 in the internal representation of tab groups,
|
||||
// but because it was the first group we encountered when migrating, it was
|
||||
// labeled "group 1" for the user
|
||||
Assert.equal(group2.tabGroupsMigrationTitle, "Group 1", "We assign a numeric title to untitled groups");
|
||||
Assert.equal(group2.anonGroupID, "1", "We mark an untitled group with an anonymous id");
|
||||
let group13 = singleWinGroups.get("13");
|
||||
Assert.ok(!!group13, "group 13 should exist");
|
||||
Assert.equal(group13.tabs.length, 1, "1 tabs in group 13");
|
||||
Assert.equal(group13.tabGroupsMigrationTitle, "Foopy", "Group with title has correct title");
|
||||
Assert.ok(!("anonGroupID" in group13), "We don't mark a titled group with an anonymous id");
|
||||
});
|
||||
|
||||
add_task(function* bookmarkingTest() {
|
||||
let stateClone = JSON.parse(JSON.stringify(TEST_STATES.TWO_GROUPS));
|
||||
let groupInfo = TabGroupsMigrator._gatherGroupData(stateClone);
|
||||
let removedGroups = TabGroupsMigrator._removeHiddenTabGroupsFromState(stateClone, groupInfo);
|
||||
yield TabGroupsMigrator._bookmarkAllGroupsFromState(groupInfo);
|
||||
let bmCounter = 0;
|
||||
let bmParents = {};
|
||||
let bookmarks = [];
|
||||
let onResult = bm => {
|
||||
bmCounter++;
|
||||
bmParents[bm.parentGuid] = (bmParents[bm.parentGuid] || 0) + 1;
|
||||
Assert.ok(bm.title.startsWith("Robots "), "Bookmark title(" + bm.title + ") should start with 'Robots '");
|
||||
};
|
||||
yield PlacesUtils.bookmarks.fetch({url: "about:robots"}, onResult);
|
||||
Assert.equal(bmCounter, 3, "Should have seen 3 bookmarks");
|
||||
Assert.equal(Object.keys(bmParents).length, 2, "Should be in 2 folders");
|
||||
|
||||
let ancestorGuid;
|
||||
let parents = Object.keys(bmParents).map(guid => {
|
||||
PlacesUtils.bookmarks.fetch({guid}, bm => {
|
||||
ancestorGuid = bm.parentGuid;
|
||||
if (bmParents[bm.guid] == 1) {
|
||||
Assert.equal(bm.title, "Foopy", "Group with 1 kid has right title");
|
||||
} else {
|
||||
Assert.ok(bm.title.includes("1"), "Group with more kids should have anon ID in title (" + bm.title + ")");
|
||||
}
|
||||
});
|
||||
});
|
||||
yield Promise.all(parents);
|
||||
|
||||
yield PlacesUtils.bookmarks.fetch({guid: ancestorGuid}, bm => {
|
||||
Assert.equal(bm.title,
|
||||
gBrowserBundle.GetStringFromName("tabgroups.migration.tabGroupBookmarkFolderName"),
|
||||
"Should have the right title");
|
||||
});
|
||||
});
|
||||
|
||||
add_task(function* bookmarkNamedActiveGroup() {
|
||||
let stateClone = JSON.parse(JSON.stringify(TEST_STATES.NAMED_ACTIVE_GROUP));
|
||||
let groupInfo = TabGroupsMigrator._gatherGroupData(stateClone);
|
||||
let removedGroups = TabGroupsMigrator._removeHiddenTabGroupsFromState(stateClone, groupInfo);
|
||||
yield TabGroupsMigrator._bookmarkAllGroupsFromState(groupInfo);
|
||||
let bmParents = {};
|
||||
let bmCounter = 0;
|
||||
let onResult = bm => {
|
||||
bmCounter++;
|
||||
bmParents[bm.parentGuid] = (bmParents[bm.parentGuid] || 0) + 1;
|
||||
Assert.ok(bm.title.startsWith("Mozilla "), "Bookmark title (" + bm.title + ") should start with 'Mozilla '");
|
||||
};
|
||||
yield PlacesUtils.bookmarks.fetch({url: "about:mozilla"}, onResult);
|
||||
Assert.equal(bmCounter, 1, "Should have seen 1 bookmarks");
|
||||
let parentPromise = PlacesUtils.bookmarks.fetch({guid: Object.keys(bmParents)[0]}, bm => {
|
||||
Assert.equal(bm.title, "Foopy", "Group with 1 kid has right title");
|
||||
});
|
||||
yield parentPromise;
|
||||
});
|
||||
|
||||
add_task(function* removingTabGroupsFromJSONTest() {
|
||||
let stateClone = JSON.parse(JSON.stringify(TEST_STATES.TWO_GROUPS));
|
||||
let groupInfo = TabGroupsMigrator._gatherGroupData(stateClone);
|
||||
let removedGroups = TabGroupsMigrator._removeHiddenTabGroupsFromState(stateClone, groupInfo);
|
||||
Assert.equal(removedGroups.windows.length, 1, "Removed 1 group which looks like a window in removed data");
|
||||
Assert.equal(removedGroups.windows[0].tabs.length, 1, "Removed group had 1 tab");
|
||||
Assert.ok(!stateClone.windows[0].extData, "extData removed from window");
|
||||
stateClone.windows[0].tabs.forEach(tab => {
|
||||
Assert.ok(!tab.extData, "extData removed from tab");
|
||||
});
|
||||
Assert.ok(stateClone.windows[0].tabs.length, 2, "Only 2 tabs remain in the window");
|
||||
});
|
||||
|
||||
add_task(function* backupTest() {
|
||||
yield TabGroupsMigrator._createBackup(JSON.stringify(TEST_STATES.TWO_GROUPS));
|
||||
let f = Services.dirsvc.get("ProfD", Components.interfaces.nsIFile);
|
||||
f.append("tabgroups-session-backup.json");
|
||||
ok(f.exists(), "Should have created the file");
|
||||
|
||||
let txt = (new TextDecoder()).decode(yield OS.File.read(f.path));
|
||||
Assert.deepEqual(JSON.parse(txt), TEST_STATES.TWO_GROUPS, "Should have written the expected state.");
|
||||
|
||||
f.remove(false);
|
||||
});
|
||||
|
||||
add_task(function* migrationPageDataTest() {
|
||||
let stateClone = JSON.parse(JSON.stringify(TEST_STATES.TWO_GROUPS));
|
||||
let groupInfo = TabGroupsMigrator._gatherGroupData(stateClone);
|
||||
let removedGroups = TabGroupsMigrator._removeHiddenTabGroupsFromState(stateClone, groupInfo);
|
||||
TabGroupsMigrator._createBackgroundTabGroupRestorationPage(stateClone, removedGroups);
|
||||
Assert.equal(stateClone.windows.length, 1, "Should still only have 1 window");
|
||||
Assert.equal(stateClone.windows[0].tabs.length, 3, "Should now have 3 tabs");
|
||||
|
||||
let url = "chrome://browser/content/aboutTabGroupsMigration.xhtml";
|
||||
let formdata = {id: {sessionData: JSON.stringify(removedGroups)}, url};
|
||||
Assert.deepEqual(stateClone.windows[0].tabs[2],
|
||||
{
|
||||
entries: [{url}],
|
||||
formdata,
|
||||
index: 1
|
||||
},
|
||||
"Should have added expected tab at the end of the tab list.");
|
||||
});
|
||||
|
||||
add_task(function* correctMissingTabGroupInfo() {
|
||||
let stateClone = JSON.parse(JSON.stringify(TEST_STATES.TAB_WITHOUT_GROUP));
|
||||
let groupInfo = TabGroupsMigrator._gatherGroupData(stateClone);
|
||||
Assert.equal(groupInfo.size, 1, "Should have 1 window");
|
||||
let windowGroups = [...groupInfo][0][1];
|
||||
Assert.equal(windowGroups.size, 2, "Window should have 2 groups");
|
||||
let group2 = windowGroups.get("2");
|
||||
Assert.ok(group2, "Group 2 should exist");
|
||||
Assert.equal(group2.tabs.length, 2, "There should be 2 tabs in group 2");
|
||||
Assert.equal(group2.tabs[0].entries[0].title, "Robots 1", "The first tab of group 2 should be the tab with no group info.");
|
||||
});
|
||||
|
||||
add_task(function* dealWithNoGroupInfo() {
|
||||
let stateClone = JSON.parse(JSON.stringify(TEST_STATES.ONLY_UNGROUPED_TABS));
|
||||
let groupInfo = TabGroupsMigrator._gatherGroupData(stateClone);
|
||||
Assert.equal(groupInfo.size, 1, "Should have 1 window");
|
||||
let windowGroups = [...groupInfo][0][1];
|
||||
Assert.equal(windowGroups.size, 1, "Window should have 1 group");
|
||||
let fallbackActiveGroup = windowGroups.get("active group");
|
||||
Assert.ok(fallbackActiveGroup, "Fallback group should exist");
|
||||
Assert.equal(fallbackActiveGroup.tabs.length, 3, "There should be 3 tabs in the fallback group");
|
||||
});
|
||||
|
||||
add_task(function* groupSortingInRemovedDataUsedForRestorePage() {
|
||||
let stateClone = JSON.parse(JSON.stringify(TEST_STATES.SORTING_NAMING_RESTORE_PAGE));
|
||||
let groupInfo = TabGroupsMigrator._gatherGroupData(stateClone);
|
||||
let removedGroups = TabGroupsMigrator._removeHiddenTabGroupsFromState(stateClone, groupInfo);
|
||||
Assert.equal(stateClone.windows.length, 1, "Should still only have 1 window");
|
||||
Assert.equal(stateClone.windows[0].tabs.length, 2, "Should now have 2 tabs");
|
||||
|
||||
let restoredWindowTitles = removedGroups.windows.map(win => win.tabGroupsMigrationTitle);
|
||||
// Note that group 1 is the active group and as such it won't appear in the list of
|
||||
// things the user can restore:
|
||||
Assert.deepEqual(restoredWindowTitles,
|
||||
["Barry", "Foopy", "Group 2", "Group 3"]);
|
||||
});
|
||||
|
|
@ -8,5 +8,4 @@ skip-if = toolkit == 'android' || toolkit == 'gonk'
|
|||
skip-if = os != 'win'
|
||||
[test_DirectoryLinksProvider.js]
|
||||
[test_SitePermissions.js]
|
||||
[test_TabGroupsMigrator.js]
|
||||
[test_LaterRun.js]
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
<path id="fullscreen" d="M696,22V10l6,6Zm-14,2h12l-6,6Zm11-2H683a1,1,0,0,1-1-1V11a1,1,0,0,1,1-1h10a1,1,0,0,1,1,1V21A1,1,0,0,1,693,22Zm-1-7a1,1,0,0,0-1-1h-6a1,1,0,0,0-1,1v4a1,1,0,0,0,1,1h6a1,1,0,0,0,1-1V15ZM688,2l6,6H681.982Zm-8,8V22l-6-6Z"/>
|
||||
<path id="print" d="M670,26h-4V24h-1l3,6H644l2-4h-4a2,2,0,0,1-2-2V14a2,2,0,0,1,2-2h2V10a2,2,0,0,1,2-2V3a1,1,0,0,1,1-1h18a1,1,0,0,1,1,1V8a2,2,0,0,1,2,2v2h2a2,2,0,0,1,2,2V24A2,2,0,0,1,670,26Zm-24,0,1-2h-1v2Zm1-10h-2a1,1,0,0,0,0,2h2A1,1,0,0,0,647,16ZM664,4.5a0.5,0.5,0,0,0-.5-0.5h-15a0.5,0.5,0,0,0-.5.5v9a0.5,0.5,0,0,0,.5.5h15a0.5,0.5,0,0,0,.5-0.5v-9ZM662.222,24H649.778L648,28h16Z"/>
|
||||
<path id="search" d="M626.853,23.318a10.074,10.074,0,0,1-5.361-1.545l-6.611,6.619a2.028,2.028,0,0,1-2.87,0l-0.4-.4a2.033,2.033,0,0,1,0-2.873l6.618-6.627A10.137,10.137,0,1,1,626.853,23.318Zm0-16.254a6.1,6.1,0,1,0,6.088,6.1A6.092,6.092,0,0,0,626.853,7.064Z"/>
|
||||
<path id="tabGroups" d="M603,28H591a1,1,0,0,1-1-1V17a1,1,0,0,1,1-1h12a1,1,0,0,1,1,1V27A1,1,0,0,1,603,28Zm0-14h-4a1,1,0,0,1-1-1V5a1,1,0,0,1,1-1h4a1,1,0,0,1,1,1v8A1,1,0,0,1,603,14Zm-8,0H581a1,1,0,0,1-1-1V5a1,1,0,0,1,1-1h14a1,1,0,0,1,1,1v8A1,1,0,0,1,595,14Zm-14,2h6a1,1,0,0,1,1,1V27a1,1,0,0,1-1,1h-6a1,1,0,0,1-1-1V17A1,1,0,0,1,581,16Z"/>
|
||||
<path id="privateBrowsing" d="M574.273,11.973c-0.122,2.136.37,4.688-2.4,8.367-2.953,3.926-5.886,3.626-6.44,3.685-3.322.354-3.76-2.62-5.7-2.62-1.7,0-3.083,2.955-5.578,2.62-0.552-.074-3.487.241-6.44-3.685-2.768-3.679-2.276-6.231-2.4-8.367a41.419,41.419,0,0,0-.553-4.451,5.372,5.372,0,0,0,3.056,1.484c1.722,0.119,2.044-.61,5.678-1.662,3.929-1.137,6.3,3.522,6.3,3.522s2.668-4.591,6.3-3.522,3.78,1.78,5.5,1.662a6.249,6.249,0,0,0,3.232-1.484A41.574,41.574,0,0,0,574.273,11.973Zm-20.315.895c-2.148-.479-3.049.339-3.969,0.688a7.615,7.615,0,0,1-1.534.4s0.123,1.246,2.276,2.314,6.569,0.517,6.569.517S557.769,13.718,553.958,12.868ZM569.6,13.557c-0.92-.349-1.821-1.167-3.969-0.688-3.811.85-3.342,3.918-3.342,3.918s4.416,0.551,6.569-.517,2.276-2.314,2.276-2.314A7.615,7.615,0,0,1,569.6,13.557Z"/>
|
||||
<path id="new-tab" d="M541.977,28h-28a2,2,0,0,1-2-2V22a2,2,0,0,1,2-2H514c4.591,0,4-3,4.009-8,0.009-4.686.166-8,6.26-8h7.415c6.126,0,6.271,3.314,6.293,8,0.023,5-.592,8,4.023,8h-0.023a2,2,0,0,1,2,2v4A2,2,0,0,1,541.977,28ZM533,14h-4V10h-2v4h-4v2h4v4h2V16h4V14Z"/>
|
||||
<path id="new-window" d="M510,29H482a1,1,0,0,1-1-1V4a1,1,0,0,1,1-1h28a1,1,0,0,1,1,1V28A1,1,0,0,1,510,29ZM499,5.015a0.991,0.991,0,1,0,1,.99A0.995,0.995,0,0,0,499,5.015Zm3,0a0.991,0.991,0,1,0,1,.99A0.995,0.995,0,0,0,502,5.015ZM507,5h-2a1,1,0,0,0,0,2h2A1,1,0,0,0,507,5Zm1,5a1,1,0,0,0-1-1H485a1,1,0,0,0-1,1V25a1,1,0,0,0,1,1h22a1,1,0,0,0,1-1V10Z"/>
|
||||
|
|
До Ширина: | Высота: | Размер: 16 KiB После Ширина: | Высота: | Размер: 16 KiB |
|
@ -114,7 +114,7 @@ def rust_target(rust_compiler, rustc, target, cross_compiling):
|
|||
('x86_64', 'OSX'): 'x86_64-apple-darwin',
|
||||
# Android
|
||||
('x86', 'Android'): 'i686-linux-android',
|
||||
('arm', 'Android'): 'arm-linux-androideabi',
|
||||
('arm', 'Android'): 'armv7-linux-androideabi',
|
||||
# Windows
|
||||
# XXX better detection of CXX needed here, to figure out whether
|
||||
# we need i686-pc-windows-gnu instead, since mingw32 builds work.
|
||||
|
|
|
@ -2,6 +2,7 @@ content devtools client/
|
|||
skin devtools classic/1.0 client/themes/
|
||||
resource devtools .
|
||||
locale devtools en-US client/locales/en-US/
|
||||
locale devtools-shared en-US shared/locales/en-US/
|
||||
|
||||
content webide client/webide/content/
|
||||
skin webide classic/1.0 client/webide/themes/
|
||||
|
|
|
@ -22,7 +22,8 @@ loader.lazyRequireGetter(this, "EventEmitter", "devtools/shared/event-emitter");
|
|||
loader.lazyRequireGetter(this, "AnimationsFront", "devtools/shared/fronts/animation", true);
|
||||
|
||||
const { LocalizationHelper } = require("devtools/shared/l10n");
|
||||
const L10N = new LocalizationHelper("devtools/locale/animationinspector.properties");
|
||||
const L10N =
|
||||
new LocalizationHelper("devtools/client/locales/animationinspector.properties");
|
||||
|
||||
// Global toolbox/inspector, set when startup is called.
|
||||
var gToolbox, gInspector;
|
||||
|
|
|
@ -10,7 +10,8 @@ const EventEmitter = require("devtools/shared/event-emitter");
|
|||
const {createNode, TimeScale} = require("devtools/client/animationinspector/utils");
|
||||
|
||||
const { LocalizationHelper } = require("devtools/shared/l10n");
|
||||
const L10N = new LocalizationHelper("devtools/locale/animationinspector.properties");
|
||||
const L10N =
|
||||
new LocalizationHelper("devtools/client/locales/animationinspector.properties");
|
||||
|
||||
// In the createPathSegments function, an animation duration is divided by
|
||||
// DURATION_RESOLUTION in order to draw the way the animation progresses.
|
||||
|
|
|
@ -9,7 +9,8 @@
|
|||
const EventEmitter = require("devtools/shared/event-emitter");
|
||||
const {createNode} = require("devtools/client/animationinspector/utils");
|
||||
const { LocalizationHelper } = require("devtools/shared/l10n");
|
||||
const L10N = new LocalizationHelper("devtools/locale/animationinspector.properties");
|
||||
const L10N =
|
||||
new LocalizationHelper("devtools/client/locales/animationinspector.properties");
|
||||
|
||||
// List of playback rate presets displayed in the timeline toolbar.
|
||||
const PLAYBACK_RATES = [.1, .25, .5, 1, 2, 5, 10];
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
"use strict";
|
||||
|
||||
const LAYOUT_ERRORS_L10N =
|
||||
new LocalizationHelper("global/locale/layout_errors.properties");
|
||||
new LocalizationHelper("toolkit/locales/layout_errors.properties");
|
||||
|
||||
// Test that when an animation is selected, its list of animated properties is
|
||||
// displayed below it.
|
||||
|
|
|
@ -15,7 +15,7 @@ const FRAME_SCRIPT_URL = CHROME_URL_ROOT + "doc_frame_script.js";
|
|||
const COMMON_FRAME_SCRIPT_URL = "chrome://devtools/content/shared/frame-script-utils.js";
|
||||
const TAB_NAME = "animationinspector";
|
||||
const ANIMATION_L10N =
|
||||
new LocalizationHelper("devtools/locale/animationinspector.properties");
|
||||
new LocalizationHelper("devtools/client/locales/animationinspector.properties");
|
||||
|
||||
// Auto clean-up when a test ends
|
||||
registerCleanupFunction(function* () {
|
||||
|
|
|
@ -9,7 +9,8 @@
|
|||
loader.lazyRequireGetter(this, "EventEmitter", "devtools/shared/event-emitter");
|
||||
|
||||
const { LocalizationHelper } = require("devtools/shared/l10n");
|
||||
const L10N = new LocalizationHelper("devtools/locale/animationinspector.properties");
|
||||
const L10N =
|
||||
new LocalizationHelper("devtools/client/locales/animationinspector.properties");
|
||||
|
||||
// How many times, maximum, can we loop before we find the optimal time
|
||||
// interval in the timeline graph.
|
||||
|
|
|
@ -75,8 +75,8 @@ const EVENTS = {
|
|||
XPCOMUtils.defineConstant(this, "EVENTS", EVENTS);
|
||||
|
||||
const HTML_NS = "http://www.w3.org/1999/xhtml";
|
||||
const STRINGS_URI = "devtools/locale/canvasdebugger.properties";
|
||||
const SHARED_STRINGS_URI = "devtools/locale/shared.properties";
|
||||
const STRINGS_URI = "devtools/client/locales/canvasdebugger.properties";
|
||||
const SHARED_STRINGS_URI = "devtools/client/locales/shared.properties";
|
||||
|
||||
const SNAPSHOT_START_RECORDING_DELAY = 10; // ms
|
||||
const SNAPSHOT_DATA_EXPORT_MAX_BLOCK = 1000; // ms
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
var { classes: Cc, interfaces: Ci, utils: Cu } = Components;
|
||||
|
||||
const DBG_STRINGS_URI = "devtools/locale/debugger.properties";
|
||||
const DBG_STRINGS_URI = "devtools/client/locales/debugger.properties";
|
||||
const NEW_SOURCE_IGNORED_URLS = ["debugger eval code", "XStringBundle"];
|
||||
const NEW_SOURCE_DISPLAY_DELAY = 200; // ms
|
||||
const FETCH_SOURCE_RESPONSE_DELAY = 200; // ms
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
const { Task } = require("devtools/shared/task");
|
||||
var {LocalizationHelper} = require("devtools/shared/l10n");
|
||||
|
||||
const DBG_STRINGS_URI = "devtools/locale/debugger.properties";
|
||||
const DBG_STRINGS_URI = "devtools/client/locales/debugger.properties";
|
||||
var L10N = new LocalizationHelper(DBG_STRINGS_URI);
|
||||
|
||||
function DebuggerPanel(iframeWindow, toolbox) {
|
||||
|
|
|
@ -24,7 +24,7 @@ loader.lazyGetter(this, "ScratchpadPanel", () => require("devtools/client/scratc
|
|||
loader.lazyGetter(this, "DomPanel", () => require("devtools/client/dom/dom-panel").DomPanel);
|
||||
|
||||
const {LocalizationHelper} = require("devtools/shared/l10n");
|
||||
const L10N = new LocalizationHelper("devtools/locale/startup.properties");
|
||||
const L10N = new LocalizationHelper("devtools/client/locales/startup.properties");
|
||||
|
||||
var Tools = {};
|
||||
exports.Tools = Tools;
|
||||
|
|
|
@ -20,7 +20,7 @@ XPCOMUtils.defineConstant(this, "require", require);
|
|||
|
||||
// Localization
|
||||
const { LocalizationHelper } = require("devtools/shared/l10n");
|
||||
this.l10n = new LocalizationHelper("devtools/locale/dom.properties");
|
||||
this.l10n = new LocalizationHelper("devtools/client/locales/dom.properties");
|
||||
|
||||
// Load DOM panel content
|
||||
require("./content/dom-view.js");
|
||||
|
|
|
@ -9,7 +9,7 @@ const Services = require("Services");
|
|||
const defer = require("devtools/shared/defer");
|
||||
|
||||
const {LocalizationHelper} = require("devtools/shared/l10n");
|
||||
const L10N = new LocalizationHelper("devtools/locale/toolbox.properties");
|
||||
const L10N = new LocalizationHelper("devtools/client/locales/toolbox.properties");
|
||||
|
||||
function handleThreadState(toolbox, event, packet) {
|
||||
// Suppress interrupted events by default because the thread is
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
*/
|
||||
|
||||
const {LocalizationHelper} = require("devtools/shared/l10n");
|
||||
const MENUS_L10N = new LocalizationHelper("devtools/locale/menus.properties");
|
||||
const MENUS_L10N = new LocalizationHelper("devtools/client/locales/menus.properties");
|
||||
|
||||
loader.lazyRequireGetter(this, "gDevTools", "devtools/client/framework/devtools", true);
|
||||
loader.lazyRequireGetter(this, "gDevToolsBrowser", "devtools/client/framework/devtools-browser", true);
|
||||
|
|
|
@ -15,7 +15,7 @@ var {Toolbox} = require("devtools/client/framework/toolbox");
|
|||
var {DebuggerClient} = require("devtools/shared/client/main");
|
||||
var {Task} = require("devtools/shared/task");
|
||||
var {LocalizationHelper} = require("devtools/shared/l10n");
|
||||
var L10N = new LocalizationHelper("devtools/locale/connection-screen.properties");
|
||||
var L10N = new LocalizationHelper("devtools/client/locales/connection-screen.properties");
|
||||
|
||||
var gClient;
|
||||
var gConnectionTimeout;
|
||||
|
|
|
@ -31,7 +31,7 @@ loader.lazyImporter(this, "CustomizableUI", "resource:///modules/CustomizableUI.
|
|||
loader.lazyImporter(this, "AppConstants", "resource://gre/modules/AppConstants.jsm");
|
||||
|
||||
const {LocalizationHelper} = require("devtools/shared/l10n");
|
||||
const L10N = new LocalizationHelper("devtools/locale/toolbox.properties");
|
||||
const L10N = new LocalizationHelper("devtools/client/locales/toolbox.properties");
|
||||
|
||||
const TABS_OPEN_PEAK_HISTOGRAM = "DEVTOOLS_TABS_OPEN_PEAK_LINEAR";
|
||||
const TABS_OPEN_AVG_HISTOGRAM = "DEVTOOLS_TABS_OPEN_AVERAGE_LINEAR";
|
||||
|
|
|
@ -10,7 +10,7 @@ var EventEmitter = require("devtools/shared/event-emitter");
|
|||
var Telemetry = require("devtools/client/shared/telemetry");
|
||||
|
||||
const {LocalizationHelper} = require("devtools/shared/l10n");
|
||||
const L10N = new LocalizationHelper("devtools/locale/toolbox.properties");
|
||||
const L10N = new LocalizationHelper("devtools/client/locales/toolbox.properties");
|
||||
|
||||
const XULNS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ const URL = "data:text/html;charset=utf8,test page";
|
|||
var {Toolbox} = require("devtools/client/framework/toolbox");
|
||||
|
||||
const {LocalizationHelper} = require("devtools/shared/l10n");
|
||||
const L10N = new LocalizationHelper("devtools/locale/toolbox.properties");
|
||||
const L10N = new LocalizationHelper("devtools/client/locales/toolbox.properties");
|
||||
|
||||
function getZoomValue() {
|
||||
return parseFloat(Services.prefs.getCharPref("devtools.toolbox.zoomValue"));
|
||||
|
|
|
@ -13,7 +13,7 @@ const URL = "data:text/html;charset=utf8,test page for toolbox switching";
|
|||
var {Toolbox} = require("devtools/client/framework/toolbox");
|
||||
|
||||
const {LocalizationHelper} = require("devtools/shared/l10n");
|
||||
const L10N = new LocalizationHelper("devtools/locale/toolbox.properties");
|
||||
const L10N = new LocalizationHelper("devtools/client/locales/toolbox.properties");
|
||||
|
||||
add_task(function* () {
|
||||
info("Create a test tab and open the toolbox");
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
var doc = null, toolbox = null, panelWin = null, modifiedPrefs = [];
|
||||
const {LocalizationHelper} = require("devtools/shared/l10n");
|
||||
const L10N = new LocalizationHelper("devtools/locale/toolbox.properties");
|
||||
const L10N = new LocalizationHelper("devtools/client/locales/toolbox.properties");
|
||||
|
||||
add_task(function* () {
|
||||
const URL = "data:text/html;charset=utf8,test for dynamically registering " +
|
||||
|
|
|
@ -10,7 +10,7 @@ requestLongerTimeout(2);
|
|||
var {Toolbox} = require("devtools/client/framework/toolbox");
|
||||
|
||||
const {LocalizationHelper} = require("devtools/shared/l10n");
|
||||
const L10N = new LocalizationHelper("devtools/locale/toolbox.properties");
|
||||
const L10N = new LocalizationHelper("devtools/client/locales/toolbox.properties");
|
||||
|
||||
add_task(function* () {
|
||||
let tab = yield addTab("about:blank");
|
||||
|
|
|
@ -12,7 +12,7 @@ const TEST_URL = "data:text/html;charset=utf-8," +
|
|||
var {Toolbox} = require("devtools/client/framework/toolbox");
|
||||
|
||||
const {LocalizationHelper} = require("devtools/shared/l10n");
|
||||
const L10N = new LocalizationHelper("devtools/locale/toolbox.properties");
|
||||
const L10N = new LocalizationHelper("devtools/client/locales/toolbox.properties");
|
||||
|
||||
var target, toolbox, description, reloadsSent, toolIDs;
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
var toolbox;
|
||||
|
||||
const {LocalizationHelper} = require("devtools/shared/l10n");
|
||||
const L10N = new LocalizationHelper("devtools/locale/toolbox.properties");
|
||||
const L10N = new LocalizationHelper("devtools/client/locales/toolbox.properties");
|
||||
|
||||
function test() {
|
||||
addTab("about:blank").then(openToolbox);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
const Services = require("Services");
|
||||
const {Ci} = require("chrome");
|
||||
const {LocalizationHelper} = require("devtools/shared/l10n");
|
||||
const L10N = new LocalizationHelper("devtools/locale/toolbox.properties");
|
||||
const L10N = new LocalizationHelper("devtools/client/locales/toolbox.properties");
|
||||
const DevToolsUtils = require("devtools/shared/DevToolsUtils");
|
||||
const {Task} = require("devtools/shared/task");
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ const {Task} = require("devtools/shared/task");
|
|||
const {gDevTools} = require("devtools/client/framework/devtools");
|
||||
|
||||
const {LocalizationHelper} = require("devtools/shared/l10n");
|
||||
const L10N = new LocalizationHelper("devtools/locale/toolbox.properties");
|
||||
const L10N = new LocalizationHelper("devtools/client/locales/toolbox.properties");
|
||||
|
||||
exports.OptionsPanel = OptionsPanel;
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ const { BrowserLoader } =
|
|||
Cu.import("resource://devtools/client/shared/browser-loader.js", {});
|
||||
|
||||
const {LocalizationHelper} = require("devtools/shared/l10n");
|
||||
const L10N = new LocalizationHelper("devtools/locale/toolbox.properties");
|
||||
const L10N = new LocalizationHelper("devtools/client/locales/toolbox.properties");
|
||||
|
||||
loader.lazyRequireGetter(this, "CommandUtils",
|
||||
"devtools/client/shared/developer-toolbar", true);
|
||||
|
|
|
@ -13,8 +13,8 @@ const {ReflowFront} = require("devtools/shared/fronts/reflow");
|
|||
const {LocalizationHelper} = require("devtools/shared/l10n");
|
||||
const {getCssProperties} = require("devtools/shared/fronts/css-properties");
|
||||
|
||||
const STRINGS_URI = "devtools/locale/shared.properties";
|
||||
const STRINGS_INSPECTOR = "devtools-shared/locale/styleinspector.properties";
|
||||
const STRINGS_URI = "devtools/client/locales/shared.properties";
|
||||
const STRINGS_INSPECTOR = "devtools/shared/locales/styleinspector.properties";
|
||||
const SHARED_L10N = new LocalizationHelper(STRINGS_URI);
|
||||
const INSPECTOR_L10N = new LocalizationHelper(STRINGS_INSPECTOR);
|
||||
const NUMERIC = /^-?[\d\.]+$/;
|
||||
|
|
|
@ -24,7 +24,7 @@ const {KeyShortcuts} = require("devtools/client/shared/key-shortcuts");
|
|||
const {BoxModelView} = require("devtools/client/inspector/components/box-model");
|
||||
const clipboardHelper = require("devtools/shared/platform/clipboard");
|
||||
|
||||
const STYLE_INSPECTOR_PROPERTIES = "devtools-shared/locale/styleinspector.properties";
|
||||
const STYLE_INSPECTOR_PROPERTIES = "devtools/shared/locales/styleinspector.properties";
|
||||
const {LocalizationHelper} = require("devtools/shared/l10n");
|
||||
const STYLE_INSPECTOR_L10N = new LocalizationHelper(STYLE_INSPECTOR_PROPERTIES);
|
||||
|
||||
|
|
|
@ -37,8 +37,9 @@ const {ViewHelpers} = require("devtools/client/shared/widgets/view-helpers");
|
|||
const clipboardHelper = require("devtools/shared/platform/clipboard");
|
||||
|
||||
const {LocalizationHelper, localizeMarkup} = require("devtools/shared/l10n");
|
||||
const INSPECTOR_L10N = new LocalizationHelper("devtools/locale/inspector.properties");
|
||||
const TOOLBOX_L10N = new LocalizationHelper("devtools/locale/toolbox.properties");
|
||||
const INSPECTOR_L10N =
|
||||
new LocalizationHelper("devtools/client/locales/inspector.properties");
|
||||
const TOOLBOX_L10N = new LocalizationHelper("devtools/client/locales/toolbox.properties");
|
||||
|
||||
// Sidebar dimensions
|
||||
const INITIAL_SIDEBAR_SIZE = 350;
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
<!-- Main Panel Content -->
|
||||
<div id="inspector-main-content" class="devtools-main-content">
|
||||
<div id="inspector-toolbar" class="devtools-toolbar" nowindowdrag="true"
|
||||
data-localization-bundle="devtools/locale/inspector.properties">
|
||||
data-localization-bundle="devtools/client/locales/inspector.properties">
|
||||
<button id="inspector-element-add-button" class="devtools-button"
|
||||
data-localization="title=inspectorAddNode.label"></button>
|
||||
<div class="devtools-toolbar-spacer"></div>
|
||||
|
@ -73,7 +73,7 @@
|
|||
<!-- Sidebar panel definitions -->
|
||||
<div id="tabpanels" style="visibility:collapse">
|
||||
<div id="sidebar-panel-ruleview" class="devtools-monospace theme-sidebar inspector-tabpanel"
|
||||
data-localization-bundle="devtools/locale/inspector.properties">
|
||||
data-localization-bundle="devtools/client/locales/inspector.properties">
|
||||
<div id="ruleview-toolbar-container" class="devtools-toolbar">
|
||||
<div id="ruleview-toolbar">
|
||||
<div class="devtools-searchbox has-clear-btn">
|
||||
|
@ -102,7 +102,7 @@
|
|||
</div>
|
||||
|
||||
<div id="sidebar-panel-computedview" class="devtools-monospace theme-sidebar inspector-tabpanel"
|
||||
data-localization-bundle="devtools/locale/inspector.properties">
|
||||
data-localization-bundle="devtools/client/locales/inspector.properties">
|
||||
<div id="computedview-toolbar" class="devtools-toolbar">
|
||||
<div class="devtools-searchbox has-clear-btn">
|
||||
<input id="computedview-searchbox"
|
||||
|
@ -121,7 +121,7 @@
|
|||
<div id="computedview-container">
|
||||
<div id="computedview-container-focusable" tabindex="-1">
|
||||
<div id="boxmodel-wrapper" tabindex="0"
|
||||
data-localization-bundle="devtools/locale/boxmodel.properties">
|
||||
data-localization-bundle="devtools/client/locales/boxmodel.properties">
|
||||
<div id="boxmodel-header">
|
||||
<div id="boxmodel-expander" class="expander theme-twisty expandable" open=""></div>
|
||||
<span data-localization="content=boxmodel.title"></span>
|
||||
|
@ -185,12 +185,12 @@
|
|||
</div>
|
||||
|
||||
<div id="sidebar-panel-layoutview" class="devtools-monospace theme-sidebar inspector-tabpanel"
|
||||
data-localization-bundle="devtools/locale/inspector.properties">
|
||||
data-localization-bundle="devtools/client/locales/inspector.properties">
|
||||
<div id="layoutview-container"></div>
|
||||
</div>
|
||||
|
||||
<div id="sidebar-panel-fontinspector" class="devtools-monospace theme-sidebar inspector-tabpanel"
|
||||
data-localization-bundle="devtools/locale/font-inspector.properties">
|
||||
data-localization-bundle="devtools/client/locales/font-inspector.properties">
|
||||
<div class="devtools-toolbar">
|
||||
<div class="devtools-searchbox">
|
||||
<input id="font-preview-text-input" class="devtools-textinput" type="search"
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
"use strict";
|
||||
|
||||
const { LocalizationHelper } = require("devtools/shared/l10n");
|
||||
const L10N = new LocalizationHelper("devtools/locale/layout.properties");
|
||||
const L10N = new LocalizationHelper("devtools/client/locales/layout.properties");
|
||||
|
||||
module.exports = {
|
||||
getStr: (...args) => L10N.getStr(...args),
|
||||
|
|
|
@ -26,7 +26,8 @@ const MarkupReadOnlyContainer = require("devtools/client/inspector/markup/views/
|
|||
const MarkupTextContainer = require("devtools/client/inspector/markup/views/text-container");
|
||||
const RootContainer = require("devtools/client/inspector/markup/views/root-container");
|
||||
|
||||
const INSPECTOR_L10N = new LocalizationHelper("devtools/locale/inspector.properties");
|
||||
const INSPECTOR_L10N =
|
||||
new LocalizationHelper("devtools/client/locales/inspector.properties");
|
||||
|
||||
// Page size for pageup/pagedown
|
||||
const PAGE_SIZE = 10;
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
const TEST_URL = URL_ROOT + "doc_markup_links.html";
|
||||
|
||||
const TOOLBOX_L10N = new LocalizationHelper("devtools/locale/toolbox.properties");
|
||||
const TOOLBOX_L10N = new LocalizationHelper("devtools/client/locales/toolbox.properties");
|
||||
|
||||
// The test case array contains objects with the following properties:
|
||||
// - selector: css selector for the node to select in the inspector
|
||||
|
|
|
@ -9,7 +9,8 @@ const {editableField} = require("devtools/client/shared/inplace-editor");
|
|||
const {getCssProperties} = require("devtools/shared/fronts/css-properties");
|
||||
const {LocalizationHelper} = require("devtools/shared/l10n");
|
||||
|
||||
const INSPECTOR_L10N = new LocalizationHelper("devtools/locale/inspector.properties");
|
||||
const INSPECTOR_L10N =
|
||||
new LocalizationHelper("devtools/client/locales/inspector.properties");
|
||||
|
||||
/**
|
||||
* Creates a simple text editor node, used for TEXT and COMMENT
|
||||
|
|
|
@ -15,7 +15,7 @@ const {promiseWarn} = require("devtools/client/inspector/shared/utils");
|
|||
const {parseDeclarations} = require("devtools/shared/css/parsing-utils");
|
||||
const Services = require("Services");
|
||||
|
||||
const STYLE_INSPECTOR_PROPERTIES = "devtools-shared/locale/styleinspector.properties";
|
||||
const STYLE_INSPECTOR_PROPERTIES = "devtools/shared/locales/styleinspector.properties";
|
||||
const {LocalizationHelper} = require("devtools/shared/l10n");
|
||||
const STYLE_INSPECTOR_L10N = new LocalizationHelper(STYLE_INSPECTOR_PROPERTIES);
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ const ROOT_TEST_DIR = getRootDirectory(gTestPath);
|
|||
const FRAME_SCRIPT_URL = ROOT_TEST_DIR + "doc_frame_script.js";
|
||||
|
||||
const STYLE_INSPECTOR_L10N
|
||||
= new LocalizationHelper("devtools-shared/locale/styleinspector.properties");
|
||||
= new LocalizationHelper("devtools/shared/locales/styleinspector.properties");
|
||||
|
||||
registerCleanupFunction(() => {
|
||||
Services.prefs.clearUserPref("devtools.defaultColorUnit");
|
||||
|
|
|
@ -29,7 +29,7 @@ const Services = require("Services");
|
|||
const EventEmitter = require("devtools/shared/event-emitter");
|
||||
const {Task} = require("devtools/shared/task");
|
||||
|
||||
const STYLE_INSPECTOR_PROPERTIES = "devtools-shared/locale/styleinspector.properties";
|
||||
const STYLE_INSPECTOR_PROPERTIES = "devtools/shared/locales/styleinspector.properties";
|
||||
const {LocalizationHelper} = require("devtools/shared/l10n");
|
||||
const STYLE_INSPECTOR_L10N = new LocalizationHelper(STYLE_INSPECTOR_PROPERTIES);
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ const EventEmitter = require("devtools/shared/event-emitter");
|
|||
const {createNode} = require("devtools/client/animationinspector/utils");
|
||||
const { LocalizationHelper } = require("devtools/shared/l10n");
|
||||
|
||||
const STRINGS_URI = "devtools/locale/inspector.properties";
|
||||
const STRINGS_URI = "devtools/client/locales/inspector.properties";
|
||||
const L10N = new LocalizationHelper(STRINGS_URI);
|
||||
|
||||
/**
|
||||
|
|
|
@ -16,7 +16,7 @@ const MenuItem = require("devtools/client/framework/menu-item");
|
|||
const overlays = require("devtools/client/inspector/shared/style-inspector-overlays");
|
||||
const clipboardHelper = require("devtools/shared/platform/clipboard");
|
||||
|
||||
const STYLE_INSPECTOR_PROPERTIES = "devtools-shared/locale/styleinspector.properties";
|
||||
const STYLE_INSPECTOR_PROPERTIES = "devtools/shared/locales/styleinspector.properties";
|
||||
const {LocalizationHelper} = require("devtools/shared/l10n");
|
||||
const STYLE_INSPECTOR_L10N = new LocalizationHelper(STYLE_INSPECTOR_PROPERTIES);
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ const TEST_URL_ROOT_SSL =
|
|||
const ROOT_TEST_DIR = getRootDirectory(gTestPath);
|
||||
const FRAME_SCRIPT_URL = ROOT_TEST_DIR + "doc_frame_script.js";
|
||||
const STYLE_INSPECTOR_L10N =
|
||||
new LocalizationHelper("devtools-shared/locale/styleinspector.properties");
|
||||
new LocalizationHelper("devtools/shared/locales/styleinspector.properties");
|
||||
|
||||
// Clean-up all prefs that might have been changed during a test run
|
||||
// (safer here because if the test fails, then the pref is never reverted)
|
||||
|
|
|
@ -35,7 +35,8 @@ Services.scriptloader.loadSubScript(
|
|||
this);
|
||||
|
||||
const {LocalizationHelper} = require("devtools/shared/l10n");
|
||||
const INSPECTOR_L10N = new LocalizationHelper("devtools/locale/inspector.properties");
|
||||
const INSPECTOR_L10N =
|
||||
new LocalizationHelper("devtools/client/locales/inspector.properties");
|
||||
|
||||
flags.testing = true;
|
||||
registerCleanupFunction(() => {
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
const { Cu, Cc, Ci } = require("chrome");
|
||||
|
||||
const { LocalizationHelper } = require("devtools/shared/l10n");
|
||||
const STRINGS_URI = "devtools/locale/memory.properties";
|
||||
const STRINGS_URI = "devtools/client/locales/memory.properties";
|
||||
const L10N = exports.L10N = new LocalizationHelper(STRINGS_URI);
|
||||
|
||||
const { OS } = require("resource://gre/modules/osfile.jsm");
|
||||
|
|
|
@ -4,8 +4,9 @@
|
|||
"use strict";
|
||||
|
||||
const {
|
||||
TOGGLE_FILTER,
|
||||
ENABLE_FILTER_ONLY,
|
||||
TOGGLE_FILTER_TYPE,
|
||||
ENABLE_FILTER_TYPE_ONLY,
|
||||
SET_FILTER_TEXT,
|
||||
} = require("../constants");
|
||||
|
||||
/**
|
||||
|
@ -15,9 +16,9 @@ const {
|
|||
*
|
||||
* @param {string} filter - A filter type is going to be updated
|
||||
*/
|
||||
function toggleFilter(filter) {
|
||||
function toggleFilterType(filter) {
|
||||
return {
|
||||
type: TOGGLE_FILTER,
|
||||
type: TOGGLE_FILTER_TYPE,
|
||||
filter,
|
||||
};
|
||||
}
|
||||
|
@ -30,14 +31,27 @@ function toggleFilter(filter) {
|
|||
*
|
||||
* @param {string} filter - A filter type is going to be updated
|
||||
*/
|
||||
function enableFilterOnly(filter) {
|
||||
function enableFilterTypeOnly(filter) {
|
||||
return {
|
||||
type: ENABLE_FILTER_ONLY,
|
||||
type: ENABLE_FILTER_TYPE_ONLY,
|
||||
filter,
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Set filter text.
|
||||
*
|
||||
* @param {string} url - A filter text is going to be set
|
||||
*/
|
||||
function setFilterText(url) {
|
||||
return {
|
||||
type: SET_FILTER_TEXT,
|
||||
url,
|
||||
};
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
toggleFilter,
|
||||
enableFilterOnly,
|
||||
toggleFilterType,
|
||||
enableFilterTypeOnly,
|
||||
setFilterText,
|
||||
};
|
||||
|
|
|
@ -42,7 +42,7 @@ module.exports = connect(
|
|||
if (evt.type === "keydown" && (evt.key !== "" || evt.key !== "Enter")) {
|
||||
return;
|
||||
}
|
||||
dispatch(Actions.toggleFilter(evt.target.dataset.key));
|
||||
dispatch(Actions.toggleFilterType(evt.target.dataset.key));
|
||||
},
|
||||
})
|
||||
)(FilterButtons);
|
||||
|
|
|
@ -5,5 +5,6 @@
|
|||
|
||||
DevToolsModules(
|
||||
'filter-buttons.js',
|
||||
'search-box.js',
|
||||
'toggle-button.js',
|
||||
)
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
/* 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 { connect } = require("devtools/client/shared/vendor/react-redux");
|
||||
const SearchBox = require("devtools/client/shared/components/search-box");
|
||||
const { L10N } = require("../l10n");
|
||||
const Actions = require("../actions/index");
|
||||
const { FREETEXT_FILTER_SEARCH_DELAY } = require("../constants");
|
||||
|
||||
module.exports = connect(
|
||||
(state) => ({
|
||||
delay: FREETEXT_FILTER_SEARCH_DELAY,
|
||||
keyShortcut: L10N.getStr("netmonitor.toolbar.filterFreetext.key"),
|
||||
placeholder: L10N.getStr("netmonitor.toolbar.filterFreetext.label"),
|
||||
type: "filter",
|
||||
}),
|
||||
(dispatch) => ({
|
||||
onChange: (url) => {
|
||||
dispatch(Actions.setFilterText(url));
|
||||
},
|
||||
})
|
||||
)(SearchBox);
|
|
@ -3,12 +3,17 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
"use strict";
|
||||
|
||||
const general = {
|
||||
FREETEXT_FILTER_SEARCH_DELAY: 200,
|
||||
};
|
||||
|
||||
const actionTypes = {
|
||||
TOGGLE_FILTER: "TOGGLE_FILTER",
|
||||
ENABLE_FILTER_ONLY: "ENABLE_FILTER_ONLY",
|
||||
TOGGLE_FILTER_TYPE: "TOGGLE_FILTER_TYPE",
|
||||
ENABLE_FILTER_TYPE_ONLY: "ENABLE_FILTER_TYPE_ONLY",
|
||||
TOGGLE_SIDEBAR: "TOGGLE_SIDEBAR",
|
||||
SHOW_SIDEBAR: "SHOW_SIDEBAR",
|
||||
DISABLE_TOGGLE_BUTTON: "DISABLE_TOGGLE_BUTTON",
|
||||
SET_FILTER_TEXT: "SET_FILTER_TEXT",
|
||||
};
|
||||
|
||||
module.exports = actionTypes;
|
||||
module.exports = Object.assign({}, general, actionTypes);
|
||||
|
|
|
@ -13,7 +13,7 @@ const { getFormDataSections } = require("devtools/client/netmonitor/request-util
|
|||
loader.lazyRequireGetter(this, "NetworkHelper", "devtools/shared/webconsole/network-helper");
|
||||
|
||||
loader.lazyGetter(this, "L10N", () => {
|
||||
return new LocalizationHelper("devtools/locale/har.properties");
|
||||
return new LocalizationHelper("devtools/client/locales/har.properties");
|
||||
});
|
||||
|
||||
const HAR_VERSION = "1.1";
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
|
||||
const {LocalizationHelper} = require("devtools/shared/l10n");
|
||||
|
||||
const NET_STRINGS_URI = "devtools/locale/netmonitor.properties";
|
||||
const WEBCONSOLE_STRINGS_URI = "devtools/locale/webconsole.properties";
|
||||
const NET_STRINGS_URI = "devtools/client/locales/netmonitor.properties";
|
||||
const WEBCONSOLE_STRINGS_URI = "devtools/client/locales/webconsole.properties";
|
||||
|
||||
exports.L10N = new LocalizationHelper(NET_STRINGS_URI);
|
||||
exports.WEBCONSOLE_L10N = new LocalizationHelper(WEBCONSOLE_STRINGS_URI);
|
||||
|
|
|
@ -299,7 +299,7 @@ var NetMonitorController = {
|
|||
request = NetMonitorView.RequestsMenu.getItemForPredicate(predicate);
|
||||
if (!request) {
|
||||
// Reset filters so that the request is visible.
|
||||
gStore.dispatch(Actions.toggleFilter("all"));
|
||||
gStore.dispatch(Actions.toggleFilterType("all"));
|
||||
request = NetMonitorView.RequestsMenu.getItemForPredicate(predicate);
|
||||
}
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
<deck id="body"
|
||||
class="theme-sidebar"
|
||||
flex="1"
|
||||
data-localization-bundle="devtools/locale/netmonitor.properties">
|
||||
data-localization-bundle="devtools/client/locales/netmonitor.properties">
|
||||
|
||||
<vbox id="network-inspector-view" flex="1">
|
||||
<hbox id="netmonitor-toolbar" class="devtools-toolbar">
|
||||
|
@ -31,11 +31,10 @@
|
|||
<toolbarbutton id="requests-menu-network-summary-button"
|
||||
class="devtools-toolbarbutton icon-and-text"
|
||||
data-localization="tooltiptext=netmonitor.toolbar.perf"/>
|
||||
<textbox id="requests-menu-filter-freetext-text"
|
||||
class="devtools-filterinput"
|
||||
type="search"
|
||||
required="true"
|
||||
data-localization="placeholder=netmonitor.toolbar.filterFreetext.label"/>
|
||||
<html:div xmlns="http://www.w3.org/1999/xhtml"
|
||||
id="react-details-pane-toggle-hook"/>
|
||||
<html:div xmlns="http://www.w3.org/1999/xhtml"
|
||||
id="react-search-box-hook"/>
|
||||
<html:div xmlns="http://www.w3.org/1999/xhtml"
|
||||
id="react-details-pane-toggle-hook"/>
|
||||
</hbox>
|
||||
|
|
|
@ -9,8 +9,6 @@ const promise = require("promise");
|
|||
const EventEmitter = require("devtools/shared/event-emitter");
|
||||
const { Task } = require("devtools/shared/task");
|
||||
const { localizeMarkup } = require("devtools/shared/l10n");
|
||||
const {KeyShortcuts} = require("devtools/client/shared/key-shortcuts");
|
||||
const {L10N} = require("./l10n");
|
||||
|
||||
function NetMonitorPanel(iframeWindow, toolbox) {
|
||||
this.panelWin = iframeWindow;
|
||||
|
@ -23,15 +21,6 @@ function NetMonitorPanel(iframeWindow, toolbox) {
|
|||
this._controller._toolbox = this._toolbox;
|
||||
|
||||
EventEmitter.decorate(this);
|
||||
|
||||
this.shortcuts = new KeyShortcuts({
|
||||
window: this.panelDoc.defaultView,
|
||||
});
|
||||
let key = L10N.getStr("netmonitor.toolbar.filterFreetext.key");
|
||||
this.shortcuts.on(key, (name, event) => {
|
||||
event.preventDefault();
|
||||
this._view.RequestsMenu.freetextFilterBox.focus();
|
||||
});
|
||||
}
|
||||
|
||||
exports.NetMonitorPanel = NetMonitorPanel;
|
||||
|
@ -79,8 +68,6 @@ NetMonitorPanel.prototype = {
|
|||
let deferred = promise.defer();
|
||||
this._destroying = deferred.promise;
|
||||
|
||||
this.shortcuts.destroy();
|
||||
|
||||
yield this._controller.shutdownNetMonitor();
|
||||
this.emit("destroyed");
|
||||
|
||||
|
|
|
@ -5,11 +5,12 @@
|
|||
|
||||
const I = require("devtools/client/shared/vendor/immutable");
|
||||
const {
|
||||
TOGGLE_FILTER,
|
||||
ENABLE_FILTER_ONLY,
|
||||
TOGGLE_FILTER_TYPE,
|
||||
ENABLE_FILTER_TYPE_ONLY,
|
||||
SET_FILTER_TEXT,
|
||||
} = require("../constants");
|
||||
|
||||
const FiltersTypes = I.Record({
|
||||
const FilterTypes = I.Record({
|
||||
all: false,
|
||||
html: false,
|
||||
css: false,
|
||||
|
@ -24,10 +25,11 @@ const FiltersTypes = I.Record({
|
|||
});
|
||||
|
||||
const Filters = I.Record({
|
||||
types: new FiltersTypes({ all: true }),
|
||||
types: new FilterTypes({ all: true }),
|
||||
url: "",
|
||||
});
|
||||
|
||||
function toggleFilter(state, action) {
|
||||
function toggleFilterType(state, action) {
|
||||
let { filter } = action;
|
||||
let newState;
|
||||
|
||||
|
@ -36,7 +38,7 @@ function toggleFilter(state, action) {
|
|||
return state;
|
||||
}
|
||||
if (filter === "all") {
|
||||
return new FiltersTypes({ all: true });
|
||||
return new FilterTypes({ all: true });
|
||||
}
|
||||
|
||||
newState = state.withMutations(types => {
|
||||
|
@ -45,13 +47,13 @@ function toggleFilter(state, action) {
|
|||
});
|
||||
|
||||
if (!newState.includes(true)) {
|
||||
newState = new FiltersTypes({ all: true });
|
||||
newState = new FilterTypes({ all: true });
|
||||
}
|
||||
|
||||
return newState;
|
||||
}
|
||||
|
||||
function enableFilterOnly(state, action) {
|
||||
function enableFilterTypeOnly(state, action) {
|
||||
let { filter } = action;
|
||||
|
||||
// Ignore unknown filter type
|
||||
|
@ -59,18 +61,17 @@ function enableFilterOnly(state, action) {
|
|||
return state;
|
||||
}
|
||||
|
||||
return new FiltersTypes({ [filter]: true });
|
||||
return new FilterTypes({ [filter]: true });
|
||||
}
|
||||
|
||||
function filters(state = new Filters(), action) {
|
||||
let types;
|
||||
switch (action.type) {
|
||||
case TOGGLE_FILTER:
|
||||
types = toggleFilter(state.types, action);
|
||||
return state.set("types", types);
|
||||
case ENABLE_FILTER_ONLY:
|
||||
types = enableFilterOnly(state.types, action);
|
||||
return state.set("types", types);
|
||||
case TOGGLE_FILTER_TYPE:
|
||||
return state.set("types", toggleFilterType(state.types, action));
|
||||
case ENABLE_FILTER_TYPE_ONLY:
|
||||
return state.set("types", enableFilterTypeOnly(state.types, action));
|
||||
case SET_FILTER_TEXT:
|
||||
return state.set("url", action.url);
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
NetMonitorController, NetMonitorView */
|
||||
"use strict";
|
||||
/* eslint-disable mozilla/reject-some-requires */
|
||||
const { Cc, Ci, Cu } = require("chrome");
|
||||
const { Cu } = require("chrome");
|
||||
const Services = require("Services");
|
||||
const {Task} = require("devtools/shared/task");
|
||||
const {DeferredTask} = Cu.import("resource://gre/modules/DeferredTask.jsm", {});
|
||||
|
@ -70,8 +70,7 @@ const REQUESTS_WATERFALL_BACKGROUND_TICKS_OPACITY_MIN = 32;
|
|||
const REQUESTS_WATERFALL_BACKGROUND_TICKS_OPACITY_ADD = 32;
|
||||
const REQUESTS_WATERFALL_DOMCONTENTLOADED_TICKS_COLOR_RGBA = [255, 0, 0, 128];
|
||||
const REQUESTS_WATERFALL_LOAD_TICKS_COLOR_RGBA = [0, 0, 255, 128];
|
||||
// ms
|
||||
const FREETEXT_FILTER_SEARCH_DELAY = 200;
|
||||
|
||||
// Constants for formatting bytes.
|
||||
const BYTES_IN_KB = 1024;
|
||||
const BYTES_IN_MB = Math.pow(BYTES_IN_KB, 2);
|
||||
|
@ -134,8 +133,6 @@ RequestsMenuView.prototype = Heritage.extend(WidgetMethods, {
|
|||
this._splitter = $("#network-inspector-view-splitter");
|
||||
this._summary = $("#requests-menu-network-summary-button");
|
||||
this._summary.setAttribute("label", L10N.getStr("networkMenu.empty"));
|
||||
this.userInputTimer = Cc["@mozilla.org/timer;1"]
|
||||
.createInstance(Ci.nsITimer);
|
||||
|
||||
// Create a tooltip for the newly appended network request item.
|
||||
this.tooltip = new HTMLTooltip(NetMonitorController._toolbox.doc, { type: "arrow" });
|
||||
|
@ -174,16 +171,8 @@ RequestsMenuView.prototype = Heritage.extend(WidgetMethods, {
|
|||
this.cloneSelectedRequestEvent = this.cloneSelectedRequest.bind(this);
|
||||
this.toggleRawHeadersEvent = this.toggleRawHeaders.bind(this);
|
||||
|
||||
this.requestsFreetextFilterEvent =
|
||||
this.requestsFreetextFilterEvent.bind(this);
|
||||
this.reFilterRequests = this.reFilterRequests.bind(this);
|
||||
|
||||
this.freetextFilterBox = $("#requests-menu-filter-freetext-text");
|
||||
this.freetextFilterBox.addEventListener("input",
|
||||
this.requestsFreetextFilterEvent, false);
|
||||
this.freetextFilterBox.addEventListener("command",
|
||||
this.requestsFreetextFilterEvent, false);
|
||||
|
||||
$("#toolbar-labels").addEventListener("click",
|
||||
this.requestsMenuSortEvent, false);
|
||||
$("#toolbar-labels").addEventListener("keydown",
|
||||
|
@ -195,18 +184,20 @@ RequestsMenuView.prototype = Heritage.extend(WidgetMethods, {
|
|||
|
||||
this.unsubscribeStore = store.subscribe(storeWatcher(
|
||||
null,
|
||||
() => store.getState().filters.types,
|
||||
(newTypes) => {
|
||||
this._activeFilters = newTypes
|
||||
() => store.getState().filters,
|
||||
(newFilters) => {
|
||||
this._activeFilters = newFilters.types
|
||||
.toSeq()
|
||||
.filter((checked, key) => checked)
|
||||
.keySeq()
|
||||
.toArray();
|
||||
this._currentFreetextFilter = newFilters.url;
|
||||
this.reFilterRequests();
|
||||
}
|
||||
));
|
||||
|
||||
Prefs.filters.forEach(type => store.dispatch(Actions.toggleFilter(type)));
|
||||
Prefs.filters.forEach(type =>
|
||||
store.dispatch(Actions.toggleFilterType(type)));
|
||||
|
||||
window.once("connected", this._onConnect.bind(this));
|
||||
},
|
||||
|
@ -268,12 +259,7 @@ RequestsMenuView.prototype = Heritage.extend(WidgetMethods, {
|
|||
this.requestsMenuSortEvent, false);
|
||||
$("#toolbar-labels").removeEventListener("keydown",
|
||||
this.requestsMenuSortKeyboardEvent, false);
|
||||
this.freetextFilterBox.removeEventListener("input",
|
||||
this.requestsFreetextFilterEvent, false);
|
||||
this.freetextFilterBox.removeEventListener("command",
|
||||
this.requestsFreetextFilterEvent, false);
|
||||
|
||||
this.userInputTimer.cancel();
|
||||
this._flushRequestsTask.disarm();
|
||||
|
||||
$("#requests-menu-reload-notice-button").removeEventListener("command",
|
||||
|
@ -615,23 +601,6 @@ RequestsMenuView.prototype = Heritage.extend(WidgetMethods, {
|
|||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Handles the timeout on the freetext filter textbox
|
||||
*/
|
||||
requestsFreetextFilterEvent: function () {
|
||||
this.userInputTimer.cancel();
|
||||
this._currentFreetextFilter = this.freetextFilterBox.value || "";
|
||||
|
||||
if (this._currentFreetextFilter.length === 0) {
|
||||
this.freetextFilterBox.removeAttribute("filled");
|
||||
} else {
|
||||
this.freetextFilterBox.setAttribute("filled", true);
|
||||
}
|
||||
|
||||
this.userInputTimer.initWithCallback(this.reFilterRequests,
|
||||
FREETEXT_FILTER_SEARCH_DELAY, Ci.nsITimer.TYPE_ONE_SHOT);
|
||||
},
|
||||
|
||||
/**
|
||||
* Refreshes the view contents with the newly selected filters
|
||||
*/
|
||||
|
|
|
@ -29,14 +29,12 @@ const REQUESTS_WITH_MEDIA_AND_FLASH_AND_WS = REQUESTS_WITH_MEDIA_AND_FLASH.conca
|
|||
]);
|
||||
|
||||
add_task(function* () {
|
||||
let Actions = require("devtools/client/netmonitor/actions/index");
|
||||
let { monitor } = yield initNetMonitor(FILTERING_URL);
|
||||
let { gStore } = monitor.panelWin;
|
||||
|
||||
function setFreetextFilter(value) {
|
||||
// Set the text and manually call all callbacks synchronously to avoid the timeout
|
||||
RequestsMenu.freetextFilterBox.value = value;
|
||||
RequestsMenu.requestsFreetextFilterEvent();
|
||||
RequestsMenu.userInputTimer.cancel();
|
||||
RequestsMenu.reFilterRequests();
|
||||
gStore.dispatch(Actions.setFilterText(value));
|
||||
}
|
||||
|
||||
info("Starting test... ");
|
||||
|
|
|
@ -28,7 +28,7 @@ add_task(function* () {
|
|||
info("Checking the image thumbnail when all items are sorted.");
|
||||
checkImageThumbnail();
|
||||
|
||||
gStore.dispatch(Actions.toggleFilter("images"));
|
||||
gStore.dispatch(Actions.toggleFilterType("images"));
|
||||
info("Checking the image thumbnail when only images are shown.");
|
||||
checkImageThumbnail();
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ add_task(function* () {
|
|||
// Predicate used to modify the frontend when setting the new pref value,
|
||||
// before trying to validate the changes.
|
||||
modifyFrontend: ($, value) => value.forEach(e =>
|
||||
getStore().dispatch(Actions.toggleFilter(e)))
|
||||
getStore().dispatch(Actions.toggleFilterType(e)))
|
||||
},
|
||||
networkDetailsWidth: {
|
||||
newValue: ~~(Math.random() * 200 + 100),
|
||||
|
|
|
@ -6,6 +6,7 @@ const ReactDOM = require("devtools/client/shared/vendor/react-dom");
|
|||
const Provider = createFactory(require("devtools/client/shared/vendor/react-redux").Provider);
|
||||
const FilterButtons = createFactory(require("./components/filter-buttons"));
|
||||
const ToggleButton = createFactory(require("./components/toggle-button"));
|
||||
const SearchBox = createFactory(require("./components/search-box"));
|
||||
const { L10N } = require("./l10n");
|
||||
|
||||
// Shortcuts
|
||||
|
@ -28,6 +29,7 @@ ToolbarView.prototype = {
|
|||
this._clearContainerNode = $("#react-clear-button-hook");
|
||||
this._filterContainerNode = $("#react-filter-buttons-hook");
|
||||
this._toggleContainerNode = $("#react-details-pane-toggle-hook");
|
||||
this._searchContainerNode = $("#react-search-box-hook");
|
||||
|
||||
// clear button
|
||||
ReactDOM.render(button({
|
||||
|
@ -45,6 +47,13 @@ ToolbarView.prototype = {
|
|||
FilterButtons()
|
||||
), this._filterContainerNode);
|
||||
|
||||
// search box
|
||||
ReactDOM.render(Provider(
|
||||
{ store },
|
||||
SearchBox()
|
||||
), this._searchContainerNode);
|
||||
|
||||
// details pane toggle button
|
||||
ReactDOM.render(Provider(
|
||||
{ store },
|
||||
ToggleButton()
|
||||
|
@ -60,7 +69,9 @@ ToolbarView.prototype = {
|
|||
ReactDOM.unmountComponentAtNode(this._clearContainerNode);
|
||||
ReactDOM.unmountComponentAtNode(this._filterContainerNode);
|
||||
ReactDOM.unmountComponentAtNode(this._toggleContainerNode);
|
||||
ReactDOM.unmountComponentAtNode(this._searchContainerNode);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
exports.ToolbarView = ToolbarView;
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
"use strict";
|
||||
|
||||
const { LocalizationHelper } = require("devtools/shared/l10n");
|
||||
const STRINGS_URI = "devtools/locale/jit-optimizations.properties";
|
||||
const STRINGS_URI = "devtools/client/locales/jit-optimizations.properties";
|
||||
const L10N = new LocalizationHelper(STRINGS_URI);
|
||||
|
||||
const {PluralForm} = require("devtools/shared/plural-form");
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
"use strict";
|
||||
|
||||
const { LocalizationHelper } = require("devtools/shared/l10n");
|
||||
const STRINGS_URI = "devtools/locale/jit-optimizations.properties";
|
||||
const STRINGS_URI = "devtools/client/locales/jit-optimizations.properties";
|
||||
const L10N = new LocalizationHelper(STRINGS_URI);
|
||||
|
||||
const { assert } = require("devtools/shared/DevToolsUtils");
|
||||
|
|
|
@ -10,8 +10,8 @@ const { PrefsHelper } = require("devtools/client/shared/prefs");
|
|||
* Localization convenience methods.
|
||||
*/
|
||||
exports.L10N = new MultiLocalizationHelper(
|
||||
"devtools/locale/markers.properties",
|
||||
"devtools/locale/performance.properties"
|
||||
"devtools/client/locales/markers.properties",
|
||||
"devtools/client/locales/performance.properties"
|
||||
);
|
||||
|
||||
/**
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
*/
|
||||
|
||||
const { LocalizationHelper } = require("devtools/shared/l10n");
|
||||
const ITCHPAD_STRINGS_URI = "devtools/locale/projecteditor.properties";
|
||||
const ITCHPAD_STRINGS_URI = "devtools/client/locales/projecteditor.properties";
|
||||
const L10N = new LocalizationHelper(ITCHPAD_STRINGS_URI);
|
||||
|
||||
function getLocalizedString(name) {
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
"use strict";
|
||||
|
||||
const { LocalizationHelper } = require("devtools/shared/l10n");
|
||||
const STRINGS_URI = "devtools/locale/responsive.properties";
|
||||
const STRINGS_URI = "devtools/client/locales/responsive.properties";
|
||||
const L10N = new LocalizationHelper(STRINGS_URI);
|
||||
|
||||
module.exports = {
|
||||
|
|
|
@ -41,7 +41,7 @@ const ROUND_RATIO = 10;
|
|||
|
||||
const INPUT_PARSER = /(\d+)[^\d]+(\d+)/;
|
||||
|
||||
const SHARED_L10N = new LocalizationHelper("devtools/locale/shared.properties");
|
||||
const SHARED_L10N = new LocalizationHelper("devtools/client/locales/shared.properties");
|
||||
|
||||
function debug(msg) {
|
||||
// dump(`RDM UI: ${msg}\n`);
|
||||
|
|
|
@ -38,7 +38,7 @@ const EVENTS = {
|
|||
};
|
||||
XPCOMUtils.defineConstant(this, "EVENTS", EVENTS);
|
||||
|
||||
const STRINGS_URI = "devtools/locale/shadereditor.properties";
|
||||
const STRINGS_URI = "devtools/client/locales/shadereditor.properties";
|
||||
const HIGHLIGHT_TINT = [1, 0, 0.25, 1]; // rgba
|
||||
const TYPING_MAX_DELAY = 500; // ms
|
||||
const SHADERS_AUTOGROW_ITEMS = 4;
|
||||
|
|
|
@ -9,8 +9,8 @@ const { getSourceNames, parseURL,
|
|||
isScratchpadScheme, getSourceMappedFile } = require("devtools/client/shared/source-utils");
|
||||
const { LocalizationHelper } = require("devtools/shared/l10n");
|
||||
|
||||
const l10n = new LocalizationHelper("devtools/locale/components.properties");
|
||||
const webl10n = new LocalizationHelper("devtools/locale/webconsole.properties");
|
||||
const l10n = new LocalizationHelper("devtools/client/locales/components.properties");
|
||||
const webl10n = new LocalizationHelper("devtools/client/locales/webconsole.properties");
|
||||
|
||||
module.exports = createClass({
|
||||
displayName: "Frame",
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
const React = require("devtools/client/shared/vendor/react");
|
||||
const Immutable = require("devtools/client/shared/vendor/immutable");
|
||||
const { LocalizationHelper } = require("devtools/shared/l10n");
|
||||
const l10n = new LocalizationHelper("devtools/locale/components.properties");
|
||||
const l10n = new LocalizationHelper("devtools/client/locales/components.properties");
|
||||
|
||||
// Shortcuts
|
||||
const { PropTypes, createClass, DOM } = React;
|
||||
|
|
|
@ -0,0 +1,114 @@
|
|||
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
|
||||
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
"use strict";
|
||||
|
||||
// Make this available to both AMD and CJS environments
|
||||
define(function (require, exports, module) {
|
||||
// ReactJS
|
||||
const React = require("devtools/client/shared/vendor/react");
|
||||
const { isGrip } = require("./rep-utils");
|
||||
|
||||
// Utils
|
||||
const nodeConstants = require("devtools/shared/dom-node-constants");
|
||||
|
||||
// Shortcuts
|
||||
const { span } = React.DOM;
|
||||
|
||||
/**
|
||||
* Renders DOM element node.
|
||||
*/
|
||||
const ElementNode = React.createClass({
|
||||
displayName: "ElementNode",
|
||||
|
||||
propTypes: {
|
||||
object: React.PropTypes.object.isRequired,
|
||||
mode: React.PropTypes.string,
|
||||
},
|
||||
|
||||
getElements: function (grip, mode) {
|
||||
let {attributes, nodeName} = grip.preview;
|
||||
const nodeNameElement = span({
|
||||
className: "tag-name theme-fg-color3"
|
||||
}, nodeName);
|
||||
|
||||
if (mode === "tiny") {
|
||||
let elements = [nodeNameElement];
|
||||
if (attributes.id) {
|
||||
elements.push(
|
||||
span({className: "attr-name theme-fg-color2"}, `#${attributes.id}`));
|
||||
}
|
||||
if (attributes.class) {
|
||||
elements.push(
|
||||
span({className: "attr-name theme-fg-color2"},
|
||||
attributes.class
|
||||
.replace(/(^\s+)|(\s+$)/g, "")
|
||||
.split(" ")
|
||||
.map(cls => `.${cls}`)
|
||||
.join("")
|
||||
)
|
||||
);
|
||||
}
|
||||
return elements;
|
||||
}
|
||||
let attributeElements = Object.keys(attributes)
|
||||
.sort(function getIdAndClassFirst(a1, a2) {
|
||||
if ([a1, a2].includes("id")) {
|
||||
return 3 * (a1 === "id" ? -1 : 1);
|
||||
}
|
||||
if ([a1, a2].includes("class")) {
|
||||
return 2 * (a1 === "class" ? -1 : 1);
|
||||
}
|
||||
|
||||
// `id` and `class` excepted,
|
||||
// we want to keep the same order that in `attributes`.
|
||||
return 0;
|
||||
})
|
||||
.reduce((arr, name, i, keys) => {
|
||||
let value = attributes[name];
|
||||
let attribute = span({},
|
||||
span({className: "attr-name theme-fg-color2"}, `${name}`),
|
||||
`="`,
|
||||
span({className: "attr-value theme-fg-color6"}, `${value}`),
|
||||
`"`
|
||||
);
|
||||
|
||||
return arr.concat([" ", attribute]);
|
||||
}, []);
|
||||
|
||||
return [
|
||||
"<",
|
||||
nodeNameElement,
|
||||
...attributeElements,
|
||||
">",
|
||||
];
|
||||
},
|
||||
|
||||
render: function () {
|
||||
let {object, mode} = this.props;
|
||||
let elements = this.getElements(object, mode);
|
||||
const baseElement = span({className: "objectBox"}, ...elements);
|
||||
|
||||
if (this.props.objectLink) {
|
||||
return this.props.objectLink({object}, baseElement);
|
||||
}
|
||||
return baseElement;
|
||||
},
|
||||
});
|
||||
|
||||
// Registration
|
||||
function supportsObject(object, type) {
|
||||
if (!isGrip(object)) {
|
||||
return false;
|
||||
}
|
||||
return object.preview && object.preview.nodeType === nodeConstants.ELEMENT_NODE;
|
||||
}
|
||||
|
||||
// Exports from this module
|
||||
exports.ElementNode = {
|
||||
rep: ElementNode,
|
||||
supportsObject: supportsObject
|
||||
};
|
||||
});
|
|
@ -70,8 +70,11 @@ define(function (require, exports, module) {
|
|||
});
|
||||
|
||||
let ownProperties = object.preview ? object.preview.ownProperties : {};
|
||||
let propertiesLength = object.preview && object.preview.ownPropertiesLength
|
||||
? object.preview.ownPropertiesLength
|
||||
: object.ownPropertyLength;
|
||||
let indexes = this.getPropIndexes(ownProperties, max, isInterestingProp);
|
||||
if (indexes.length < max && indexes.length < object.ownPropertyLength) {
|
||||
if (indexes.length < max && indexes.length < propertiesLength) {
|
||||
// There are not enough props yet. Then add uninteresting props to display them.
|
||||
indexes = indexes.concat(
|
||||
this.getPropIndexes(ownProperties, max - indexes.length, (t, value, name) => {
|
||||
|
|
|
@ -11,6 +11,7 @@ DevToolsModules(
|
|||
'comment-node.js',
|
||||
'date-time.js',
|
||||
'document.js',
|
||||
'element-node.js',
|
||||
'event.js',
|
||||
'function.js',
|
||||
'grip-array.js',
|
||||
|
|
|
@ -34,6 +34,7 @@ define(function (require, exports, module) {
|
|||
const { RegExp } = require("./regexp");
|
||||
const { StyleSheet } = require("./stylesheet");
|
||||
const { CommentNode } = require("./comment-node");
|
||||
const { ElementNode } = require("./element-node");
|
||||
const { TextNode } = require("./text-node");
|
||||
const { Window } = require("./window");
|
||||
const { ObjectWithText } = require("./object-with-text");
|
||||
|
@ -51,6 +52,7 @@ define(function (require, exports, module) {
|
|||
Event,
|
||||
DateTime,
|
||||
CommentNode,
|
||||
ElementNode,
|
||||
TextNode,
|
||||
Attribute,
|
||||
Func,
|
||||
|
|
|
@ -44,7 +44,10 @@ module.exports = createClass({
|
|||
},
|
||||
|
||||
componentWillUnmount() {
|
||||
this.shortcuts.destroy();
|
||||
if (this.shortcuts) {
|
||||
this.shortcuts.destroy();
|
||||
}
|
||||
|
||||
// Clean up an existing timeout.
|
||||
if (this.searchTimeout) {
|
||||
clearTimeout(this.searchTimeout);
|
||||
|
|
|
@ -9,7 +9,7 @@ const { DOM: dom, createClass, createFactory, PropTypes } = React;
|
|||
const { LocalizationHelper } = require("devtools/shared/l10n");
|
||||
const Frame = createFactory(require("./frame"));
|
||||
|
||||
const l10n = new LocalizationHelper("devtools/locale/webconsole.properties");
|
||||
const l10n = new LocalizationHelper("devtools/client/locales/webconsole.properties");
|
||||
|
||||
const AsyncFrame = createFactory(createClass({
|
||||
displayName: "AsyncFrame",
|
||||
|
|
|
@ -12,6 +12,7 @@ support-files =
|
|||
[test_reps_comment-node.html]
|
||||
[test_reps_date-time.html]
|
||||
[test_reps_document.html]
|
||||
[test_reps_element-node.html]
|
||||
[test_reps_event.html]
|
||||
[test_reps_function.html]
|
||||
[test_reps_grip.html]
|
||||
|
|
|
@ -0,0 +1,339 @@
|
|||
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
Test Element node rep
|
||||
-->
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Rep test - Element node</title>
|
||||
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css">
|
||||
</head>
|
||||
<body>
|
||||
<pre id="test">
|
||||
<script src="head.js" type="application/javascript;version=1.8"></script>
|
||||
<script type="application/javascript;version=1.8">
|
||||
"use strict";
|
||||
|
||||
window.onload = Task.async(function* () {
|
||||
let { Rep } = browserRequire("devtools/client/shared/components/reps/rep");
|
||||
let { ElementNode } = browserRequire("devtools/client/shared/components/reps/element-node");
|
||||
|
||||
try {
|
||||
yield testBodyNode();
|
||||
yield testDocumentElement();
|
||||
yield testNode();
|
||||
yield testNodeWithLeadingAndTrailingSpacesClassName();
|
||||
yield testNodeWithoutAttributes();
|
||||
yield testLotsOfAttributes();
|
||||
yield testSvgNode();
|
||||
yield testSvgNodeInXHTML();
|
||||
} catch (e) {
|
||||
ok(false, "Got an error: " + DevToolsUtils.safeErrorString(e));
|
||||
} finally {
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
function testBodyNode() {
|
||||
const stub = getGripStub("testBodyNode");
|
||||
const renderedRep = shallowRenderComponent(Rep, { object: stub });
|
||||
is(renderedRep.type, ElementNode.rep,
|
||||
`Rep correctly selects ${ElementNode.rep.displayName} for body node`);
|
||||
|
||||
const renderedComponent = renderComponent(ElementNode.rep, { object: stub });
|
||||
is(renderedComponent.textContent, `<body id="body-id" class="body-class">`,
|
||||
"Element node rep has expected text content for body node");
|
||||
|
||||
const tinyRenderedComponent = renderComponent(
|
||||
ElementNode.rep, { object: stub, mode: "tiny" });
|
||||
is(tinyRenderedComponent.textContent, `body#body-id.body-class`,
|
||||
"Element node rep has expected text content for body node in tiny mode");
|
||||
}
|
||||
|
||||
function testDocumentElement() {
|
||||
const stub = getGripStub("testDocumentElement");
|
||||
const renderedRep = shallowRenderComponent(Rep, { object: stub });
|
||||
is(renderedRep.type, ElementNode.rep,
|
||||
`Rep correctly selects ${ElementNode.rep.displayName} for document element node`);
|
||||
|
||||
const renderedComponent = renderComponent(ElementNode.rep, { object: stub });
|
||||
is(renderedComponent.textContent, `<html dir="ltr" lang="en-US">`,
|
||||
"Element node rep has expected text content for document element node");
|
||||
|
||||
const tinyRenderedComponent = renderComponent(
|
||||
ElementNode.rep, { object: stub, mode: "tiny" });
|
||||
is(tinyRenderedComponent.textContent, `html`,
|
||||
"Element node rep has expected text content for document element in tiny mode");
|
||||
}
|
||||
|
||||
function testNode() {
|
||||
const stub = getGripStub("testNode");
|
||||
const renderedRep = shallowRenderComponent(Rep, { object: stub });
|
||||
is(renderedRep.type, ElementNode.rep,
|
||||
`Rep correctly selects ${ElementNode.rep.displayName} for element node`);
|
||||
|
||||
const renderedComponent = renderComponent(ElementNode.rep, { object: stub });
|
||||
is(renderedComponent.textContent,
|
||||
`<input id="newtab-customize-button" class="bar baz" dir="ltr" ` +
|
||||
`title="Customize your New Tab page" value="foo" type="button">`,
|
||||
"Element node rep has expected text content for element node");
|
||||
|
||||
const tinyRenderedComponent = renderComponent(
|
||||
ElementNode.rep, { object: stub, mode: "tiny" });
|
||||
is(tinyRenderedComponent.textContent,
|
||||
`input#newtab-customize-button.bar.baz`,
|
||||
"Element node rep has expected text content for element node in tiny mode");
|
||||
}
|
||||
|
||||
function testNodeWithLeadingAndTrailingSpacesClassName() {
|
||||
const stub = getGripStub("testNodeWithLeadingAndTrailingSpacesClassName");
|
||||
const renderedRep = shallowRenderComponent(Rep, { object: stub });
|
||||
is(renderedRep.type, ElementNode.rep,
|
||||
`Rep correctly selects ${ElementNode.rep.displayName} for element node`);
|
||||
|
||||
const renderedComponent = renderComponent(ElementNode.rep, { object: stub });
|
||||
is(renderedComponent.textContent,
|
||||
`<body id="nightly-whatsnew" class=" html-ltr ">`,
|
||||
"Element node rep output element node with the class trailing spaces");
|
||||
|
||||
const tinyRenderedComponent = renderComponent(
|
||||
ElementNode.rep, { object: stub, mode: "tiny" });
|
||||
is(tinyRenderedComponent.textContent,
|
||||
`body#nightly-whatsnew.html-ltr`,
|
||||
"Element node rep does not show leading nor trailing spaces " +
|
||||
"on class attribute in tiny mode");
|
||||
}
|
||||
|
||||
function testNodeWithoutAttributes() {
|
||||
const stub = getGripStub("testNodeWithoutAttributes");
|
||||
|
||||
const renderedComponent = renderComponent(ElementNode.rep, { object: stub });
|
||||
is(renderedComponent.textContent, "<p>",
|
||||
"Element node rep has expected text content for element node without attributes");
|
||||
|
||||
const tinyRenderedComponent = renderComponent(
|
||||
ElementNode.rep, { object: stub, mode: "tiny" });
|
||||
is(tinyRenderedComponent.textContent, `p`,
|
||||
"Element node rep has expected text content for element node without attributes");
|
||||
}
|
||||
|
||||
function testLotsOfAttributes() {
|
||||
const stub = getGripStub("testLotsOfAttributes");
|
||||
|
||||
const renderedComponent = renderComponent(ElementNode.rep, { object: stub });
|
||||
is(renderedComponent.textContent,
|
||||
'<p id="lots-of-attributes" a="" b="" c="" d="" e="" f="" g="" ' +
|
||||
'h="" i="" j="" k="" l="" m="" n="">',
|
||||
"Element node rep has expected text content for node with lots of attributes");
|
||||
|
||||
const tinyRenderedComponent = renderComponent(
|
||||
ElementNode.rep, { object: stub, mode: "tiny" });
|
||||
is(tinyRenderedComponent.textContent, `p#lots-of-attributes`,
|
||||
"Element node rep has expected text content for node in tiny mode");
|
||||
}
|
||||
|
||||
function testSvgNode() {
|
||||
const stub = getGripStub("testSvgNode");
|
||||
|
||||
const renderedRep = shallowRenderComponent(Rep, { object: stub });
|
||||
is(renderedRep.type, ElementNode.rep,
|
||||
`Rep correctly selects ${ElementNode.rep.displayName} for SVG element node`);
|
||||
|
||||
const renderedComponent = renderComponent(ElementNode.rep, { object: stub });
|
||||
is(renderedComponent.textContent,
|
||||
'<clipPath id="clip" class="svg-element">',
|
||||
"Element node rep has expected text content for SVG element node");
|
||||
|
||||
const tinyRenderedComponent = renderComponent(
|
||||
ElementNode.rep, { object: stub, mode: "tiny" });
|
||||
is(tinyRenderedComponent.textContent, `clipPath#clip.svg-element`,
|
||||
"Element node rep has expected text content for SVG element node in tiny mode");
|
||||
}
|
||||
|
||||
function testSvgNodeInXHTML() {
|
||||
const stub = getGripStub("testSvgNodeInXHTML");
|
||||
|
||||
const renderedRep = shallowRenderComponent(Rep, { object: stub });
|
||||
is(renderedRep.type, ElementNode.rep,
|
||||
`Rep correctly selects ${ElementNode.rep.displayName} for XHTML SVG element node`);
|
||||
|
||||
const renderedComponent = renderComponent(ElementNode.rep, { object: stub });
|
||||
is(renderedComponent.textContent,
|
||||
'<svg:circle class="svg-element" cx="0" cy="0" r="5">',
|
||||
"Element node rep has expected text content for XHTML SVG element node");
|
||||
|
||||
const tinyRenderedComponent = renderComponent(
|
||||
ElementNode.rep, { object: stub, mode: "tiny" });
|
||||
is(tinyRenderedComponent.textContent, `svg:circle.svg-element`,
|
||||
"Element node rep has expected text content for XHTML SVG element in tiny mode");
|
||||
}
|
||||
|
||||
function getGripStub(name) {
|
||||
switch (name) {
|
||||
case "testBodyNode":
|
||||
return {
|
||||
"type": "object",
|
||||
"actor": "server1.conn1.child1/obj30",
|
||||
"class": "HTMLBodyElement",
|
||||
"ownPropertyLength": 0,
|
||||
"preview": {
|
||||
"kind": "DOMNode",
|
||||
"nodeType": 1,
|
||||
"nodeName": "body",
|
||||
"attributes": {
|
||||
"class": "body-class",
|
||||
"id": "body-id"
|
||||
},
|
||||
"attributesLength": 2
|
||||
}
|
||||
};
|
||||
case "testDocumentElement":
|
||||
return {
|
||||
"type": "object",
|
||||
"actor": "server1.conn1.child1/obj40",
|
||||
"class": "HTMLHtmlElement",
|
||||
"ownPropertyLength": 0,
|
||||
"preview": {
|
||||
"kind": "DOMNode",
|
||||
"nodeType": 1,
|
||||
"nodeName": "html",
|
||||
"attributes": {
|
||||
"dir": "ltr",
|
||||
"lang": "en-US"
|
||||
},
|
||||
"attributesLength": 2
|
||||
}
|
||||
};
|
||||
case "testNode":
|
||||
return {
|
||||
"type": "object",
|
||||
"actor": "server1.conn2.child1/obj116",
|
||||
"class": "HTMLInputElement",
|
||||
"extensible": true,
|
||||
"frozen": false,
|
||||
"sealed": false,
|
||||
"ownPropertyLength": 0,
|
||||
"preview": {
|
||||
"kind": "DOMNode",
|
||||
"nodeType": 1,
|
||||
"nodeName": "input",
|
||||
"attributes": {
|
||||
"id": "newtab-customize-button",
|
||||
"dir": "ltr",
|
||||
"title": "Customize your New Tab page",
|
||||
"class": "bar baz",
|
||||
"value": "foo",
|
||||
"type": "button"
|
||||
},
|
||||
"attributesLength": 6
|
||||
}
|
||||
};
|
||||
case "testNodeWithLeadingAndTrailingSpacesClassName":
|
||||
return {
|
||||
"type": "object",
|
||||
"actor": "server1.conn3.child1/obj59",
|
||||
"class": "HTMLBodyElement",
|
||||
"extensible": true,
|
||||
"frozen": false,
|
||||
"sealed": false,
|
||||
"ownPropertyLength": 0,
|
||||
"preview": {
|
||||
"kind": "DOMNode",
|
||||
"nodeType": 1,
|
||||
"nodeName": "body",
|
||||
"attributes": {
|
||||
"id": "nightly-whatsnew",
|
||||
"class": " html-ltr "
|
||||
},
|
||||
"attributesLength": 2
|
||||
}
|
||||
};
|
||||
case "testNodeWithoutAttributes":
|
||||
return {
|
||||
"type": "object",
|
||||
"actor": "server1.conn1.child1/obj32",
|
||||
"class": "HTMLParagraphElement",
|
||||
"ownPropertyLength": 0,
|
||||
"preview": {
|
||||
"kind": "DOMNode",
|
||||
"nodeType": 1,
|
||||
"nodeName": "p",
|
||||
"attributes": {},
|
||||
"attributesLength": 1
|
||||
}
|
||||
};
|
||||
case "testLotsOfAttributes":
|
||||
return {
|
||||
"type": "object",
|
||||
"actor": "server1.conn2.child1/obj30",
|
||||
"class": "HTMLParagraphElement",
|
||||
"ownPropertyLength": 0,
|
||||
"preview": {
|
||||
"kind": "DOMNode",
|
||||
"nodeType": 1,
|
||||
"nodeName": "p",
|
||||
"attributes": {
|
||||
"id": "lots-of-attributes",
|
||||
"a": "",
|
||||
"b": "",
|
||||
"c": "",
|
||||
"d": "",
|
||||
"e": "",
|
||||
"f": "",
|
||||
"g": "",
|
||||
"h": "",
|
||||
"i": "",
|
||||
"j": "",
|
||||
"k": "",
|
||||
"l": "",
|
||||
"m": "",
|
||||
"n": ""
|
||||
},
|
||||
"attributesLength": 15
|
||||
}
|
||||
};
|
||||
case "testSvgNode":
|
||||
return {
|
||||
"type": "object",
|
||||
"actor": "server1.conn1.child1/obj42",
|
||||
"class": "SVGClipPathElement",
|
||||
"ownPropertyLength": 0,
|
||||
"preview": {
|
||||
"kind": "DOMNode",
|
||||
"nodeType": 1,
|
||||
"nodeName": "clipPath",
|
||||
"attributes": {
|
||||
"id": "clip",
|
||||
"class": "svg-element"
|
||||
},
|
||||
"attributesLength": 0
|
||||
}
|
||||
};
|
||||
case "testSvgNodeInXHTML":
|
||||
return {
|
||||
"type": "object",
|
||||
"actor": "server1.conn3.child1/obj34",
|
||||
"class": "SVGCircleElement",
|
||||
"ownPropertyLength": 0,
|
||||
"preview": {
|
||||
"kind": "DOMNode",
|
||||
"nodeType": 1,
|
||||
"nodeName": "svg:circle",
|
||||
"attributes": {
|
||||
"class": "svg-element",
|
||||
"cx": "0",
|
||||
"cy": "0",
|
||||
"r": "5"
|
||||
},
|
||||
"attributesLength": 3
|
||||
}
|
||||
};
|
||||
}
|
||||
return null;
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
|
@ -33,8 +33,8 @@ window.onload = Task.async(function* () {
|
|||
yield testMoreThanLongMaxProps();
|
||||
yield testRecursiveArray();
|
||||
yield testPreviewLimit();
|
||||
|
||||
yield testNamedNodeMap();
|
||||
yield testNodeList();
|
||||
} catch(e) {
|
||||
ok(false, "Got an error: " + DevToolsUtils.safeErrorString(e));
|
||||
} finally {
|
||||
|
@ -243,6 +243,33 @@ window.onload = Task.async(function* () {
|
|||
testRepRenderModes(modeTests, testName, componentUnderTest, getGripStub(testName));
|
||||
}
|
||||
|
||||
function testNodeList() {
|
||||
const testName = "testNodeList";
|
||||
const defaultOutput = "NodeList [ button#btn-1.btn.btn-log, " +
|
||||
"button#btn-2.btn.btn-err, button#btn-3.btn.btn-count ]";
|
||||
|
||||
const modeTests = [
|
||||
{
|
||||
mode: undefined,
|
||||
expectedOutput: defaultOutput,
|
||||
},
|
||||
{
|
||||
mode: "tiny",
|
||||
expectedOutput: `[3]`,
|
||||
},
|
||||
{
|
||||
mode: "short",
|
||||
expectedOutput: defaultOutput,
|
||||
},
|
||||
{
|
||||
mode: "long",
|
||||
expectedOutput: defaultOutput,
|
||||
}
|
||||
];
|
||||
|
||||
testRepRenderModes(modeTests, testName, componentUnderTest, getGripStub(testName));
|
||||
}
|
||||
|
||||
function getGripStub(functionName) {
|
||||
switch (functionName) {
|
||||
case "testBasic":
|
||||
|
@ -444,6 +471,82 @@ window.onload = Task.async(function* () {
|
|||
]
|
||||
}
|
||||
};
|
||||
case "testNodeList":
|
||||
return {
|
||||
"type": "object",
|
||||
"actor": "server1.conn1.child1/obj51",
|
||||
"class": "NodeList",
|
||||
"extensible": true,
|
||||
"frozen": false,
|
||||
"sealed": false,
|
||||
"ownPropertyLength": 3,
|
||||
"preview": {
|
||||
"kind": "ArrayLike",
|
||||
"length": 3,
|
||||
"items": [
|
||||
{
|
||||
"type": "object",
|
||||
"actor": "server1.conn1.child1/obj52",
|
||||
"class": "HTMLButtonElement",
|
||||
"extensible": true,
|
||||
"frozen": false,
|
||||
"sealed": false,
|
||||
"ownPropertyLength": 0,
|
||||
"preview": {
|
||||
"kind": "DOMNode",
|
||||
"nodeType": 1,
|
||||
"nodeName": "button",
|
||||
"attributes": {
|
||||
"id": "btn-1",
|
||||
"class": "btn btn-log",
|
||||
"type": "button"
|
||||
},
|
||||
"attributesLength": 3
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"actor": "server1.conn1.child1/obj53",
|
||||
"class": "HTMLButtonElement",
|
||||
"extensible": true,
|
||||
"frozen": false,
|
||||
"sealed": false,
|
||||
"ownPropertyLength": 0,
|
||||
"preview": {
|
||||
"kind": "DOMNode",
|
||||
"nodeType": 1,
|
||||
"nodeName": "button",
|
||||
"attributes": {
|
||||
"id": "btn-2",
|
||||
"class": "btn btn-err",
|
||||
"type": "button"
|
||||
},
|
||||
"attributesLength": 3
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"actor": "server1.conn1.child1/obj54",
|
||||
"class": "HTMLButtonElement",
|
||||
"extensible": true,
|
||||
"frozen": false,
|
||||
"sealed": false,
|
||||
"ownPropertyLength": 0,
|
||||
"preview": {
|
||||
"kind": "DOMNode",
|
||||
"nodeType": 1,
|
||||
"nodeName": "button",
|
||||
"attributes": {
|
||||
"id": "btn-3",
|
||||
"class": "btn btn-count",
|
||||
"type": "button"
|
||||
},
|
||||
"attributesLength": 3
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -25,6 +25,7 @@ window.onload = Task.async(function* () {
|
|||
yield testBooleanObject();
|
||||
yield testNumberObject();
|
||||
yield testStringObject();
|
||||
yield testProxy();
|
||||
|
||||
// Test property iterator
|
||||
yield testMaxProps();
|
||||
|
@ -180,6 +181,40 @@ window.onload = Task.async(function* () {
|
|||
testRepRenderModes(modeTests, testName, componentUnderTest, getGripStub(testName));
|
||||
}
|
||||
|
||||
function testProxy() {
|
||||
// Test object: `new Proxy({a:1},[1,2,3])`
|
||||
const testName = "testProxy";
|
||||
|
||||
// Test that correct rep is chosen
|
||||
const gripStub = getGripStub(testName);
|
||||
const renderedRep = shallowRenderComponent(Rep, { object: gripStub });
|
||||
is(renderedRep.type, Grip.rep, `Rep correctly selects ${Grip.rep.displayName}`);
|
||||
|
||||
// Test rendering
|
||||
const defaultOutput = `Proxy { <target>: Object, <handler>: [3] }`;
|
||||
|
||||
const modeTests = [
|
||||
{
|
||||
mode: undefined,
|
||||
expectedOutput: defaultOutput,
|
||||
},
|
||||
{
|
||||
mode: "tiny",
|
||||
expectedOutput: `Proxy`,
|
||||
},
|
||||
{
|
||||
mode: "short",
|
||||
expectedOutput: defaultOutput,
|
||||
},
|
||||
{
|
||||
mode: "long",
|
||||
expectedOutput: defaultOutput,
|
||||
}
|
||||
];
|
||||
|
||||
testRepRenderModes(modeTests, testName, componentUnderTest, getGripStub(testName));
|
||||
}
|
||||
|
||||
function testMaxProps() {
|
||||
// Test object: `{a: "a", b: "b", c: "c"}`;
|
||||
const testName = "testMaxProps";
|
||||
|
@ -677,6 +712,54 @@ window.onload = Task.async(function* () {
|
|||
"wrappedValue": "foo"
|
||||
}
|
||||
};
|
||||
case "testProxy":
|
||||
return {
|
||||
"type": "object",
|
||||
"actor": "server1.conn1.child1/obj47",
|
||||
"class": "Proxy",
|
||||
"proxyTarget": {
|
||||
"type": "object",
|
||||
"actor": "server1.conn1.child1/obj48",
|
||||
"class": "Object",
|
||||
"ownPropertyLength": 1
|
||||
},
|
||||
"proxyHandler": {
|
||||
"type": "object",
|
||||
"actor": "server1.conn1.child1/obj49",
|
||||
"class": "Array",
|
||||
"ownPropertyLength": 4,
|
||||
"preview": {
|
||||
"kind": "ArrayLike",
|
||||
"length": 3
|
||||
}
|
||||
},
|
||||
"preview": {
|
||||
"kind": "Object",
|
||||
"ownProperties": {
|
||||
"<target>": {
|
||||
"value": {
|
||||
"type": "object",
|
||||
"actor": "server1.conn1.child1/obj48",
|
||||
"class": "Object",
|
||||
"ownPropertyLength": 1
|
||||
}
|
||||
},
|
||||
"<handler>": {
|
||||
"value": {
|
||||
"type": "object",
|
||||
"actor": "server1.conn1.child1/obj49",
|
||||
"class": "Array",
|
||||
"ownPropertyLength": 4,
|
||||
"preview": {
|
||||
"kind": "ArrayLike",
|
||||
"length": 3
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"ownPropertiesLength": 2
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -12,7 +12,7 @@ const { TargetFactory } = require("devtools/client/framework/target");
|
|||
const Telemetry = require("devtools/client/shared/telemetry");
|
||||
const {ViewHelpers} = require("devtools/client/shared/widgets/view-helpers");
|
||||
const {LocalizationHelper} = require("devtools/shared/l10n");
|
||||
const L10N = new LocalizationHelper("devtools/locale/toolbox.properties");
|
||||
const L10N = new LocalizationHelper("devtools/client/locales/toolbox.properties");
|
||||
|
||||
const NS_XHTML = "http://www.w3.org/1999/xhtml";
|
||||
const XUL_NS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
|
||||
|
|
|
@ -8,7 +8,7 @@ const { getJSON } = require("devtools/client/shared/getjson");
|
|||
|
||||
const DEVICES_URL = "devtools.devices.url";
|
||||
const { LocalizationHelper } = require("devtools/shared/l10n");
|
||||
const L10N = new LocalizationHelper("devtools/locale/device.properties");
|
||||
const L10N = new LocalizationHelper("devtools/client/locales/device.properties");
|
||||
|
||||
/* This is a catalog of common web-enabled devices and their properties,
|
||||
* intended for (mobile) device emulation.
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
const { LocalizationHelper } = require("devtools/shared/l10n");
|
||||
|
||||
const l10n = new LocalizationHelper("devtools/locale/components.properties");
|
||||
const l10n = new LocalizationHelper("devtools/client/locales/components.properties");
|
||||
const UNKNOWN_SOURCE_STRING = l10n.getStr("frame.unknownSource");
|
||||
|
||||
// Character codes used in various parsing helper functions.
|
||||
|
|
|
@ -9,7 +9,7 @@ const {CSSFilterEditorWidget} = require("devtools/client/shared/widgets/FilterWi
|
|||
const {getClientCssProperties} = require("devtools/shared/fronts/css-properties");
|
||||
|
||||
const { LocalizationHelper } = require("devtools/shared/l10n");
|
||||
const STRINGS_URI = "devtools/locale/filterwidget.properties";
|
||||
const STRINGS_URI = "devtools/client/locales/filterwidget.properties";
|
||||
const L10N = new LocalizationHelper(STRINGS_URI);
|
||||
|
||||
const TEST_URI = `data:text/html,<div id="filter-container" />`;
|
||||
|
|
|
@ -9,7 +9,7 @@ const {CSSFilterEditorWidget} = require("devtools/client/shared/widgets/FilterWi
|
|||
const {getClientCssProperties} = require("devtools/shared/fronts/css-properties");
|
||||
|
||||
const { LocalizationHelper } = require("devtools/shared/l10n");
|
||||
const STRINGS_URI = "devtools/locale/filterwidget.properties";
|
||||
const STRINGS_URI = "devtools/client/locales/filterwidget.properties";
|
||||
const L10N = new LocalizationHelper(STRINGS_URI);
|
||||
|
||||
const TEST_URI = `data:text/html,<div id="filter-container" />`;
|
||||
|
|
|
@ -9,7 +9,7 @@ const {CSSFilterEditorWidget} = require("devtools/client/shared/widgets/FilterWi
|
|||
const {getClientCssProperties} = require("devtools/shared/fronts/css-properties");
|
||||
|
||||
const { LocalizationHelper } = require("devtools/shared/l10n");
|
||||
const STRINGS_URI = "devtools/locale/filterwidget.properties";
|
||||
const STRINGS_URI = "devtools/client/locales/filterwidget.properties";
|
||||
const L10N = new LocalizationHelper(STRINGS_URI);
|
||||
|
||||
const TEST_URI = `data:text/html,<div id="filter-container" />`;
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
const Cu = Components.utils;
|
||||
|
||||
const NET_STRINGS_URI = "devtools/locale/netmonitor.properties";
|
||||
const NET_STRINGS_URI = "devtools/client/locales/netmonitor.properties";
|
||||
const SVG_NS = "http://www.w3.org/2000/svg";
|
||||
const PI = Math.PI;
|
||||
const TAU = PI * 2;
|
||||
|
|
|
@ -14,7 +14,7 @@ const { Cc, Ci } = require("chrome");
|
|||
const XHTML_NS = "http://www.w3.org/1999/xhtml";
|
||||
|
||||
const { LocalizationHelper } = require("devtools/shared/l10n");
|
||||
const STRINGS_URI = "devtools/locale/filterwidget.properties";
|
||||
const STRINGS_URI = "devtools/client/locales/filterwidget.properties";
|
||||
const L10N = new LocalizationHelper(STRINGS_URI);
|
||||
|
||||
const {cssTokenizer} = require("devtools/shared/css/parsing-utils");
|
||||
|
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче