Skip to content

Commit 51fe456

Browse files
committed
Properly exclude browserify's annoying _process, again, fixes #502
1 parent 3c16e46 commit 51fe456

File tree

9 files changed

+22
-17
lines changed

9 files changed

+22
-17
lines changed

dist/protobuf.js

Lines changed: 8 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/protobuf.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/protobuf.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/protobuf.min.js.gz

-21 Bytes
Binary file not shown.

dist/protobuf.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/root.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ RootPrototype.load = function load(filename, callback) {
104104
// Fetches a single file
105105
function fetch(filename, weak) {
106106

107-
// Check if this file references a bundled definition
107+
// Strip path if this file references a bundled definition
108108
var idx = filename.indexOf("google/protobuf/");
109109
if (idx > -1) {
110110
var altname = filename.substring(idx);

src/util.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ util.codegen = require("./util/codegen");
1515
* @memberof util
1616
* @type {boolean}
1717
*/
18-
var isNode = util.isNode = Boolean(typeof process !== 'undefined' && process.versions && process.versions.node);
18+
var isNode = util.isNode = Boolean(global.process && global.process.versions && global.process.versions.node);
1919

2020
/**
2121
* Optional buffer class to use.

src/writer.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -356,14 +356,14 @@ WriterPrototype.bytes = function write_bytes(value) {
356356
};
357357

358358
function writeString(buf, pos, val) {
359-
for (var i = 0, len = val.length, c1, c2; i < len; ++i) {
360-
c1 = val.charCodeAt(i);
359+
for (var i = 0; i < val.length; ++i) {
360+
var c1 = val.charCodeAt(i), c2;
361361
if (c1 < 128) {
362362
buf[pos++] = c1;
363363
} else if (c1 < 2048) {
364364
buf[pos++] = c1 >> 6 | 192;
365365
buf[pos++] = c1 & 63 | 128;
366-
} else if ((c1 & 0xFC00) === 0xD800 && i + 1 < len && ((c2 = val.charCodeAt(i + 1)) & 0xFC00) === 0xDC00) {
366+
} else if ((c1 & 0xFC00) === 0xD800 && i + 1 < val.length && ((c2 = val.charCodeAt(i + 1)) & 0xFC00) === 0xDC00) {
367367
c1 = 0x10000 + ((c1 & 0x03FF) << 10) + (c2 & 0x03FF);
368368
++i;
369369
buf[pos++] = c1 >> 18 | 240;

tests/browser.html

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<html>
2+
<head>
3+
<script src="../dist/protobuf.js"></script>
4+
</head>
5+
</html>

0 commit comments

Comments
 (0)