X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=web%2Fcore%2Fmodules%2Fbig_pipe%2Fjs%2Fbig_pipe.js;fp=web%2Fcore%2Fmodules%2Fbig_pipe%2Fjs%2Fbig_pipe.js;h=b8a25f77cc8987832ec660ba87dea22329419b83;hp=1464fdd968202268b4a23be8e1004e4d1152fc3f;hb=af6d1fb995500ae68849458ee10d66abbdcfb252;hpb=680c79a86e3ed402f263faeac92e89fb6d9edcc0 diff --git a/web/core/modules/big_pipe/js/big_pipe.js b/web/core/modules/big_pipe/js/big_pipe.js index 1464fdd96..b8a25f77c 100644 --- a/web/core/modules/big_pipe/js/big_pipe.js +++ b/web/core/modules/big_pipe/js/big_pipe.js @@ -11,11 +11,11 @@ var content = this.textContent.trim(); if (typeof drupalSettings.bigPipePlaceholderIds[placeholderId] !== 'undefined') { - if (content === '') { + var response = mapTextContentToAjaxResponse(content); + + if (response === false) { $(this).removeOnce('big-pipe'); } else { - var response = JSON.parse(content); - var ajaxObject = Drupal.ajax({ url: '', base: false, @@ -28,6 +28,18 @@ } } + function mapTextContentToAjaxResponse(content) { + if (content === '') { + return false; + } + + try { + return JSON.parse(content); + } catch (e) { + return false; + } + } + function bigPipeProcessDocument(context) { if (!context.querySelector('script[data-big-pipe-event="start"]')) { return false;