我已经为 webP 编译了 NPAPI 插件:
http://code.google.com/p/webp-npapi-linux/
它在我的 Firefox 中效果很好。我根本不明白如何让它从谷歌浏览器工作。我创建了 json 文件:
$ cat manifest.json
{
"name": "My First Extension",
"version": "1.0",
"manifest_version": 2,
"description": "The first extension that I made.",
"plugins": [
{ "path": "webp-npapi.so", "public": true }
]
}
然后我启动谷歌浏览器,进入 chrome://extensions,点击“加载解压的扩展...”。我可以看到它出现在列表中:
My First Extension - Version: 1.0 (Unpacked)
The first extension that I made.
ID: bakhhdpebhmgoaecbmpkcbnmcmnamhhk
但是我仍然无法打开没有 *.webp 图像!
我的测试 HTML 页面是:
<!DOCTYPE html PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html>
<head>
<title>
Hello World Demonstration Document
</title>
</head>
<embed type="image/webp:webp:WebP" id="pluginId">
<script>
var plugin = document.getElementById("pluginId");
var result = plugin.myPluginMethod(); // call a method in your plugin
console.log("my plugin returned: " + result);
</script>
<body>
<h1>
Hello, World!
</h1>
<img src="1.sm.webp" alt="too bad"/>
</body>
</html>
文件在本地下载(wget http://www.gstatic.com/webp/gallery/1.sm.webp)。ldd 在我看来还不错:
$ ldd webp-npapi.so
linux-vdso.so.1 => (0x00007fffafdad000)
libwebp.so.2 => /usr/lib/x86_64-linux-gnu/libwebp.so.2 (0x00007ff82fd60000)
libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x00007ff82fa4c000)
libm.so.6 => /lib/libm.so.6 (0x00007ff82f7c9000)
libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x00007ff82f5b3000)
libc.so.6 => /lib/libc.so.6 (0x00007ff82f251000)
/lib64/ld-linux-x86-64.so.2 (0x00007ff8301c9000)
我错过了什么?