Skip to content
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

Global leaks old firefox versions strange behavior #1733

Closed
bgaillard opened this issue Jun 8, 2015 · 2 comments
Closed

Global leaks old firefox versions strange behavior #1733

bgaillard opened this issue Jun 8, 2015 · 2 comments

Comments

@bgaillard
Copy link

Hi, i'm currently doing lot of tests using Browserstack.

Today I executed unit tests on the ~500 browsers Browserstack supports and encountered a strange Error: global leak detected: navigator which appears only with old Firefox versions (the error is encountered in Firefox 5.X and older).

My settings are very simple ;

<script type="text/javascript">
    mocha.setup({ui: 'bdd'});
</script>

<script type="text/javascript" src="test/spec/my-tests.js"></script>

<script type="text/javascript">
    mocha.checkLeaks();
    mocha.run();
</script>

The first time I execute the tests the following error is reported : Error: global leak detected: navigator.

But if I refresh the tab it works without problem, what's strange is that if I add only navigator.userAgent; before mocha.checkLeaks(); then it works.

...
<script type="text/javascript">
    navigator.userAgent;
    mocha.checkLeaks();
    mocha.run();
</script>

Do you know why I encounter this strange behavior ? Is it a bug in Mocha's leaks detection ?

If somebody else encounters the same error the workaround is simply to change you Mocha settings.

mocha.setup(
    {
        ui: 'bdd',
        globals: ['navigator'] 
    }
);

Thanks,

Baptiste

@boneskull
Copy link
Contributor

if a new property appears in the global context between the mocha.run() and its completion, the global leak detection error will occur. what FF is doing, I don't know, but that's why. good to know for people using older FF versions though--thanks

@bgaillard
Copy link
Author

Hi @boneskull, ok I understand now, makes sense.

So old FF versions should have a buggy page initialization.

Thanks for the explanations !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants