function resolveItem(extension)
        {
            var descriptor = extension.descriptor();
            if (!descriptor.className)
                return Promise.resolve(new WebInspector.StatusBarButton(WebInspector.UIString(descriptor["title"]), descriptor["elementClass"])).then(attachHandler);
            return extension.instancePromise().then(fetchItemFromProvider).then(attachHandler);

            /**
             * @param {!Object} provider
             */
            function fetchItemFromProvider(provider)
            {
                return /** @type {!WebInspector.StatusBarItem.Provider} */ (provider).item();
            }

            /**
             * @param {?WebInspector.StatusBarItem} item
             * @return {?WebInspector.StatusBarItem} item
             */
            function attachHandler(item)
            {
                if (extension.descriptor()["actionId"] && item)
                    item.addEventListener("click", handler);
                return item;
            }

            function handler()
            {
                WebInspector.actionRegistry.execute(extension.descriptor()["actionId"]);
            }
        }
@param {!Runtime.Extension} extension
@return {!Promise.<?WebInspector.StatusBarItem>}