New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Javascript location.assign brokes the toolbar #194

Open
quintanilhar opened this Issue Sep 7, 2015 · 4 comments

Comments

Projects
None yet
2 participants
@quintanilhar

quintanilhar commented Sep 7, 2015

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

This comment has been minimized.

Show comment
Hide comment
@Ocramius

Ocramius Sep 7, 2015

Member

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

Member

Ocramius commented Sep 7, 2015

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

@quintanilhar

This comment has been minimized.

Show comment
Hide comment
@quintanilhar

quintanilhar Sep 10, 2015

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.

quintanilhar commented Sep 10, 2015

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

This comment has been minimized.

Show comment
Hide comment
@Ocramius

Ocramius Sep 10, 2015

Member

You need to use a downloadable link

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

Member

Ocramius commented Sep 10, 2015

You need to use a downloadable link

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

@quintanilhar

This comment has been minimized.

Show comment
Hide comment
@quintanilhar

quintanilhar Sep 22, 2015

@Ocramius, can you reproduce the error?

quintanilhar commented Sep 22, 2015

@Ocramius, can you reproduce the error?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment