After today's superfish 8.x-1.0-rc4, console is reporting this error:

js_g9sCTrS8_9zKq-acteZnA8oYtePDNPzPOAIiqsICcSA_-CAEkrQ3BGSCvVfs4VarFZ92T3gUwk_LtIIKc53-NIs.js:9 Uncaught ReferenceError: jQuery is not defined(…)(anonymous function) @ js_g9sCTrS8_9zKq-acteZnA8oYtePDNPzPOAIiqsICcSA_-CAEkrQ3BGSCvVfs4VarFZ92T3gUwk_LtIIKc53-NIs.js:9

Line 9 is:

else if(a=='useragent_predefined'&&navigator.userAgent.match(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od|ad)|iris|kindle|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i)){s(i)}};return this}})(jQuery);

I have to disable AdvAgg aggregation so the site becomes functional again.

No superfish settings were changed, nor superfish library has been update since rc3, so I'm pretty sure this is a regression from rc4 alone.

Please, let me know if you need more information.

CommentFileSizeAuthor
#13 2825949-9.patch8.04 KBduaelfr

Comments

denydias created an issue. See original summary.

denydias’s picture

Issue summary: View changes
denydias’s picture

I've just downgraded to superfish 8.x-1.0-rc3 and all is back to normal.

geek.geek’s picture

Hi,

Maybe you need to do a rebuild? e.g. http://example.com/core/rebuild.php

denydias’s picture

Hi, @geek.geek! Tks for reply.

I ran drush cr in both cases, either upgrading to rc4 and downgrading to rc3. So a rebuild may not be the case here.

Updated 2016/11/16: for some odd reason (oh, Drupal's bureaucracy!) I'm not able to publish new comments on the issue I've created myself. So what comes bellow goes into this update.

After further investigation, I could determine the cause of this behavior with rc4.

Please see the diff bellow.

--- sf_8.x-1.0-rc3.html      2016-11-16 15:10:26.135100539 -0200
+++ sf_8.x-1.0-rc4.html       2016-11-16 15:10:42.297100406 -0200
@@ -1,3 +1,5 @@
+<script src="/sites/all/libraries/superfish/sfsmallscreen.js?ogqur2"></script>
+<script src="/sites/all/libraries/superfish/superfish.js?v=8.2.2"></script>
 <script src="/core/assets/vendor/domready/ready.min.js?v=1.0.8"></script>
 <script src="/core/assets/vendor/jquery/jquery.min.js?v=2.2.3"></script>
 <script src="/core/assets/vendor/jquery-once/jquery.once.min.js?v=2.1.1"></script>
@@ -19,8 +21,6 @@
 <script src="/core/assets/vendor/jquery.ui/ui/effect-min.js?v=1.11.4"></script>
 <script src="/core/misc/progress.js?v=8.2.2"></script>
 <script src="/core/misc/ajax.js?v=8.2.2"></script>
-<script src="http://localhost:8080/sites/all/libraries/superfish/superfish.js"></script>
-<script src="http://localhost:8080/sites/all/libraries/superfish/sfsmallscreen.js"></script>
 <script src="/modules/superfish/js/superfish.js?v=2.0"></script>
 <script src="/core/assets/vendor/jquery.ui/ui/button-min.js?v=1.11.4"></script>
 <script src="/core/assets/vendor/jquery.ui/ui/mouse-min.js?v=1.11.4"></script>

The cause for the OP is quite clear now. It boils down to this commit (#2825179).

To reproduce the above behaviour, some preparation is required:

  1. Make sure the following settings in sites/default/settings.local.php reads like bellow:
    /**
     * Enable CSS and JS aggregation.
     */
    $config['system.performance']['css']['preprocess'] = FALSE;
    $config['system.performance']['js']['preprocess'] = FALSE;
  2. Install and enable AdvAgg module.
  3. Go to admin/config/development/performance/advagg, check 'Enable advanced aggregation' and save.

Until RC3, the library detection condition was working in some extent, even tough it was bugged. The RC4 fix properly rewrites the library path, but doing so it also messes with the core grouping logic in some way. CSS/JS aggregation modules (like AdvAgg) counts on that to queue files in an ordered, working fashion. As shown above, SF libraries are being loaded before jQuery ones, which obviously leads to errors, as there is no jQuery when SF libraries are parsed by the browser.

Which I don't know ATM is if this is an AdvAgg bug or SF's itself. I'm biased towards SF as this just happened after RC4 and AdvAgg have never behaved this way before.

Is there any workaround an operator could try in order to fix that ordering issue without the need to wait for a SF patch?

denydias’s picture

Edited on 2016/11/17: please see #5.

denydias’s picture

Edited on 2016/11/17: please see #5.

  • mehrpadin committed 0700de5 on 8.x-1.x
    Issue #2825949: Removed the superfish.libraries.yml in favor of...
duaelfr’s picture

Status: Active » Fixed

This issue has been fixed.
(I'm just cleaning the issue queue)

denydias’s picture

@mehrpadin and @DuaelFr,

The commit 0700de5 did the job for RC5. By using the same setup as per #5, the scripts order now output:

<script src="/core/assets/vendor/domready/ready.min.js?v=1.0.8"></script>
<script src="/core/assets/vendor/jquery/jquery.min.js?v=2.2.3"></script>
<script src="/core/assets/vendor/jquery-once/jquery.once.min.js?v=2.1.1"></script>
...
<script src="/sites/all/libraries/superfish/superfish.js?oh29wk"></script>
<script src="/sites/all/libraries/superfish/jquery.hoverIntent.minified.js?oh29wk"></script>
<script src="/sites/all/libraries/superfish/sfsmallscreen.js?oh29wk"></script>
<script src="/modules/superfish/js/superfish.js?v=2.0"></script>
...

This is different from RC3, but the loading order correctly respects SF's dependencies while their paths looks sane.

Well done, guys!

geek.geek’s picture

Status: Fixed » Closed (fixed)
duaelfr’s picture

StatusFileSize
new8.04 KB

For the record here is the commited patch (to be used by composer if needed)