Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

fix(angular-loader): do not depend on "closure" globals that may not be available #15881

Closed
wants to merge 2 commits into from

Conversation

gkalpak
Copy link
Member

@gkalpak gkalpak commented Apr 2, 2017

What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)
Bug fix.

What is the current behavior? (You can also link to an open issue here)
See #15880.

What is the new behavior (if this is a feature change)?
Code that is distributed as part of both angular.js and angular-loader.js does not depend on "closure" globals that may not be available in angular-loader.

Does this PR introduce a breaking change?
No.

Please check if the PR fulfills these requirements

Other information:
Fixes #15880.

@gkalpak gkalpak added this to the Backlog milestone Apr 2, 2017
gkalpak added a commit to gkalpak/batarang that referenced this pull request Apr 2, 2017
…d `minErr`

This commit updates `loader.js` based on `angular-loader.js` from
angular/angular.js#15881, which is essentially the latest loader plus some
`minErr` fixes (see angular/angular.js#15881 for more info).

Additionally, the loader does a better job staying closer to the original
`angular-loader` behavior for versions 1.3+ and it only modifies its behavior to
support 1.2 apps. This change also fixes previously broken usecases that rely on
private `angular.Module` APIs (see angular#88 for more info).

Fixes angular#88
gkalpak added a commit to gkalpak/batarang that referenced this pull request Apr 2, 2017
…d `minErr`

This commit updates `loader.js` based on `angular-loader.js` from
angular/angular.js#15881, which is essentially the latest loader plus some
`minErr` fixes (see angular/angular.js#15881 for more info).

Additionally, the loader does a better job staying closer to the original
`angular-loader` behavior for versions 1.3+ and it only modifies its behavior to
support 1.2 apps. This change also fixes previously broken usecases that rely on
private `angular.Module` APIs (see angular#88 for more info).

Fixes angular#88
gkalpak added a commit to gkalpak/batarang that referenced this pull request Apr 2, 2017
…d `minErr`

This commit updates `loader.js` based on `angular-loader.js` from
angular/angular.js#15881, which is essentially the latest loader plus some
`minErr` fixes (see angular/angular.js#15881 for more info).

Additionally, the loader does a better job staying closer to the original
`angular-loader` behavior for versions 1.3+ and it only modifies its behavior to
support 1.2 apps. This change also fixes previously broken usecases that rely on
private `angular.Module` APIs (see angular#88 for more info).

Fixes angular#88
Copy link
Contributor

@Narretz Narretz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few comments, otherwise LGTM

src/stringify.js Outdated
@@ -9,7 +13,10 @@ function serializeObject(obj, maxDepth) {
// and a very deep object can cause a performance issue, so we copy the object
// based on this specific depth and then stringify it.
if (isValidObjectMaxDepth(maxDepth)) {
obj = copy(obj, null, maxDepth);
if (!copyFn) {
Copy link
Contributor

@Narretz Narretz Apr 3, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't angular.copy be always defined here, i.e. at this point in the code, angular.copy should be defined.

function isScope(obj) {return obj && obj.$evalAsync && obj.$watch;}
function isWindow(obj) {return obj && obj.window === obj;}
function sliceArgs(args, startIndex) {return Array.prototype.slice.call(args, startIndex || 0);}
function toJsonReplacer(key, value) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we add a note where this and other functions are used? This makes it easier later to check if they are still necessary after refactorings etc.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You mean add a comment here? Or in the places where these are used?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this file - a note at the top is probably enough, saying something of the effect that these functions are defined here because they must be available in angular-loader without angular.js loaded, and that they are copied from the Angular.js file

gkalpak added a commit to gkalpak/batarang that referenced this pull request Apr 4, 2017
…d `minErr`

This commit updates `loader.js` based on `angular-loader.js` from
angular/angular.js#15881, which is essentially the latest loader plus some
`minErr` fixes (see angular/angular.js#15881 for more info).

Additionally, the loader does a better job staying closer to the original
`angular-loader` behavior for versions 1.3+ and it only modifies its behavior to
support 1.2 apps. This change also fixes previously broken usecases that rely on
private `angular.Module` APIs (see angular#88 for more info).

Fixes angular#88
gkalpak added a commit to angular/batarang that referenced this pull request Apr 4, 2017
…d `minErr`

This commit updates `loader.js` based on `angular-loader.js` from
angular/angular.js#15881, which is essentially the latest loader plus some
`minErr` fixes (see angular/angular.js#15881 for more info).

Additionally, the loader does a better job staying closer to the original
`angular-loader` behavior for versions 1.3+ and it only modifies its behavior to
support 1.2 apps. This change also fixes previously broken usecases that rely on
private `angular.Module` APIs (see #88 for more info).

Fixes #88

Closes #311
…be available

Code that is distributed as part of both `angular.js` and `angular-loader.js`
should not depend on "closure" globals that may not be available in
`angular-loader`.

Fixes angular#15880
@gkalpak
Copy link
Member Author

gkalpak commented Apr 27, 2017

Rebased, addressed comments and fixed a bug. Will merge as soon as Travis is happy too.

@Narretz
Copy link
Contributor

Narretz commented Apr 27, 2017

LGTM. Looks like nobody uses the loader ...

@gkalpak gkalpak closed this in 4a12ae7 Apr 27, 2017
gkalpak added a commit that referenced this pull request Apr 27, 2017
…be available

Code that is distributed as part of both `angular.js` and `angular-loader.js`
should not depend on "closure" globals that may not be available in
`angular-loader`.

Fixes #15880

Closes #15881
@gkalpak gkalpak deleted the fix-loader-closure-globals branch April 27, 2017 19:47
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

fix(angular-loader): do not depend on "closure" globals that are not available in angular-loader
3 participants