Closed Bug 734212 Opened 12 years ago Closed 10 years ago

cuddlefish search for 'require(...)' statements identifies too many statements

Categories

(Add-on SDK Graveyard :: General, defect, P2)

defect

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: creswick, Unassigned)

Details

User Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/535.11 (KHTML, like Gecko) Chrome/17.0.963.56 Safari/535.11

Steps to reproduce:

Using require(...) as a method on objects, or using functions that end with 'require' causes cuddlefish to try and find modules that do not exist.  For example:




Actual results:

Code such as:

goog.require('goog.json');

Causes cuddlefish to try and locate a 'goog.json' module, which does not exist in the CommonJS system.


Expected results:

These statements should be ignored by the module search, since 'require' in these cases is semantically different than 'required' used in the commonJS system.

We were able to work around this by modifying REQUIRE_RE in manifest.py to:

REQUIRE_RE = r"(?<!goog[.])(?<![\'\"])\brequire\s*\(\s*[\'\"]([^\'\"]+?)[\'\"]\s*\)"

Note that this has two distinct changes:

 * The goog. prefix is excluded, because that was required for our specific case.
 * The \b word boundary was added prior to require, to prevent functions like: "unrequire(...)" from being detected (yep, that's a contrived example, I don't remember the exact case)
There are no updates on this bug since two years; I'll close as WONTFIX, since we're going to switch to native jetpack.
Status: UNCONFIRMED → RESOLVED
Closed: 10 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.