* Convert file names to absolute paths in serialize()/deserialize() to avoid
names being interpreted relative to root on Mac OS X.
This commit is contained in:
parent
9eb4285880
commit
0ccb0f1010
1 changed files with 4 additions and 4 deletions
|
@ -653,8 +653,8 @@ public class GlobalObject extends ImporterTopLevel implements PropertyRecorder {
|
||||||
"the serialization to");
|
"the serialization to");
|
||||||
}
|
}
|
||||||
Object obj = args[0];
|
Object obj = args[0];
|
||||||
String filename = Context.toString(args[1]);
|
File file = new File(Context.toString(args[1])).getAbsoluteFile();
|
||||||
FileOutputStream fos = new FileOutputStream(filename);
|
FileOutputStream fos = new FileOutputStream(file);
|
||||||
Scriptable scope = ScriptableObject.getTopLevelScope(thisObj).getPrototype();
|
Scriptable scope = ScriptableObject.getTopLevelScope(thisObj).getPrototype();
|
||||||
// use a ScriptableOutputStream that unwraps Wrappers
|
// use a ScriptableOutputStream that unwraps Wrappers
|
||||||
ScriptableOutputStream out = new ScriptableOutputStream(fos, scope) {
|
ScriptableOutputStream out = new ScriptableOutputStream(fos, scope) {
|
||||||
|
@ -679,8 +679,8 @@ public class GlobalObject extends ImporterTopLevel implements PropertyRecorder {
|
||||||
throw Context.reportRuntimeError(
|
throw Context.reportRuntimeError(
|
||||||
"Expected a filename to read the serialization from");
|
"Expected a filename to read the serialization from");
|
||||||
}
|
}
|
||||||
String filename = Context.toString(args[0]);
|
File file = new File(Context.toString(args[0])).getAbsoluteFile();
|
||||||
FileInputStream fis = new FileInputStream(filename);
|
FileInputStream fis = new FileInputStream(file);
|
||||||
Scriptable scope = ScriptableObject.getTopLevelScope(thisObj).getPrototype();
|
Scriptable scope = ScriptableObject.getTopLevelScope(thisObj).getPrototype();
|
||||||
ObjectInputStream in = new ScriptableInputStream(fis, scope);
|
ObjectInputStream in = new ScriptableInputStream(fis, scope);
|
||||||
Object deserialized = in.readObject();
|
Object deserialized = in.readObject();
|
||||||
|
|
Loading…
Add table
Reference in a new issue