Bug Tracker

Opened 10 years ago

Closed 10 years ago

#13789 closed bug (fixed)

variable module cannot accept 'null'

Reported by: ystk_skm <[email protected]…> Owned by: ystk_skm <[email protected]…>
Priority: low Milestone: 2.0.1
Component: misc Version: 2.0.0
Keywords: Cc:
Blocked by: Blocking:


See L:8730.

 typeof module === "object" && typeof module.exports === "object"

It occurs error when module === null.

I think that this condition should be:

  typeof module == 'object' && module != null && typeof module.exports === "object"

Change History (5)

comment:1 Changed 10 years ago by dmethvin

Owner: set to ystk_skm <[email protected]…>
Status: newpending

Hi, thanks for contributing? Can you provide a test case and some more information about the problem?

comment:2 Changed 10 years ago by ystk_skm <[email protected]…>

Status: pendingnew

There are no huge impact for this bug, only requires some change if module is defined null at this position.
I think it's worth better to avoid such irregular.

	<script>var module = null;</script>
	<script src="http://code.jquery.com/jquery-2.0.0.js"></script> 
        // Uncaught TypeError: Cannot read property 'exports' of null 

comment:3 Changed 10 years ago by dmethvin

Component: unfiledmisc
Milestone: None2.0.1
Priority: undecidedlow
Status: newopen

I agree, it shouldn't fail if module is null but I'd hope that isn't out in global scope very often.

Did your own code fail because of this, or did you just notice it while reading the code?

comment:4 Changed 10 years ago by ystk_skm <[email protected]…>

Just notice it while reading. I'm adjusting my resources for jQuery 2.0.0.

comment:5 Changed 10 years ago by Eddie Monge

Resolution: fixed
Status: openclosed

Fix #13789: Don't throw when module === null. Close gh-1269.

Changeset: eabb56c27484cbffd2ce4951f661df83c91e5d7a

Note: See TracTickets for help on using tickets.