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

Unified Diff: third_party/WebKit/LayoutTests/http/tests/budget/resources/instrumentation-service-worker.js

Issue 2571453002: Expose the BudgetService interface to Workers. (Closed)
Patch Set: Created 4 years 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: third_party/WebKit/LayoutTests/http/tests/budget/resources/instrumentation-service-worker.js
diff --git a/third_party/WebKit/LayoutTests/http/tests/budget/resources/instrumentation-service-worker.js b/third_party/WebKit/LayoutTests/http/tests/budget/resources/instrumentation-service-worker.js
index faafdc685c4428e47e44dfb41d3b86e2a2fb6836..c68890f792a8404dd35953e56bcad710f3831432 100644
--- a/third_party/WebKit/LayoutTests/http/tests/budget/resources/instrumentation-service-worker.js
+++ b/third_party/WebKit/LayoutTests/http/tests/budget/resources/instrumentation-service-worker.js
@@ -46,6 +46,26 @@ self.addEventListener('message', function(workerEvent) {
}).catch(makeErrorHandler(event.data.command));
break;
+ case 'checkInterfaces':
+ var success = false;
+ var message = "";
+ try {
+ if ('BudgetService' in self &&
+ WorkerNavigator.prototype.hasOwnProperty('budget') &&
+ BudgetService.prototype.hasOwnProperty('getCost') &&
+ BudgetService.prototype.hasOwnProperty('getBudget') &&
+ BudgetService.prototype.hasOwnProperty('reserve')
+ )
+ success = true;
+ } catch(err) {
+ message = err.message;
+ }
Peter Beverloo 2016/12/12 14:28:43 What exception do you expect to be thrown here? I
harkness 2016/12/12 16:00:34 Updated the code to remove the if statement, but l
+ port.postMessage({
+ command: event.data.command,
+ success: success,
+ message: message});
+ break;
+
default:
port.postMessage({
command: 'error',

Powered by Google App Engine
This is Rietveld 408576698