Skip to content

Commit b3468bb

Browse files
Merge pull request #123 from angular/master
Enable kustomize in kubectl
2 parents 3b1b9c7 + a5a98d3 commit b3468bb

File tree

8 files changed

+501
-949
lines changed

8 files changed

+501
-949
lines changed

.travis.yml

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ env:
1515
- JOB=ci-checks
1616
- JOB=unit-core BROWSER_PROVIDER=saucelabs
1717
- JOB=unit-jquery BROWSER_PROVIDER=saucelabs
18+
- JOB=unit-modules BROWSER_PROVIDER=saucelabs
1819
- JOB=docs-app BROWSER_PROVIDER=saucelabs
1920
- JOB=e2e TEST_TARGET=jqlite BROWSER_PROVIDER=saucelabs
2021
- JOB=e2e TEST_TARGET=jquery BROWSER_PROVIDER=saucelabs

karma-shared.conf.js

+4-8
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,11 @@ module.exports = function(config, specificOptions) {
6565
'SL_Safari-1': {
6666
base: 'SauceLabs',
6767
browserName: 'safari',
68-
platform: 'OS X 10.12',
6968
version: 'latest-1'
7069
},
7170
'SL_Safari': {
7271
base: 'SauceLabs',
7372
browserName: 'safari',
74-
platform: 'OS X 10.12',
7573
version: 'latest'
7674
},
7775
'SL_IE_9': {
@@ -104,17 +102,15 @@ module.exports = function(config, specificOptions) {
104102
platform: 'Windows 10',
105103
version: 'latest-1'
106104
},
107-
'SL_iOS_10': {
105+
'SL_iOS': {
108106
base: 'SauceLabs',
109107
browserName: 'iphone',
110-
platform: 'OS X 10.12',
111-
version: '10.3'
108+
version: 'latest'
112109
},
113-
'SL_iOS_11': {
110+
'SL_iOS-1': {
114111
base: 'SauceLabs',
115112
browserName: 'iphone',
116-
platform: 'OS X 10.12',
117-
version: '11.2'
113+
version: 'latest-1'
118114
},
119115

120116
'BS_Chrome': {

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
"jquery": "3.2.1",
6363
"jquery-2.1": "npm:[email protected]",
6464
"jquery-2.2": "npm:[email protected]",
65-
"karma": "^2.0.4",
65+
"karma": "3.1.1",
6666
"karma-browserstack-launcher": "^1.3.0",
6767
"karma-chrome-launcher": "^2.2.0",
6868
"karma-edge-launcher": "^0.4.2",

scripts/travis/build.sh

+5-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ SAUCE_ACCESS_KEY=$(echo "$SAUCE_ACCESS_KEY" | rev)
1616
BROWSERS="SL_Chrome,SL_Chrome-1,\
1717
SL_Firefox,SL_Firefox-1,\
1818
SL_Safari,SL_Safari-1,\
19-
SL_iOS_10,SL_iOS_11,\
19+
SL_iOS,SL_iOS-1,\
2020
SL_IE_9,SL_IE_10,SL_IE_11,\
2121
SL_EDGE"
2222

@@ -35,13 +35,15 @@ case "$JOB" in
3535
"unit-core")
3636
grunt test:promises-aplus
3737
grunt test:jqlite --browsers="$BROWSERS" --reporters=spec
38-
grunt test:modules --browsers="$BROWSERS" --reporters=spec
3938
;;
4039
"unit-jquery")
4140
grunt test:jquery --browsers="$BROWSERS" --reporters=spec
4241
grunt test:jquery-2.2 --browsers="$BROWSERS" --reporters=spec
4342
grunt test:jquery-2.1 --browsers="$BROWSERS" --reporters=spec
4443
;;
44+
"unit-modules")
45+
grunt test:modules --browsers="$BROWSERS" --reporters=spec
46+
;;
4547
"docs-app")
4648
grunt tests:docs --browsers="$BROWSERS" --reporters=spec
4749
grunt test:travis-protractor --specs="docs/app/e2e/**/*.scenario.js"
@@ -102,6 +104,7 @@ case "$JOB" in
102104
'ci-checks',\
103105
'unit-core',\
104106
'unit-jquery',\
107+
'unit-modules',\
105108
'docs-app',\
106109
'e2e',\
107110
or\

src/Angular.js

+1-6
Original file line numberDiff line numberDiff line change
@@ -1696,13 +1696,8 @@ function angularInit(element, bootstrap) {
16961696
});
16971697
if (appElement) {
16981698
if (!isAutoBootstrapAllowed) {
1699-
try {
1700-
window.console.error('AngularJS: disabling automatic bootstrap. <script> protocol indicates ' +
1699+
window.console.error('AngularJS: disabling automatic bootstrap. <script> protocol indicates ' +
17011700
'an extension, document.location.href does not match.');
1702-
} catch (e) {
1703-
// Support: Safari 11 w/ Webdriver
1704-
// The console.error will throw and make the test fail
1705-
}
17061701
return;
17071702
}
17081703
config.strictDi = getNgAttribute(appElement, 'strict-di') !== null;

src/ng/browser.js

+3
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,9 @@ function Browser(window, document, $log, $sniffer, $$taskTrackerFactory) {
108108
if (url) {
109109
var sameState = lastHistoryState === state;
110110

111+
// Normalize the inputted URL
112+
url = urlResolve(url).href;
113+
111114
// Don't change anything if previous and current URLs and states match. This also prevents
112115
// IE<10 from getting into redirect loop when in LocationHashbangInHtml5Url mode.
113116
// See https://github.com/angular/angular.js/commit/ffb2701

test/ng/browserSpecs.js

+93-25
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,9 @@ function MockWindow(options) {
1111
}
1212
var events = {};
1313
var timeouts = this.timeouts = [];
14-
var locationHref = 'http://server/';
15-
var committedHref = 'http://server/';
14+
var locationHref = window.document.createElement('a');
15+
var committedHref = window.document.createElement('a');
16+
locationHref.href = committedHref.href = 'http://server/';
1617
var mockWindow = this;
1718
var msie = options.msie;
1819
var ieState;
@@ -60,28 +61,28 @@ function MockWindow(options) {
6061

6162
this.location = {
6263
get href() {
63-
return committedHref;
64+
return committedHref.href;
6465
},
6566
set href(value) {
66-
locationHref = value;
67+
locationHref.href = value;
6768
mockWindow.history.state = null;
6869
historyEntriesLength++;
6970
if (!options.updateAsync) this.flushHref();
7071
},
7172
get hash() {
72-
return getHash(committedHref);
73+
return getHash(committedHref.href);
7374
},
7475
set hash(value) {
75-
locationHref = replaceHash(locationHref, value);
76+
locationHref.href = replaceHash(locationHref.href, value);
7677
if (!options.updateAsync) this.flushHref();
7778
},
7879
replace: function(url) {
79-
locationHref = url;
80+
locationHref.href = url;
8081
mockWindow.history.state = null;
8182
if (!options.updateAsync) this.flushHref();
8283
},
8384
flushHref: function() {
84-
committedHref = locationHref;
85+
committedHref.href = locationHref.href;
8586
}
8687
};
8788

@@ -91,13 +92,13 @@ function MockWindow(options) {
9192
historyEntriesLength++;
9293
},
9394
replaceState: function(state, title, url) {
94-
locationHref = url;
95-
if (!options.updateAsync) committedHref = locationHref;
95+
locationHref.href = url;
96+
if (!options.updateAsync) committedHref.href = locationHref.href;
9697
mockWindow.history.state = copy(state);
9798
if (!options.updateAsync) this.flushHref();
9899
},
99100
flushHref: function() {
100-
committedHref = locationHref;
101+
committedHref.href = locationHref.href;
101102
}
102103
};
103104
// IE 10-11 deserialize history.state on each read making subsequent reads
@@ -398,26 +399,26 @@ describe('browser', function() {
398399

399400
it('should return current location.href', function() {
400401
fakeWindow.location.href = 'http://test.com';
401-
expect(browser.url()).toEqual('http://test.com');
402+
expect(browser.url()).toEqual('http://test.com/');
402403

403404
fakeWindow.location.href = 'https://another.com';
404-
expect(browser.url()).toEqual('https://another.com');
405+
expect(browser.url()).toEqual('https://another.com/');
405406
});
406407

407408
it('should strip an empty hash fragment', function() {
408-
fakeWindow.location.href = 'http://test.com#';
409-
expect(browser.url()).toEqual('http://test.com');
409+
fakeWindow.location.href = 'http://test.com/#';
410+
expect(browser.url()).toEqual('http://test.com/');
410411

411-
fakeWindow.location.href = 'https://another.com#foo';
412-
expect(browser.url()).toEqual('https://another.com#foo');
412+
fakeWindow.location.href = 'https://another.com/#foo';
413+
expect(browser.url()).toEqual('https://another.com/#foo');
413414
});
414415

415416
it('should use history.pushState when available', function() {
416417
sniffer.history = true;
417418
browser.url('http://new.org');
418419

419420
expect(pushState).toHaveBeenCalledOnce();
420-
expect(pushState.calls.argsFor(0)[2]).toEqual('http://new.org');
421+
expect(pushState.calls.argsFor(0)[2]).toEqual('http://new.org/');
421422

422423
expect(replaceState).not.toHaveBeenCalled();
423424
expect(locationReplace).not.toHaveBeenCalled();
@@ -429,7 +430,7 @@ describe('browser', function() {
429430
browser.url('http://new.org', true);
430431

431432
expect(replaceState).toHaveBeenCalledOnce();
432-
expect(replaceState.calls.argsFor(0)[2]).toEqual('http://new.org');
433+
expect(replaceState.calls.argsFor(0)[2]).toEqual('http://new.org/');
433434

434435
expect(pushState).not.toHaveBeenCalled();
435436
expect(locationReplace).not.toHaveBeenCalled();
@@ -440,7 +441,7 @@ describe('browser', function() {
440441
sniffer.history = false;
441442
browser.url('http://new.org');
442443

443-
expect(fakeWindow.location.href).toEqual('http://new.org');
444+
expect(fakeWindow.location.href).toEqual('http://new.org/');
444445

445446
expect(pushState).not.toHaveBeenCalled();
446447
expect(replaceState).not.toHaveBeenCalled();
@@ -473,7 +474,7 @@ describe('browser', function() {
473474
sniffer.history = false;
474475
browser.url('http://new.org', true);
475476

476-
expect(locationReplace).toHaveBeenCalledWith('http://new.org');
477+
expect(locationReplace).toHaveBeenCalledWith('http://new.org/');
477478

478479
expect(pushState).not.toHaveBeenCalled();
479480
expect(replaceState).not.toHaveBeenCalled();
@@ -507,9 +508,9 @@ describe('browser', function() {
507508
it('should not set URL when the URL is already set', function() {
508509
var current = fakeWindow.location.href;
509510
sniffer.history = false;
510-
fakeWindow.location.href = 'dontchange';
511+
fakeWindow.location.href = 'http://dontchange/';
511512
browser.url(current);
512-
expect(fakeWindow.location.href).toBe('dontchange');
513+
expect(fakeWindow.location.href).toBe('http://dontchange/');
513514
});
514515

515516
it('should not read out location.href if a reload was triggered but still allow to change the url', function() {
@@ -688,6 +689,73 @@ describe('browser', function() {
688689
expect(replaceState).not.toHaveBeenCalled();
689690
expect(locationReplace).not.toHaveBeenCalled();
690691
});
692+
693+
it('should not do pushState with a URL using relative protocol', function() {
694+
browser.url('http://server/');
695+
696+
pushState.calls.reset();
697+
replaceState.calls.reset();
698+
locationReplace.calls.reset();
699+
700+
browser.url('//server');
701+
expect(pushState).not.toHaveBeenCalled();
702+
expect(replaceState).not.toHaveBeenCalled();
703+
expect(locationReplace).not.toHaveBeenCalled();
704+
});
705+
706+
it('should not do pushState with a URL only adding a trailing slash after domain', function() {
707+
// A domain without a trailing /
708+
browser.url('http://server');
709+
710+
pushState.calls.reset();
711+
replaceState.calls.reset();
712+
locationReplace.calls.reset();
713+
714+
// A domain from something such as window.location.href with a trailing slash
715+
browser.url('http://server/');
716+
expect(pushState).not.toHaveBeenCalled();
717+
expect(replaceState).not.toHaveBeenCalled();
718+
expect(locationReplace).not.toHaveBeenCalled();
719+
});
720+
721+
it('should not do pushState with a URL only removing a trailing slash after domain', function() {
722+
// A domain from something such as window.location.href with a trailing slash
723+
browser.url('http://server/');
724+
725+
pushState.calls.reset();
726+
replaceState.calls.reset();
727+
locationReplace.calls.reset();
728+
729+
// A domain without a trailing /
730+
browser.url('http://server');
731+
expect(pushState).not.toHaveBeenCalled();
732+
expect(replaceState).not.toHaveBeenCalled();
733+
expect(locationReplace).not.toHaveBeenCalled();
734+
});
735+
736+
it('should do pushState with a URL only adding a trailing slash after the path', function() {
737+
browser.url('http://server/foo');
738+
739+
pushState.calls.reset();
740+
replaceState.calls.reset();
741+
locationReplace.calls.reset();
742+
743+
browser.url('http://server/foo/');
744+
expect(pushState).toHaveBeenCalledOnce();
745+
expect(fakeWindow.location.href).toEqual('http://server/foo/');
746+
});
747+
748+
it('should do pushState with a URL only removing a trailing slash after the path', function() {
749+
browser.url('http://server/foo/');
750+
751+
pushState.calls.reset();
752+
replaceState.calls.reset();
753+
locationReplace.calls.reset();
754+
755+
browser.url('http://server/foo');
756+
expect(pushState).toHaveBeenCalledOnce();
757+
expect(fakeWindow.location.href).toEqual('http://server/foo');
758+
});
691759
};
692760
}
693761
});
@@ -812,7 +880,7 @@ describe('browser', function() {
812880
it('should not fire urlChange if changed by browser.url method', function() {
813881
sniffer.history = false;
814882
browser.onUrlChange(callback);
815-
browser.url('http://new.com');
883+
browser.url('http://new.com/');
816884

817885
fakeWindow.fire('hashchange');
818886
expect(callback).not.toHaveBeenCalled();
@@ -1092,7 +1160,7 @@ describe('browser', function() {
10921160
it('should not interfere with legacy browser url replace behavior', function() {
10931161
inject(function($rootScope) {
10941162
var current = fakeWindow.location.href;
1095-
var newUrl = 'notyet';
1163+
var newUrl = 'http://notyet/';
10961164
sniffer.history = false;
10971165
expect(historyEntriesLength).toBe(1);
10981166
browser.url(newUrl, true);

0 commit comments

Comments
 (0)