Commit a7f495e0 authored by eroman's avatar eroman Committed by Commit bot

Delete chrome://net-internals/#export

This was deprecated since M58 (having been replaced by
chrome://net-export/)

If users still have bookmarks to #export, they will now get a dialog
prompt asking them if they want to be redirected to
chrome://net-export/

BUG=678386
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:closure_compilation

Review-Url: https://codereview.chromium.org/2856223006
Cr-Commit-Position: refs/heads/master@{#469574}
parent 2233a90a
......@@ -30,13 +30,6 @@ var CaptureView = (function() {
$(CaptureView.RESET_BUTTON_ID).onclick =
this.onResetButtonClicked_.bind(this);
if (byteLoggingCheckbox.checked) {
// The code to display a warning on ExportView relies on bytelogging
// being off by default. If this ever changes, the code will need to
// be updated.
throw 'Not expecting byte logging to be enabled!';
}
new MouseOverHelp(
CaptureView.LIMIT_HELP_ID, CaptureView.LIMIT_HELP_HOVER_ID);
......@@ -87,16 +80,6 @@ var CaptureView = (function() {
if (byteLoggingCheckbox.checked) {
g_browser.setCaptureMode('IncludeSocketBytes');
// Once we enable byte logging, all bets are off on what gets captured.
// Have the export view warn that the "strip cookies" option is
// ineffective from this point on.
//
// In theory we could clear this warning after unchecking the box and
// then deleting all the events which had been captured. We don't
// currently do that; if you want the warning to go away, will need to
// reload.
ExportView.getInstance().showPrivacyWarning();
} else {
g_browser.setCaptureMode('IncludeCookiesAndCredentials');
}
......
<style>
#export-view-privacy-warning {
border: 1px solid rgb(238, 0, 0);
color: rgb(238, 0, 0);
padding: 5px;
}
#export-view-save-log-file {
font-size: 100%;
font-weight: bold;
}
#export-view-user-comments {
max-width: 100%;
}
</style>
<div id=export-view-tab-content class=content-box>
<div id=export-view-deprecated-notice>
<b>WARNING</b>: chrome://net-internals is being deprecated for exporting log files (<a href="https://bugs.chromium.org/p/chromium/issues/detail?id=678386" target="_blank">crbug.com/678386</a>).
<p>
Use <a href="chrome://net-export" target="_blank">chrome://net-export</a> instead.
</p>
<button id=export-view-show-deprecated-ui>Show deprecated UI</button>
</div>
<div style="display: none" id=export-view-ui-deprecated>
<input id=export-view-privacy-stripping-checkbox type=checkbox checked=yes>
<label for=export-view-privacy-stripping-checkbox>
Strip private information (cookies and credentials).
</label>
<div id=export-view-privacy-warning style="display:none">
<b>WARNING</b>: Events were captured while full byte logging was enabled.
This means the dump may contain private information.
</div>
<div style='margin-top:10px; margin-bottom: 5px'>
<textarea cols=50 rows=5 placeholder="Explain what went wrong here. (These notes will be included in the dump file. Be sure to mention the specific URLs, so investigators know what to look for!)" id=export-view-user-comments></textarea>
</div>
<button id=export-view-save-log-file>Save to file</button>
<pre id=export-view-save-status-text></pre>
<div style='margin-top: 10px; margin-left: 10px;'>
<a href="https://sites.google.com/a/chromium.org/dev/for-testers/providing-network-details" target="_blank">
How to provide data for bug reports
</a>
</div>
</div>
<a style="display: none" id=export-view-download-anchor download="net-internals-log.json"></a>
</div>
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
/**
* This view displays options for exporting the captured data.
*/
var ExportView = (function() {
'use strict';
// We inherit from DivView.
var superClass = DivView;
/**
* @constructor
*/
function ExportView() {
assertFirstConstructorCall(ExportView);
// Call superclass's constructor.
superClass.call(this, ExportView.MAIN_BOX_ID);
this.deprecatedNoticeUI_ = $(ExportView.DEPRECATED_NOTICE_UI_ID);
this.showDeprecatedUIButton_ = $(ExportView.SHOW_DEPRECATED_UI_BUTTON_ID);
this.showDeprecatedUIButton_.onclick = this.onShowDeprecatedUI_.bind(this);
this.deprecatedExportUI_ = $(ExportView.DEPRECATED_EXPORT_UI_ID);
var privacyStrippingCheckbox = $(ExportView.PRIVACY_STRIPPING_CHECKBOX_ID);
privacyStrippingCheckbox.onclick =
this.onSetPrivacyStripping_.bind(this, privacyStrippingCheckbox);
this.saveFileButton_ = $(ExportView.SAVE_FILE_BUTTON_ID);
this.saveFileButton_.onclick = this.onSaveFile_.bind(this);
this.saveStatusText_ = $(ExportView.SAVE_STATUS_TEXT_ID);
this.isSaving_ = false;
this.userCommentsTextArea_ = $(ExportView.USER_COMMENTS_TEXT_AREA_ID);
this.updateSaveFileButton_();
this.userCommentsTextArea_.onkeyup = this.onUserCommentsUpdated_.bind(this);
// Track blob for previous log dump so it can be revoked when a new dump is
// saved.
this.lastBlobURL_ = null;
// Cached copy of the last loaded log dump, for use when exporting.
this.loadedLogDump_ = null;
}
ExportView.TAB_ID = 'tab-handle-export';
ExportView.TAB_NAME = 'Export';
ExportView.TAB_HASH = '#export';
// IDs for special HTML elements in export_view.html
ExportView.DEPRECATED_NOTICE_UI_ID = 'export-view-deprecated-notice';
ExportView.SHOW_DEPRECATED_UI_BUTTON_ID = 'export-view-show-deprecated-ui';
ExportView.DEPRECATED_EXPORT_UI_ID = 'export-view-ui-deprecated';
ExportView.MAIN_BOX_ID = 'export-view-tab-content';
ExportView.DOWNLOAD_ANCHOR_ID = 'export-view-download-anchor';
ExportView.SAVE_FILE_BUTTON_ID = 'export-view-save-log-file';
ExportView.SAVE_STATUS_TEXT_ID = 'export-view-save-status-text';
ExportView.PRIVACY_STRIPPING_CHECKBOX_ID =
'export-view-privacy-stripping-checkbox';
ExportView.USER_COMMENTS_TEXT_AREA_ID = 'export-view-user-comments';
ExportView.PRIVACY_WARNING_ID = 'export-view-privacy-warning';
cr.addSingletonGetter(ExportView);
ExportView.prototype = {
// Inherit the superclass's methods.
__proto__: superClass.prototype,
/**
* Hides the export-view deprecation warning message and shows the
* deprecated export-view UI.
*/
onShowDeprecatedUI_: function() {
setNodeDisplay(this.deprecatedNoticeUI_, false);
setNodeDisplay(this.deprecatedExportUI_, true);
},
/**
* Depending on the value of the checkbox, enables or disables stripping
* cookies and passwords from log dumps and displayed events.
*/
onSetPrivacyStripping_: function(privacyStrippingCheckbox) {
SourceTracker.getInstance().setPrivacyStripping(
privacyStrippingCheckbox.checked);
},
/**
* When loading a log dump, cache it for future export and continue showing
* the ExportView.
*/
onLoadLogFinish: function(polledData, tabData, logDump) {
this.loadedLogDump_ = logDump;
this.setUserComments_(logDump.userComments);
return true;
},
/**
* Sets the save to file status text, displayed below the save to file
* button, to |text|. Also enables or disables the save button based on the
* value of |isSaving|, which must be true if the save process is still
* ongoing, and false when the operation has stopped, regardless of success
* of failure.
*/
setSaveFileStatus: function(text, isSaving) {
this.isSaving_ = isSaving;
this.updateSaveFileButton_();
this.saveStatusText_.textContent = text;
},
updateSaveFileButton_: function() {
this.saveFileButton_.disabled =
this.userCommentsTextArea_.value == '' || this.isSaving_;
},
showPrivacyWarning: function() {
setNodeDisplay($(ExportView.PRIVACY_WARNING_ID), true);
$(ExportView.PRIVACY_STRIPPING_CHECKBOX_ID).checked = false;
$(ExportView.PRIVACY_STRIPPING_CHECKBOX_ID).disabled = true;
// Updating the checkbox doesn't actually disable privacy stripping, since
// the onclick function will not be called.
this.onSetPrivacyStripping_($(ExportView.PRIVACY_STRIPPING_CHECKBOX_ID));
},
/**
* If not already busy saving a log dump, triggers asynchronous
* generation of log dump and starts waiting for it to complete.
*/
onSaveFile_: function() {
if (this.saveFileButton_.disabled)
return;
// Clean up previous blob, if any, to reduce resource usage.
if (this.lastBlobURL_) {
window.URL.revokeObjectURL(this.lastBlobURL_);
this.lastBlobURL_ = null;
}
this.createLogDump_(this.onLogDumpCreated_.bind(this));
},
/**
* Creates a log dump, and either synchronously or asynchronously calls
* |callback| if it succeeds. Separate from onSaveFile_ for unit tests.
*/
createLogDump_: function(callback) {
// Get an explanation for the dump file (this is mandatory!)
var userComments = this.userCommentsTextArea_.value;
this.setSaveFileStatus('Preparing data...', true);
var privacyStripping = SourceTracker.getInstance().getPrivacyStripping();
// If we have a cached log dump, update it synchronously.
if (this.loadedLogDump_) {
var dumpText = log_util.createUpdatedLogDump(
userComments, this.loadedLogDump_, privacyStripping);
callback(dumpText);
return;
}
// Otherwise, poll information from the browser before creating one.
log_util.createLogDumpAsync(userComments, callback, privacyStripping);
},
/**
* Sets the user comments.
*/
setUserComments_: function(userComments) {
this.userCommentsTextArea_.value = userComments;
this.onUserCommentsUpdated_();
},
/**
* User comments are updated.
*/
onUserCommentsUpdated_: function() {
this.updateSaveFileButton_();
},
/**
* Creates a blob url and starts downloading it.
*/
onLogDumpCreated_: function(dumpText) {
var textBlob = new Blob([dumpText], {type: 'octet/stream'});
this.lastBlobURL_ = window.URL.createObjectURL(textBlob);
// Update the anchor tag and simulate a click on it to start the
// download.
var downloadAnchor = $(ExportView.DOWNLOAD_ANCHOR_ID);
downloadAnchor.href = this.lastBlobURL_;
downloadAnchor.click();
this.setSaveFileStatus('Dump successful', false);
}
};
return ExportView;
})();
......@@ -40,7 +40,6 @@ found in the LICENSE file.
<include src="prerender_view.html">
<include src="modules_view.html">
<include src="import_view.html">
<include src="export_view.html">
<include src="capture_view.html">
<include src="hsts_view.html">
<include src="events_view.html">
......
......@@ -9,7 +9,6 @@
// <include src="tab_switcher_view.js">
// <include src="import_view.js">
// <include src="capture_view.js">
// <include src="export_view.js">
// <include src="http_cache_view.js">
// <include src="hsts_view.js">
// <include src="browser_bridge.js">
......
......@@ -53,24 +53,6 @@ log_util = (function() {
return logDump;
}
/**
* Returns a new log dump created using the polled data and date from the
* |oldLogDump|. The other parts of the log dump come from current
* net-internals state.
*/
function createUpdatedLogDump(userComments, oldLogDump, privacyStripping) {
var numericDate = null;
if (oldLogDump.constants.clientInfo &&
oldLogDump.constants.clientInfo.numericDate) {
numericDate = oldLogDump.constants.clientInfo.numericDate;
}
var logDump = createLogDump(
userComments, Constants,
EventsTracker.getInstance().getAllCapturedEvents(),
oldLogDump.polledData, getTabData_(), numericDate, privacyStripping);
return JSON.stringify(logDump);
}
/**
* Creates a full log dump using |polledData| and the return value of each
* tab's saveState function and passes it to |callback|.
......@@ -290,7 +272,6 @@ log_util = (function() {
// Exports.
return {
createUpdatedLogDump: createUpdatedLogDump,
createLogDumpAsync: createLogDumpAsync,
loadLogFile: loadLogFile
};
......
......@@ -129,7 +129,6 @@ var MainView = (function() {
// bar to indicate we're no longer capturing events. Also disable
// hiding cookies, so if the log dump has them, they'll be displayed.
this.topBarView_.switchToSubView('loaded').setFileName(opt_fileName);
$(ExportView.PRIVACY_STRIPPING_CHECKBOX_ID).checked = false;
SourceTracker.getInstance().setPrivacyStripping(false);
} else {
// Otherwise, the "Stop Capturing" button was presumably pressed.
......@@ -181,7 +180,6 @@ var MainView = (function() {
// the running OS should be created, so they can load log dumps from other
// OSes.
addTab(CaptureView);
addTab(ExportView);
addTab(ImportView);
addTab(ProxyView);
addTab(EventsView);
......@@ -228,9 +226,29 @@ var MainView = (function() {
if (!parsed)
return;
if (parsed.tabHash == "#export") {
// The #export tab was removed in M60, after having been
// deprecated since M58. In case anyone *still* has URLs
// bookmarked to this, inform them and redirect.
// TODO(eroman): Delete this around M62.
parsed.tabHash = undefined;
// Done on a setTimeout so it doesn't block the initial
// page load (confirm() is synchronous).
setTimeout(() => {
var navigateToNetExport = confirm(
"#export was removed\nDo you want to navigate to " +
"chrome://net-export/ instead?");
if (navigateToNetExport) {
window.location.href = "chrome://net-export";
return;
}
});
}
if (!parsed.tabHash) {
// Default to the export tab.
parsed.tabHash = ExportView.TAB_HASH;
// Default to the events tab.
parsed.tabHash = EventsView.TAB_HASH;
}
var tabId = this.hashToTabId_[parsed.tabHash];
......
......@@ -16,8 +16,7 @@ GEN_INCLUDE(['net_internals_test.js']);
/**
* A Task that creates a log dump and then loads it.
* @param {string} userComments User comments to copy to the ExportsView before
* creating the log dump.
* @param {string} userComments User comments to use for the generated log.
* @extends {NetInternalsTest.Task}
*/
function CreateAndLoadLogTask(userComments) {
......@@ -32,16 +31,13 @@ CreateAndLoadLogTask.prototype = {
__proto__: NetInternalsTest.Task.prototype,
/**
* Start creating the log dump. Use ExportView's function as it supports
* both creating completely new logs and using existing logs to create new
* ones, depending on whether or not we're currently viewing a log.
* Starts creating the log dump.
*/
start: function() {
this.initialPrivacyStripping_ =
SourceTracker.getInstance().getPrivacyStripping();
$(ExportView.USER_COMMENTS_TEXT_AREA_ID).value = this.userComments_;
ExportView.getInstance().createLogDump_(this.onLogDumpCreated.bind(this),
true);
log_util.createLogDumpAsync(this.userComments_,
this.onLogDumpCreated.bind(this), true);
},
/**
......@@ -57,8 +53,6 @@ CreateAndLoadLogTask.prototype = {
NetInternalsTest.expectStatusViewNodeVisible(LoadedStatusView.MAIN_BOX_ID);
expectEquals(this.userComments_,
$(ExportView.USER_COMMENTS_TEXT_AREA_ID).value);
// Make sure the DIV on the import tab containing the comments is visible
// before checking the displayed text.
expectTrue(NetInternalsTest.nodeIsVisible($(ImportView.LOADED_DIV_ID)));
......@@ -164,7 +158,6 @@ function checkViewsAfterLogLoaded() {
expectTrue(g_browser.isDisabled());
var tabVisibilityState = {
capture: false,
export: true,
import: true,
proxy: true,
events: true,
......@@ -193,7 +186,6 @@ function checkViewsAfterNetLogFileLoaded() {
expectTrue(g_browser.isDisabled());
var tabVisibilityState = {
capture: false,
export: true,
import: true,
proxy: false,
events: true,
......@@ -270,21 +262,6 @@ TEST_F('NetInternalsTest', 'netInternalsLogUtilImportNetLogFileTruncated',
taskQueue.run(true);
});
/**
* Exports a log dump to a string and loads it, and then repeats, making sure
* we can export loaded logs.
*/
TEST_F('NetInternalsTest',
'netInternalsLogUtilExportImportExportImport',
function() {
var taskQueue = new NetInternalsTest.TaskQueue(true);
taskQueue.addTask(new CreateAndLoadLogTask('Random comment on the weather.'));
taskQueue.addFunctionTask(checkViewsAfterLogLoaded);
taskQueue.addTask(new CreateAndLoadLogTask('Detailed explanation.'));
taskQueue.addFunctionTask(checkViewsAfterLogLoaded);
taskQueue.run(true);
});
/**
* Checks pressing the stop capturing button.
*/
......@@ -299,35 +276,11 @@ TEST_F('NetInternalsTest', 'netInternalsLogUtilStopCapturing', function() {
null, HaltedStatusView.MAIN_BOX_ID));
taskQueue.addFunctionTask(checkViewsAfterLogLoaded);
taskQueue.addFunctionTask(checkPrivacyStripping.bind(null, true));
taskQueue.addFunctionTask(checkActiveView.bind(null, ExportView.TAB_ID));
taskQueue.addFunctionTask(checkActiveView.bind(null, EventsView.TAB_ID));
taskQueue.run();
// Simulate a click on the stop capturing button
$(CaptureView.STOP_BUTTON_ID).click();
});
/**
* Switches to stop capturing mode, then exports and imports a log dump.
*/
TEST_F('NetInternalsTest',
'netInternalsLogUtilStopCapturingExportImport',
function() {
var taskQueue = new NetInternalsTest.TaskQueue(true);
// Switching to stop capturing mode will load a log dump, which will update
// the constants.
taskQueue.addTask(new WaitForConstantsTask());
taskQueue.addFunctionTask(
NetInternalsTest.expectStatusViewNodeVisible.bind(
null, HaltedStatusView.MAIN_BOX_ID));
taskQueue.addFunctionTask(checkViewsAfterLogLoaded);
taskQueue.addFunctionTask(checkPrivacyStripping.bind(null, true));
taskQueue.addTask(new CreateAndLoadLogTask('Detailed explanation.'));
taskQueue.addFunctionTask(checkViewsAfterLogLoaded);
taskQueue.run();
// Simulate clicking the stop button.
$(CaptureView.STOP_BUTTON_ID).click();
});
})(); // Anonymous namespace
......@@ -22,7 +22,6 @@ TEST_F('NetInternalsTest', 'netInternalsTourTabs', function() {
// Expected visibility state of each tab.
var tabVisibilityState = {
capture: true,
export: true,
import: true,
proxy: true,
events: true,
......
......@@ -64,9 +64,6 @@ var NetInternalsTest = (function() {
// If it was actual text it'd be too low-contrast, but a square is fine.
this.accessibilityAuditConfig.ignoreSelectors(
'lowContrastElements', '#timeline-view-selection-ul label');
// Suppress this error; the black-on-gray button is readable.
this.accessibilityAuditConfig.ignoreSelectors(
'lowContrastElements', '#export-view-save-log-file');
// False positive because the background color highlights and then
// fades out with a transition when there's an error.
this.accessibilityAuditConfig.ignoreSelectors(
......@@ -82,7 +79,6 @@ var NetInternalsTest = (function() {
'focusableElementNotVisibleAndNotAriaHidden');
var controlsWithoutLabelSelectors = [
'#export-view-user-comments',
'#hsts-view-add-input',
'#hsts-view-delete-input',
'#hsts-view-query-input',
......@@ -304,7 +300,6 @@ var NetInternalsTest = (function() {
*/
var hashToTabIdMap = {
capture: CaptureView.TAB_ID,
export: ExportView.TAB_ID,
import: ImportView.TAB_ID,
proxy: ProxyView.TAB_ID,
events: EventsView.TAB_ID,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment