kripken/emscripten — pull request #373 by SiggyBar (2012-04-11 18:03:34+00:00)
Title: Make more browser tests work for Windows.

- Make preloaded file paths always use forward slashes.
- Read preloaded files as binary.
- Avoid pickling issue with server_func().

When the server_func() was a local function in browser.run_browser(), I got the following exception (both with python 2.6 and python 2.7):

```python
Traceback (most recent call last):
File "tests\runner.py", line 6785, in test_sdl_image
self.run_browser('page.html', '', '/report_result?600')
File "tests\runner.py", line 6565, in run_browser
server.start()
File "C:\tools\Python26\lib\multiprocessing\process.py", line 104, in start
self._popen = Popen(self)
File "C:\tools\Python26\lib\multiprocessing\forking.py", line 239, in __init__
dump(process_obj, to_child, HIGHEST_PROTOCOL)
File "C:\tools\Python26\lib\multiprocessing\forking.py", line 162, in dump
ForkingPickler(file, protocol).dump(obj)
File "C:\tools\Python26\lib\pickle.py", line 224, in dump
self.save(obj)
File "C:\tools\Python26\lib\pickle.py", line 331, in save
self.save_reduce(obj=obj, *rv)
File "C:\tools\Python26\lib\pickle.py", line 419, in save_reduce
save(state)
File "C:\tools\Python26\lib\pickle.py", line 286, in save
f(self, obj) # Call unbound method with explicit self
File "C:\tools\Python26\lib\pickle.py", line 649, in save_dict
self._batch_setitems(obj.iteritems())
File "C:\tools\Python26\lib\pickle.py", line 681, in _batch_setitems
save(v)
File "C:\tools\Python26\lib\pickle.py", line 286, in save
f(self, obj) # Call unbound method with explicit self
File "C:\tools\Python26\lib\pickle.py", line 748, in save_global
(obj, module, name))
PicklingError: Can't pickle : it's not found as __main__.server_func
```
This was after commenting out the try/finally pair in browser.run_browser(). Otherwise, 'server' would be None in the finally clause and another (non-relevant) exception would be raised.