michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: const TEST_MSG = "ContentSearchTest"; michael@0: const SERVICE_EVENT_TYPE = "ContentSearchService"; michael@0: const CLIENT_EVENT_TYPE = "ContentSearchClient"; michael@0: michael@0: // Forward events from the in-content service to the test. michael@0: content.addEventListener(SERVICE_EVENT_TYPE, event => { michael@0: sendAsyncMessage(TEST_MSG, event.detail); michael@0: }); michael@0: michael@0: // Forward messages from the test to the in-content service. michael@0: addMessageListener(TEST_MSG, msg => { michael@0: content.dispatchEvent( michael@0: new content.CustomEvent(CLIENT_EVENT_TYPE, { michael@0: detail: msg.data, michael@0: }) michael@0: ); michael@0: });