-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #24 from bakhangildin/remove-hex-encoding-in-js
Recompiled spidermonkey so we do not need to hex encode stdout
- Loading branch information
Showing
9 changed files
with
31 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,19 @@ | ||
// This should come from the official SDK. | ||
// But there is no official SDK yet, so we keep it here. | ||
function hexLog(s) { | ||
for (let i = 0; i < s.length; i++) { | ||
putstr(s.charCodeAt(i).toString(16).padStart(2, "0")) | ||
} | ||
putstr("0a") | ||
} | ||
|
||
console.log = hexLog | ||
|
||
function respond(res, status) { | ||
var buffer = new ArrayBuffer(8); | ||
var view = new DataView(buffer); | ||
view.setUint32(0, status, true); | ||
view.setUint32(4, res.length, true); | ||
|
||
for (let i = 0; i < res.length; i++) { | ||
putstr(res.charCodeAt(i).toString(16).padStart(2, "0")) | ||
} | ||
for (let i = 0; i < view.buffer.byteLength; i++) { | ||
putstr(view.getUint8(i).toString(16).padStart(2, "0")); | ||
} | ||
putstr(res); | ||
writebytes(view) | ||
} | ||
|
||
console.log("user log here") | ||
console.log("user log here") | ||
console.log("user log here") | ||
console.log("user log here") | ||
console.log("user log here") | ||
console.log("USER LOGS"); | ||
console.log("USER LOGS"); | ||
console.log("USER LOGS"); | ||
console.log("USER LOGS"); | ||
console.log("USER LOGS"); | ||
|
||
respond("<h1>From my Raptor application</h1></br>some other stuff here</br>", 200) | ||
respond("Hello world!", 200) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,19 @@ | ||
// This should come from the official SDK. | ||
// But there is no official SDK yet, so we keep it here. | ||
function hexLog(s) { | ||
for (let i = 0; i < s.length; i++) { | ||
putstr(s.charCodeAt(i).toString(16).padStart(2, "0")) | ||
} | ||
putstr("0a") | ||
} | ||
|
||
console.log = hexLog | ||
|
||
function respond(res, status) { | ||
var buffer = new ArrayBuffer(8); | ||
var view = new DataView(buffer); | ||
view.setUint32(0, status, true); | ||
view.setUint32(4, res.length, true); | ||
|
||
for (let i = 0; i < res.length; i++) { | ||
putstr(res.charCodeAt(i).toString(16).padStart(2, "0")) | ||
} | ||
for (let i = 0; i < view.buffer.byteLength; i++) { | ||
putstr(view.getUint8(i).toString(16).padStart(2, "0")); | ||
} | ||
putstr(res); | ||
writebytes(view) | ||
} | ||
|
||
console.log("USER LOGS"); | ||
console.log("USER LOGS"); | ||
console.log("USER LOGS"); | ||
console.log("USER LOGS"); | ||
console.log("USER LOGS"); | ||
|
||
respond("Hello world!", 200) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.