Skip to content

HTML Profiler and pub/static Resources #850

@astorm

Description

@astorm

When a user enabled the HTML profiler, the pub/static.php file adds HTML code to the bottom of non-HTML resources. For example, if you load

http://127.0.0.1:8080/pub/static/adminhtml/Magento/backend/en_US/prototype/prototype.js

The end of the file will contain code like the following

    findChildElements: function(element, expressions) {
      var selector = expressions.toArray().join(', ');
      return Prototype.Selector.select(selector, element || document);
    }
  });
})();
<table border="1" cellspacing="0" cellpadding="2">
<caption>Code Profiler (Memory usage: real - 7340032, emalloc - 7024160)</caption>
<tr>

This HTML code causes javascript execution errors, which breaks application functionality. While this can be worked around using other profiler modes (csvfile), enabling the HTML profiles should not break the application's functionality.

Steps to Reproduce.

  1. Add SetEnv MAGE_MODE developer to your .htaccess file
  2. Add SetEnv MAGE_PROFILER html
  3. Confirm profiler added to the bottom of your root page
  4. Load a file through static.php via a URL like pub/static/adminhtml/Magento/backend/en_US/prototype/prototype.js

Expected Behavior: Magento loads executable Javascript, preserving application functionality

Actual Behavior: Magento loads Javascript with HTML profiler code at the end, breaking application functionality

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions