Skip to content

Commit fa04b25

Browse files
committed
Couple of bug fixes and release for 2.1.0
1 parent 344df59 commit fa04b25

12 files changed

+2749
-107
lines changed

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
*~
22
node_modules
33
.DS_Store
4-
*.log
4+
*.log
5+
dist

DevUtils/BuildAndCopy.js

-66
This file was deleted.

SimulatorDispatcher.js

+7-4
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,11 @@ SimulatorDispatcher.prototype._getPayloadObj = function(payloadString) {
101101
}
102102

103103
SimulatorDispatcher.prototype._getWebSecurityWarningConfirm = function() {
104-
var hostName = this._sourceWindow.location.hostname;
104+
// Due to cross-origin security issues over https, we may not be able to retrieve _sourceWindow.
105+
// Use sourceOrigin instead.
106+
var hostName = this._sourceOrigin || this._sourceWindow.location.origin;
105107

106-
var supportedHosts = ["localhost", "tableau.github.io"];
108+
var supportedHosts = ["http://localhost", "https://localhost", "http://tableau.github.io", "https://tableau.github.io"];
107109
if (supportedHosts.indexOf(hostName) >= 0) {
108110
return true;
109111
}
@@ -172,7 +174,8 @@ SimulatorDispatcher.prototype._receiveMessage = function(evt) {
172174
if(!payloadObj) return; // This message is not needed for WDC
173175

174176
if (!this._sourceWindow) {
175-
this._sourceWindow = evt.source
177+
this._sourceWindow = evt.source;
178+
this._sourceOrigin = evt.origin;
176179
}
177180

178181
var msgData = payloadObj.msgData;
@@ -232,7 +235,7 @@ SimulatorDispatcher.prototype._addCrossOriginException = function(destOriginList
232235
console.log("Cross Origin Exception requested in the simulator. Pretending to work.")
233236
setTimeout(function() {
234237
this.globalObj._wdc.addCrossOriginExceptionCompleted(destOriginList);
235-
}, 0);
238+
}.bind(this), 0);
236239
}
237240

238241
SimulatorDispatcher.prototype._log = function(msg) {

Table.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,17 @@ function Table(tableInfo, incrementValue, dataCallbackFn) {
1414

1515
/** @private */
1616
this._dataCallbackFn = dataCallbackFn;
17+
18+
// bind the public facing version of this function so it can be passed around
19+
this.appendRows = this._appendRows.bind(this);
1720
}
1821

1922
/**
2023
* @method appends the given rows to the set of data contained in this table
2124
* @param data {array} - Either an array of arrays or an array of objects which represent
2225
* the individual rows of data to append to this table
2326
*/
24-
Table.prototype.appendRows = function(data) {
27+
Table.prototype._appendRows = function(data) {
2528
// Do some quick validation that this data is the format we expect
2629
if (!data) {
2730
console.warn("rows data is null or undefined");

dist/bundle.js

+16-10
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/bundle.min.js

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

make_version.js

+4-20
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,11 @@
22
var program = require('commander');
33
var BuildNumber = require('./DevUtils/BuildNumber.js');
44
var execSync = require('child_process').execSync;
5-
var fs = require('fs.extra');
5+
var fs = require('fs-extra');
66
var path = require('path');
77

88
// wrap everything in a try catch so we can log any errors we see
99
try {
10-
program
11-
.option('-v, --versionNumber <versionNumber>', 'What version of the shim you are producing')
12-
.parse(process.argv);
13-
14-
if (program.versionNumber) {
15-
console.log("Requesting to make version " + program.versionNumber);
16-
var version = new BuildNumber.VersionNumber(program.versionNumber);
17-
console.log("Parsed version is " + version.toString());
18-
console.log("Overriding version number to " + program.versionNumber);
19-
execSync("npm config set wdclib:versionNumber " + program.versionNumber);
20-
}
21-
2210
console.log("Running build");
2311
execSync('npm run-script build');
2412

@@ -27,7 +15,8 @@ try {
2715

2816
console.log("Done runing build processes");
2917

30-
var buildNumber = BuildNumber.getBuildNumber();
18+
// Copying files over
19+
var buildNumber = new BuildNumber.VersionNumber(BuildNumber.getBuildNumber());
3120

3221
// Build up the names for the regular and minified versions of the file
3322
var newFullFileName = BuildNumber.WDC_LIB_PREFIX + buildNumber.toString() + ".js";
@@ -45,6 +34,7 @@ try {
4534
{src: "bundle.min.js", dest: newLatestMinFileName},
4635
];
4736

37+
// Go through and copy all the files
4838
for(var pair of copyPairs) {
4939
var srcPath = path.join(__dirname, ".", "dist", pair.src);
5040
var dstPath = path.join(__dirname, '.', 'versions', pair.dest);
@@ -53,16 +43,10 @@ try {
5343
fs.copySync(srcPath, dstPath);
5444
}
5545

56-
5746
} catch(e) {
5847
debugger;
5948
console.error("Error encountered");
6049
console.error(e.toString());
61-
} finally {
62-
// Make sure we clear out the overriden version at the end
63-
if (!!program.versionNumber) {
64-
execSync('npm config rm wdclib:versionNumber');
65-
}
6650
}
6751

6852

package.json

+4-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"build": "webpack --config webpack.config.js --progress --profile --colors",
66
"build_min": "webpack --config webpack-production.config.js --progress --profile --colors",
77
"build_and_copy": "node DevUtils/BuildAndCopy.js",
8-
"make_version" : "node ./make_version.js"
8+
"make_version": "node ./make_version.js"
99
},
1010
"main": "ShimLibrary.js",
1111
"private": true,
@@ -16,10 +16,11 @@
1616
},
1717
"dependencies": {
1818
"commander": "^2.9.0",
19+
"fs-extra": "^0.30.0",
1920
"json-loader": "^0.5.4",
2021
"qwebchannel": "^5.5.0"
2122
},
22-
"config" : {
23-
"versionNumber" : "2.1.1"
23+
"config": {
24+
"versionNumber": "2.1.0"
2425
}
2526
}

0 commit comments

Comments
 (0)