Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2047)

Unified Diff: Source/devtools/front_end/resources/ServiceWorkersView.js

Issue 1079013002: Add "emulate push event" button to ServiceWorkersView in DevTools [2/2 blink] (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: s/dispatchPushEvent/deliverPushMessage/ Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/devtools/front_end/resources/ServiceWorkersView.js
diff --git a/Source/devtools/front_end/resources/ServiceWorkersView.js b/Source/devtools/front_end/resources/ServiceWorkersView.js
index ffa00f377d40690fd2c467abcc5bb76aeeb8f483..9314818939535847ec6a9bc2a8f0b142707160e3 100644
--- a/Source/devtools/front_end/resources/ServiceWorkersView.js
+++ b/Source/devtools/front_end/resources/ServiceWorkersView.js
@@ -271,6 +271,10 @@ WebInspector.SWRegistrationElement = function(manager, registration)
this._deleteButton = headerNode.createChild("button", "service-workers-button service-workers-delete-button");
this._deleteButton.addEventListener("click", this._deleteButtonClicked.bind(this), false);
this._deleteButton.title = WebInspector.UIString("Delete");
+ this._pushButton = headerNode.createChild("button", "service-workers-button service-workers-push-button");
+ this._pushButton.addEventListener("click", this._pushButtonClicked.bind(this), false);
+ this._pushButton.title = WebInspector.UIString("Emulate push event");
+ this._pushButton.disabled = true
this._childrenListNode = this._element.createChild("ol");
this._updateRegistration(registration);
}
@@ -283,7 +287,7 @@ WebInspector.SWRegistrationElement.prototype = {
{
this._registration = registration;
this._titleNode.textContent = WebInspector.UIString(registration.isDeleted ? "Scope: %s - deleted" : "Scope: %s", registration.scopeURL.asParsedURL().path);
- this._deleteButton.classList.toggle("hidden", registration.isDeleted);
+ this._deleteButton.disabled = !!registration.isDeleted;
this._updateVersionList();
},
@@ -295,6 +299,9 @@ WebInspector.SWRegistrationElement.prototype = {
versions = versions.filter(function(version) {
return !version.isStoppedAndRedundant() || version.errorMessages.length;
});
+ var activeVersions = versions.filter(function(version) { return version.isActivating() || version.isActivated(); });
+ this._pushButton.disabled = !activeVersions.length || !!this._registration.isDeleted;
+
tableElement.appendChild(this._createVersionModeRow(
versions.filter(function(version) { return version.isNew() || version.isInstalling(); }),
"installing",
@@ -304,7 +311,7 @@ WebInspector.SWRegistrationElement.prototype = {
"waiting",
WebInspector.UIString("waiting")));
tableElement.appendChild(this._createVersionModeRow(
- versions.filter(function(version) { return version.isActivating() || version.isActivated(); }),
+ activeVersions,
"active",
WebInspector.UIString("active")));
tableElement.appendChild(this._createVersionModeRow(
@@ -398,6 +405,15 @@ WebInspector.SWRegistrationElement.prototype = {
/**
* @param {!Event} event
*/
+ _pushButtonClicked: function(event)
+ {
+ var data = "Test push message from DevTools."
+ this._manager.deliverPushMessage(this._registration.id, data);
+ },
+
+ /**
+ * @param {!Event} event
+ */
_startButtonClicked: function(event)
{
this._manager.startWorker(this._registration.scopeURL);
« no previous file with comments | « Source/devtools/front_end/Images/notifications.svg ('k') | Source/devtools/front_end/resources/serviceWorkersView.css » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698