Proposal: Allow plugins to set the document title

Benjamin Smedberg benjamin at smedbergs.us
Wed Sep 14 12:02:02 PDT 2011


On 9/14/11 11:42 AM, Evan Martin wrote:
> On Wed, Sep 14, 2011 at 9:31 AM, Benjamin Smedberg
> <benjamin at smedbergs.us>  wrote:
>> On 9/13/11 3:14 PM, Alex Plotnick wrote:
>>> I've written up a proposal to add a new NPAPI variable, NPPVdocumentTitle,
>>> that allows a plugin to set the document title via a call to NPN_SetValue:
>>>
>>>         https://wiki.mozilla.org/NPAPI:DocumentTitle
>> Why is this inherently better than just using NPRuntime to set
>> document.title = "string"? This sounds like an unnecessary proposal to me.
> It appears the proposal page describes why using that is hard.
The proposal's problem statement doesn't make much sense. There is no 
escaping required (error and type checking code removed for simplicity):

NPObject* window = NULL;
NPN_GetValue(inst, NPNVDOMWindow, &window);

NPVariant documentv;
NPN_GetProperty(inst, window, NPN_GetStringIdentifier("document"), 
&document);

NPObject* document = NPVARIANT_TO_OBJECT(documentv);
NPVariant title;
STRINGZ_TO_NPVARIANT("mynewtitlestring", title);
NPN_SetProperty(inst, document, NPN_GetStringIdentifier("title"), &title);
NPN_ReleaseObject(document);
NPN_ReleaseObject(window);

--BDS



More information about the plugin-futures mailing list