zendframework / zend-developer-tools

Module for developer and debug tools for working with the ZF2 MVC layer.
BSD 3-Clause "New" or "Revised" License
323 stars 130 forks source link

Javascript location.assign brokes the toolbar #194

Open quintanilhar opened 9 years ago

quintanilhar commented 9 years ago

Hi!

When I use window.location.assign with a download link, the toolbar does not work properly and I get this javascript error on my console: Uncaught TypeError: Cannot read property 'offsetWidth' of null

Code to simulate:

<script type="text/javascript">
    window.location.assign("https://github.com/zendframework/ZendDeveloperTools/archive/master.zip");
</script>

Thank you!

Ocramius commented 9 years ago

I don't see any offsetWidth being used? Doesn't look like this is the affected code?

quintanilhar commented 9 years ago

Hi @Ocramius!

I can see the error in this code point:

<!-- START Zend Developer Toolbar JavaScript -->
<script type="text/javascript">
    <!--
    (function() {

    /**
     * @param {Cookie} cookie
     * @returns {Toolbar}
     * @constructor
     */
    var Toolbar = function(cookie) {
        /** @type {Toolbar} */
        var self = this;
        /** @type {HTMLElement} */
        var container = document.getElementById("zend-developer-toolbar");
        /** @type {number} */
        var width = container.offsetWidth; //<------- Uncaught TypeError: Cannot read property 'offsetWidth' of null

I tried to reproduce with a new application using the zf2 skeleton but in this case I missed the toolbar with the example code. You need to use a downloadable link to get the error as I pointed earlier.

Let me know if you need some more details.

Ocramius commented 9 years ago

You need to use a downloadable link

I don't follow this bit, specifically...

quintanilhar commented 9 years ago

@Ocramius, can you reproduce the error?

weierophinney commented 4 years ago

This repository has been closed and moved to laminas/laminas-developer-tools; a new issue has been opened at https://github.com/laminas/laminas-developer-tools/issues/10.