_setViewportSize = function _setViewportSize(size) {
    var _this = this;

    var retryNo = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;

    /**
     * get window size
     */
    return this.windowHandleSize().then(function (windowHandleSize) {
        /**
         * get viewport size
         */
        return _this.execute(_getViewportSize2.default).then(function (viewportSize) {
            var widthDiff = windowHandleSize.value.width - viewportSize.value.screenWidth;
            var heightDiff = windowHandleSize.value.height - viewportSize.value.screenHeight;

            /**
             * change window size with indent
             */
            return _this.windowHandleSize({
                width: size.width + widthDiff,
                height: size.height + heightDiff
            });
        }).execute(_getViewportSize2.default).then(function (res) {
            /**
             * if viewport size not equals desired size, execute process again
             */
            if (retryNo < MAX_TRIES && (res.value.screenWidth !== size.width || res.value.screenHeight !== size.height)) {
                return _setViewportSize.call(_this, size, ++retryNo);
            }
        });
    });
}
to set viewport size properly we need to execute the process multiple times
since the difference between the inner and outer size changes when browser
switch between fullscreen modes or visibility of scrollbar