1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 (function(backgroundUrl
) {
8 self
.chrome
= self
.chrome
|| {};
10 self
.chrome
.getBackgroundClient = function() { return new Promise(
11 function(resolve
, reject
) {
12 self
.clients
.matchAll({
13 includeUncontrolled
: true,
15 }).then(function(clients
) {
16 for (let client
of clients
) {
17 if (client
.url
== backgroundUrl
) {
22 reject("BackgroundClient ('" + backgroundUrl
+ "') does not exist.")