SlideShare a Scribd company logo
1 of 89
Download to read offline
Mozilla Firefox
           Extensions
          Development
            Tutorial
2009, October FOSS GN09 @ Engineering College Bikaner
   Abhinav Chittora, Google Summer of Code Student,
               Xiph.org Foundation 2009
Agenda
Chapter 1   Firefox architecture
            and technology
Chapter 2   The mechanism behind
            Extensions
Chapter 3   Building an Extension
Chapter 1
Firefox architecture
  and technology
Firefox
   is closer to a
     Web app
than a conventional
    application
Firefox architecture is very similar to
             web pages that use Dynamic HTML

               Firefox        HTML          DHTML
 Structure       XUL            HTML            HTML


 Control      JavaScript       JScript       JavaScript


Customized       XPCOM           ActiveX          CGI
 Processes
Keywords
・HTML
・CSS
・JavaScript
・XPCOM
XUL
 XML-based
User-interface
  Language
XML based
 User Interface
Markup Language
Creates framework
 of Firefox GUI
<vbox>
  <hbox>
    <label value="Make your selection"/>
    <menulist>
      <menupopup>
        <menuitem label="Foo 1" selected="true"/>
        <menuitem label="Foo 2"/>
        <menuitem label="Foo 3"/>
      </menupopup>
    </menulist>
  </hbox>
  <checkbox label="Select items" checked="true"/>
  <hbox>
    <label value="Enter text"/>
    <textbox size="15"/>
  </hbox>
</vbox>
Similar to HTML
A GUI widget like an HTML form
Simplifies and standardizes GUI widgets
that were difficult to build using DHTML
(Drop-down lists, scrollbars, tabs, etc.)

Can be used on the web, not just in Firefox
http://sakshama.org/latest/mozilla/index.xul
HTML-like use of XUL
XUL allows a variety of
       widgets
“Logic” is defined
      rather than “Style”
(Color, font size, etc. are defined using
         CSS, explained later)
Benefits
Read code,
Understand logic
When defining menus using Java
fileMenu = new JMenu(resbundle.getString("fileMenu"));
fileMenu.add(new JMenuItem(newAction)):
fileMenu.add(new JMenuItem(openAction)):
fileMenu.add(new JMenuItem(saveAsAction)):
mainMenuBar.add(fileMenu);
editMenu = new JMenu(resbundle.getString("editMenu"));
editMenu.add(new JMenuItem(undoAction)):
editMenu.addSeparator();
editMenu.add(new JMenuItem(cutAction)):
editMenu.add(new JMenuItem(pasteAction)):
editMenu.add(new JMenuItem(clearAction)):
editMenu.addSeparator();
editMenu.add(new JMenuItem(selectAllAction)):
mainMenuBar.add(fileMenu);


       One needs to decipher the code
With XUL, one only needs to look
  <menubar>
    <menu label="&fileMenu.label;">
      <menupopup>
        <menuitem label="&fileMenu.new.label;"/>
        <menuitem label="&fileMenu.open.label;"/>
        <menuitem label="&fileMenu.save.label;"/>
      </menupopup>
    </menu>
    <menu label="&editMenu.label;">
      <menupopup>
        <menuitem label="&editMenu.undo.label;"/>
        <menuseparator/>
        <menuitem label="&editMenu.cut.label;"/>
        <menuitem label="&editMenu.paste.label;"/>
        <menuitem label="&editMenu.clear.label;"/>
        <menuseparator/>
        <menuitem label="&editMenu.selectAll.label;"/>
      </menupopup>
    </menu>
  </menubar>
Not as straightforward as
WYSIWYG, but much more
   intuitive than writing
  conventional programs
  *WYSIWYG = What You See Is What You Get
Summary
              Application
                Logic
Regular app    C++, etc.

 Web app        HTML

  Firefox        XUL
XUL Specification Resources
 1.Mozilla Developer Center (MDC)
 http://developer.mozilla.org/

 2.Mozillazine.org
 http://mozillazine.org/
 3.Extension developer tool
 http://ted.mielczarek.org/code/mozilla/
 extensionwiz/
CSS
Cascading
  Style
 Sheets
Stylesheet language used to describe
the presentation of XML documents
      in an easy to read format
        #content {
          font-size: 10pt;
          border-width: 1pt;
          border-color: red;
          border-style: solid;
        }
XUL is also styled using CSS
button[type="menu-button"] {
  -moz-box-align: center;
  -moz-box-pack: center;
  margin: 0;
  border: none;
}
.button-menu-dropmarker,
.button-menubutton-dropmarker {
  margin: 1px;
  background-image:
     url("chrome://global/skin/arrow/arrow-dn.gif");
  background-repeat: no-repeat;
  background-position: center center;
  min-width:11px;
  min-height:11px;
}
Build the framework using XUL
     Dress it up using CSS
Same as building
  a web page
Benefits
Clean separation of
 presentation from
 application logic
Therefore
Each part can be
altered independently
→“Theme”(or “Skin”)
 of Firefox
Summary
              Application
                          Presentation
                Logic
Regular app    C++, etc.    C++, etc.
 Web app        HTML          CSS
  Firefox        XUL          CSS
JavaScript
Firefox is
controlled by
 JavaScript
Object-oriented prototype-based language
corresponding to
ECMAScript(ECMA-262)3rd edition
 http://www.ecma-international.org/publications/
         standards/Ecma-262.htm




Not related to Java
JavaScript in Firefox 2
・JavaScript 1.7
 ECMAScript Edition 3
  extended

・E4X
 ・ECMAScript for XML・
 is supported
・Grammar is similar to C
(easier to learn)
・Highly flexible
・Untyped variables (almost entirely)
・There is garbage collection
・Not strictly structured like Java
                     etc.
Useful when
  deployed
strategically
XUL
   and
JavaScript
Interoperate using
   DOM
     Document
      Object
      Model
Controls XML through
        API of
  JavaScript objects
Control through properties
var checkbox =
        document.getElementById('check');
check.checked = true;
Control through methods
var textbox =
        document.getElementById('input');
textbox.focus();
Create and append XUL elements
var button =
        document.createElement('button');
button.setAttribute('label', 'button');
box.appendChild(button);
Useful when
dynamically displaying
    message text
Summary
              Application                Conditional
                          Presentation
                Logic                       tasks
Regular app    C++, etc.   C++, etc.      C++, etc.
                                         JavaScript
 Web app        HTML          CSS
                                           Jscript
  Firefox        XUL          CSS        JavaScript
XPCOM
   Cross
  Platform
 Component
   Object
   Model
Is a concept
that binds together
Platform independent
         framework
for component development
Components
developed based on
  this framework
Functionality
    offered by
these components
・ Platform independent
framework for component
development
・Components developed
based on this framework
・ Functionality offered by
these components
XPCOM example
nsIFile::create(
  in unsigned long type,
  in unsigned long permissions
)

・Creates a file
・Has two parameters
  File type (File or Directory)
  Permission (UNIX-style)
   => Permission value is ignored
         depending on the environment
Performs 3
 functions
in Firefox
1
Can focus on development
     while ignoring
  language differences
2
  Absorbs platform
dependent differences
Standardized API to handle
multiple platforms
→Simplifies Firefox development
3
Use the programming language
          that is most
   suited to the task at hand
・JavaScript calls
   XPCOM components written in C++
・C++ calls
  XPCOM components written in JavaScript
・Java calls
   XPCOM components written in C++
 ...
Take advantage
of programming
 language traits
and divide tasks
Each component
 is a black box
In
Firefox
・ speed is necessary
 If
・ the platform is
 If
  directly accessed
  Use C++
Development   Need to    Platform    Execution
             Complexity    Compile   dependency    Speed
JavaScript     Simple        No         Low         Slow
  C++         Complex        Yes       High         Fast
JavaScript
   and
XPCOM
Interoperate using
XPConnect
XPConnect
Allows XPCOM to
be accessed from
JavaScript
Example:
Create a temporary
folder by calling
XPCOM from
JavaScript
const nsILocalFile = Components.interfaces.nsILocalFile;
var file = Components.classes['@mozilla.org/file/local;1']
                     .createInstance(nsILocalFile);
file.initWithPath('C:');
file.append('temp');
if (!file.exists()) {
  file.create(nsILocalFile.DIRECTORY_TYPE, 0755);
}
Benefits
It is
cross-platform
  (This is it)
Summary
          Applicatio   Presentati   Conditional
                                                  Specialized tasks
           n Logic        on          tasks
Regular    C++,         C++,                        COM .NET
                                    C++, etc.       Framework
 app       etc.         etc.
                                     JavaScript    ActiveX CGI
Web app   HTML           CSS           Jscript        script

Firefox    XUL           CSS        JavaScript      XPCOM
Review
Role of each technology in Firefox

          Defines presentation


              Controls all parts


                   Builds architectural framework


                         Black box for
                         specialized tasks
Compare to
similar projects
Conditional   Specialized
            Logic   Presentation
                                      tasks         tasks
 Firefox    XUL        CSS         JavaScript     XPCOM
Adobe AIR   HTML       CSS         JavaScript      Flash
Capable
                 Platform       Platform
                                          of flashy   Standard
               compatibility   dependency
                                            tasks
Machine code       High          High        High        -
    Java          Low             Low       High      Open
 Flash/AIR        Low             Low       High      Closed
 Silverlight        ?             Low       High      Closed
    XUL        Modestly high      Low       Slight    Open

      Not flashy but it is solid
Issues with
 developing XUL
based applications
There are no
 WYSIWYG
development
environments
Lack of
documentation
 (Source code is the
   documentation)
However
Only a text editor
 is needed for
 development
Agile
Application
Development
with XUL!!
Thanks !
Any Query ???

More Related Content

What's hot

Whmcs addon module docs
Whmcs addon module docsWhmcs addon module docs
Whmcs addon module docsquyvn
 
WordPress Structure and Best Practices
WordPress Structure and Best PracticesWordPress Structure and Best Practices
WordPress Structure and Best Practicesmarkparolisi
 
Build a WordPress theme from HTML5 template @ Telerik
Build a WordPress theme from HTML5 template @ TelerikBuild a WordPress theme from HTML5 template @ Telerik
Build a WordPress theme from HTML5 template @ TelerikMario Peshev
 
PHP記帳網頁教材(第一頁是空白的)
PHP記帳網頁教材(第一頁是空白的)PHP記帳網頁教材(第一頁是空白的)
PHP記帳網頁教材(第一頁是空白的)TaiShunHuang
 
JavaScript Advanced - Useful methods to power up your code
JavaScript Advanced - Useful methods to power up your codeJavaScript Advanced - Useful methods to power up your code
JavaScript Advanced - Useful methods to power up your codeLaurence Svekis ✔
 
Architecture of Drupal - Drupal Camp
Architecture of Drupal - Drupal CampArchitecture of Drupal - Drupal Camp
Architecture of Drupal - Drupal CampDipen Chaudhary
 
How to create a joomla component from scratch
How to create a joomla component from scratchHow to create a joomla component from scratch
How to create a joomla component from scratchTim Plummer
 
4.content mgmt
4.content mgmt4.content mgmt
4.content mgmtWingston
 
Websphere portal theme menu framework
Websphere portal theme menu frameworkWebsphere portal theme menu framework
Websphere portal theme menu frameworkmichele buccarello
 
Phing i Fabric - Budowanie i deployment aplikacji webowych
Phing i Fabric - Budowanie i deployment aplikacji webowychPhing i Fabric - Budowanie i deployment aplikacji webowych
Phing i Fabric - Budowanie i deployment aplikacji webowychleafnode
 
Introduction to building joomla! components using FOF
Introduction to building joomla! components using FOFIntroduction to building joomla! components using FOF
Introduction to building joomla! components using FOFTim Plummer
 
Essential html tweaks for accessible themes
Essential html tweaks for accessible themesEssential html tweaks for accessible themes
Essential html tweaks for accessible themesMartin Stehle
 
Moodle 3.3 - API Change Overview #mootieuk17
Moodle 3.3 - API Change Overview #mootieuk17Moodle 3.3 - API Change Overview #mootieuk17
Moodle 3.3 - API Change Overview #mootieuk17Dan Poltawski
 
IBM Connections 4.5 User Data Propagation.
IBM Connections 4.5 User Data Propagation.IBM Connections 4.5 User Data Propagation.
IBM Connections 4.5 User Data Propagation.michele buccarello
 
WordPress Admin UI - Future Proofing Your Admin Pages
WordPress Admin UI - Future Proofing Your Admin PagesWordPress Admin UI - Future Proofing Your Admin Pages
WordPress Admin UI - Future Proofing Your Admin PagesBrandon Dove
 
Developing new feature in Joomla - Joomladay UK 2016
Developing new feature in Joomla - Joomladay UK 2016Developing new feature in Joomla - Joomladay UK 2016
Developing new feature in Joomla - Joomladay UK 2016Peter Martin
 
I use drupal / 我是 OO 師,我用 Drupal
I use drupal / 我是 OO 師,我用 DrupalI use drupal / 我是 OO 師,我用 Drupal
I use drupal / 我是 OO 師,我用 DrupalChris Wu
 

What's hot (20)

CustomThesis
CustomThesisCustomThesis
CustomThesis
 
Whmcs addon module docs
Whmcs addon module docsWhmcs addon module docs
Whmcs addon module docs
 
WordPress Structure and Best Practices
WordPress Structure and Best PracticesWordPress Structure and Best Practices
WordPress Structure and Best Practices
 
Build a WordPress theme from HTML5 template @ Telerik
Build a WordPress theme from HTML5 template @ TelerikBuild a WordPress theme from HTML5 template @ Telerik
Build a WordPress theme from HTML5 template @ Telerik
 
PHP記帳網頁教材(第一頁是空白的)
PHP記帳網頁教材(第一頁是空白的)PHP記帳網頁教材(第一頁是空白的)
PHP記帳網頁教材(第一頁是空白的)
 
Hpage
HpageHpage
Hpage
 
JavaScript Advanced - Useful methods to power up your code
JavaScript Advanced - Useful methods to power up your codeJavaScript Advanced - Useful methods to power up your code
JavaScript Advanced - Useful methods to power up your code
 
Architecture of Drupal - Drupal Camp
Architecture of Drupal - Drupal CampArchitecture of Drupal - Drupal Camp
Architecture of Drupal - Drupal Camp
 
How to create a joomla component from scratch
How to create a joomla component from scratchHow to create a joomla component from scratch
How to create a joomla component from scratch
 
4.content mgmt
4.content mgmt4.content mgmt
4.content mgmt
 
Fundamental JQuery
Fundamental JQueryFundamental JQuery
Fundamental JQuery
 
Websphere portal theme menu framework
Websphere portal theme menu frameworkWebsphere portal theme menu framework
Websphere portal theme menu framework
 
Phing i Fabric - Budowanie i deployment aplikacji webowych
Phing i Fabric - Budowanie i deployment aplikacji webowychPhing i Fabric - Budowanie i deployment aplikacji webowych
Phing i Fabric - Budowanie i deployment aplikacji webowych
 
Introduction to building joomla! components using FOF
Introduction to building joomla! components using FOFIntroduction to building joomla! components using FOF
Introduction to building joomla! components using FOF
 
Essential html tweaks for accessible themes
Essential html tweaks for accessible themesEssential html tweaks for accessible themes
Essential html tweaks for accessible themes
 
Moodle 3.3 - API Change Overview #mootieuk17
Moodle 3.3 - API Change Overview #mootieuk17Moodle 3.3 - API Change Overview #mootieuk17
Moodle 3.3 - API Change Overview #mootieuk17
 
IBM Connections 4.5 User Data Propagation.
IBM Connections 4.5 User Data Propagation.IBM Connections 4.5 User Data Propagation.
IBM Connections 4.5 User Data Propagation.
 
WordPress Admin UI - Future Proofing Your Admin Pages
WordPress Admin UI - Future Proofing Your Admin PagesWordPress Admin UI - Future Proofing Your Admin Pages
WordPress Admin UI - Future Proofing Your Admin Pages
 
Developing new feature in Joomla - Joomladay UK 2016
Developing new feature in Joomla - Joomladay UK 2016Developing new feature in Joomla - Joomladay UK 2016
Developing new feature in Joomla - Joomladay UK 2016
 
I use drupal / 我是 OO 師,我用 Drupal
I use drupal / 我是 OO 師,我用 DrupalI use drupal / 我是 OO 師,我用 Drupal
I use drupal / 我是 OO 師,我用 Drupal
 

Similar to Firefox extension Development

Deeper into Windows 10 Development
Deeper into Windows 10 DevelopmentDeeper into Windows 10 Development
Deeper into Windows 10 DevelopmentShahed Chowdhuri
 
RIA Development via Adobe Flex + JRuby on Rails
RIA Development via Adobe Flex + JRuby on RailsRIA Development via Adobe Flex + JRuby on Rails
RIA Development via Adobe Flex + JRuby on Railskamal.fariz
 
Flex And Ria
Flex And RiaFlex And Ria
Flex And Riaravinxg
 
Building Desktop RIAs with PHP, HTML & Javascript in AIR
Building Desktop RIAs with PHP, HTML & Javascript in AIRBuilding Desktop RIAs with PHP, HTML & Javascript in AIR
Building Desktop RIAs with PHP, HTML & Javascript in AIRfunkatron
 
Buzzword, How'd They Build That?
Buzzword, How'd They Build That?Buzzword, How'd They Build That?
Buzzword, How'd They Build That?dcoletta
 
Plug-in Architectures
Plug-in ArchitecturesPlug-in Architectures
Plug-in Architectureselliando dias
 
Building Buzzword (Flex Camp Boston 2007)
Building Buzzword (Flex Camp Boston 2007)Building Buzzword (Flex Camp Boston 2007)
Building Buzzword (Flex Camp Boston 2007)dcoletta
 
Yahoo! On Microsoft .NET 3.0 and Microsoft Expression
Yahoo! On Microsoft .NET 3.0 and Microsoft ExpressionYahoo! On Microsoft .NET 3.0 and Microsoft Expression
Yahoo! On Microsoft .NET 3.0 and Microsoft Expressiongoodfriday
 
Visual Studio .NET2010
Visual Studio .NET2010Visual Studio .NET2010
Visual Studio .NET2010Satish Verma
 
Railo Presentation Railo 3.1
Railo Presentation Railo 3.1Railo Presentation Railo 3.1
Railo Presentation Railo 3.1Rhinofly
 
Complete WPF Overview Tutorial with Example - iFour Technolab
Complete WPF Overview Tutorial with Example - iFour TechnolabComplete WPF Overview Tutorial with Example - iFour Technolab
Complete WPF Overview Tutorial with Example - iFour TechnolabiFour Technolab Pvt. Ltd.
 
Apache Flex - Enterprise ready GUI framework
Apache Flex - Enterprise ready GUI frameworkApache Flex - Enterprise ready GUI framework
Apache Flex - Enterprise ready GUI frameworkTomislav Pokrajcic
 

Similar to Firefox extension Development (20)

Deeper into Windows 10 Development
Deeper into Windows 10 DevelopmentDeeper into Windows 10 Development
Deeper into Windows 10 Development
 
Adobe® Flex™
Adobe® Flex™Adobe® Flex™
Adobe® Flex™
 
What is Adobe Flex ?
What is Adobe Flex  ?What is Adobe Flex  ?
What is Adobe Flex ?
 
RIA Development via Adobe Flex + JRuby on Rails
RIA Development via Adobe Flex + JRuby on RailsRIA Development via Adobe Flex + JRuby on Rails
RIA Development via Adobe Flex + JRuby on Rails
 
Flex And Ria
Flex And RiaFlex And Ria
Flex And Ria
 
Flex RIA
Flex RIAFlex RIA
Flex RIA
 
DIY Flex
DIY FlexDIY Flex
DIY Flex
 
DIY Flex
DIY FlexDIY Flex
DIY Flex
 
Building Desktop RIAs with PHP, HTML & Javascript in AIR
Building Desktop RIAs with PHP, HTML & Javascript in AIRBuilding Desktop RIAs with PHP, HTML & Javascript in AIR
Building Desktop RIAs with PHP, HTML & Javascript in AIR
 
Buzzword, How'd They Build That?
Buzzword, How'd They Build That?Buzzword, How'd They Build That?
Buzzword, How'd They Build That?
 
Plug-in Architectures
Plug-in ArchitecturesPlug-in Architectures
Plug-in Architectures
 
Silverlight Training
Silverlight TrainingSilverlight Training
Silverlight Training
 
Building Buzzword (Flex Camp Boston 2007)
Building Buzzword (Flex Camp Boston 2007)Building Buzzword (Flex Camp Boston 2007)
Building Buzzword (Flex Camp Boston 2007)
 
Yahoo! On Microsoft .NET 3.0 and Microsoft Expression
Yahoo! On Microsoft .NET 3.0 and Microsoft ExpressionYahoo! On Microsoft .NET 3.0 and Microsoft Expression
Yahoo! On Microsoft .NET 3.0 and Microsoft Expression
 
My view on XPages
My view on XPagesMy view on XPages
My view on XPages
 
Flex & Drupal Integration
Flex & Drupal IntegrationFlex & Drupal Integration
Flex & Drupal Integration
 
Visual Studio .NET2010
Visual Studio .NET2010Visual Studio .NET2010
Visual Studio .NET2010
 
Railo Presentation Railo 3.1
Railo Presentation Railo 3.1Railo Presentation Railo 3.1
Railo Presentation Railo 3.1
 
Complete WPF Overview Tutorial with Example - iFour Technolab
Complete WPF Overview Tutorial with Example - iFour TechnolabComplete WPF Overview Tutorial with Example - iFour Technolab
Complete WPF Overview Tutorial with Example - iFour Technolab
 
Apache Flex - Enterprise ready GUI framework
Apache Flex - Enterprise ready GUI frameworkApache Flex - Enterprise ready GUI framework
Apache Flex - Enterprise ready GUI framework
 

Recently uploaded

TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsRoshan Dwivedi
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 

Recently uploaded (20)

TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 

Firefox extension Development

  • 1. Mozilla Firefox Extensions Development Tutorial 2009, October FOSS GN09 @ Engineering College Bikaner Abhinav Chittora, Google Summer of Code Student, Xiph.org Foundation 2009
  • 3. Chapter 1 Firefox architecture and technology Chapter 2 The mechanism behind Extensions Chapter 3 Building an Extension
  • 5. Firefox is closer to a Web app than a conventional application
  • 6. Firefox architecture is very similar to web pages that use Dynamic HTML Firefox HTML DHTML Structure XUL HTML HTML Control JavaScript JScript JavaScript Customized XPCOM ActiveX CGI Processes
  • 9. XML based User Interface Markup Language
  • 10. Creates framework of Firefox GUI
  • 11. <vbox> <hbox> <label value="Make your selection"/> <menulist> <menupopup> <menuitem label="Foo 1" selected="true"/> <menuitem label="Foo 2"/> <menuitem label="Foo 3"/> </menupopup> </menulist> </hbox> <checkbox label="Select items" checked="true"/> <hbox> <label value="Enter text"/> <textbox size="15"/> </hbox> </vbox>
  • 12. Similar to HTML A GUI widget like an HTML form Simplifies and standardizes GUI widgets that were difficult to build using DHTML (Drop-down lists, scrollbars, tabs, etc.) Can be used on the web, not just in Firefox http://sakshama.org/latest/mozilla/index.xul
  • 14. XUL allows a variety of widgets
  • 15. “Logic” is defined rather than “Style” (Color, font size, etc. are defined using CSS, explained later)
  • 18. When defining menus using Java fileMenu = new JMenu(resbundle.getString("fileMenu")); fileMenu.add(new JMenuItem(newAction)): fileMenu.add(new JMenuItem(openAction)): fileMenu.add(new JMenuItem(saveAsAction)): mainMenuBar.add(fileMenu); editMenu = new JMenu(resbundle.getString("editMenu")); editMenu.add(new JMenuItem(undoAction)): editMenu.addSeparator(); editMenu.add(new JMenuItem(cutAction)): editMenu.add(new JMenuItem(pasteAction)): editMenu.add(new JMenuItem(clearAction)): editMenu.addSeparator(); editMenu.add(new JMenuItem(selectAllAction)): mainMenuBar.add(fileMenu); One needs to decipher the code
  • 19. With XUL, one only needs to look <menubar> <menu label="&fileMenu.label;"> <menupopup> <menuitem label="&fileMenu.new.label;"/> <menuitem label="&fileMenu.open.label;"/> <menuitem label="&fileMenu.save.label;"/> </menupopup> </menu> <menu label="&editMenu.label;"> <menupopup> <menuitem label="&editMenu.undo.label;"/> <menuseparator/> <menuitem label="&editMenu.cut.label;"/> <menuitem label="&editMenu.paste.label;"/> <menuitem label="&editMenu.clear.label;"/> <menuseparator/> <menuitem label="&editMenu.selectAll.label;"/> </menupopup> </menu> </menubar>
  • 20. Not as straightforward as WYSIWYG, but much more intuitive than writing conventional programs *WYSIWYG = What You See Is What You Get
  • 21. Summary Application Logic Regular app C++, etc. Web app HTML Firefox XUL
  • 22. XUL Specification Resources 1.Mozilla Developer Center (MDC) http://developer.mozilla.org/ 2.Mozillazine.org http://mozillazine.org/ 3.Extension developer tool http://ted.mielczarek.org/code/mozilla/ extensionwiz/
  • 23.
  • 25. Stylesheet language used to describe the presentation of XML documents in an easy to read format #content { font-size: 10pt; border-width: 1pt; border-color: red; border-style: solid; }
  • 26. XUL is also styled using CSS button[type="menu-button"] { -moz-box-align: center; -moz-box-pack: center; margin: 0; border: none; } .button-menu-dropmarker, .button-menubutton-dropmarker { margin: 1px; background-image: url("chrome://global/skin/arrow/arrow-dn.gif"); background-repeat: no-repeat; background-position: center center; min-width:11px; min-height:11px; }
  • 27. Build the framework using XUL Dress it up using CSS
  • 28. Same as building a web page
  • 30. Clean separation of presentation from application logic
  • 32. Each part can be altered independently
  • 34. Summary Application Presentation Logic Regular app C++, etc. C++, etc. Web app HTML CSS Firefox XUL CSS
  • 35.
  • 38. Object-oriented prototype-based language corresponding to ECMAScript(ECMA-262)3rd edition http://www.ecma-international.org/publications/ standards/Ecma-262.htm Not related to Java
  • 39. JavaScript in Firefox 2 ・JavaScript 1.7 ECMAScript Edition 3 extended ・E4X ・ECMAScript for XML・ is supported
  • 40. ・Grammar is similar to C (easier to learn) ・Highly flexible ・Untyped variables (almost entirely) ・There is garbage collection ・Not strictly structured like Java etc.
  • 41. Useful when deployed strategically
  • 42. XUL and JavaScript
  • 43. Interoperate using DOM Document Object Model
  • 44. Controls XML through API of JavaScript objects
  • 45. Control through properties var checkbox = document.getElementById('check'); check.checked = true;
  • 46. Control through methods var textbox = document.getElementById('input'); textbox.focus();
  • 47. Create and append XUL elements var button = document.createElement('button'); button.setAttribute('label', 'button'); box.appendChild(button);
  • 49. Summary Application Conditional Presentation Logic tasks Regular app C++, etc. C++, etc. C++, etc. JavaScript Web app HTML CSS Jscript Firefox XUL CSS JavaScript
  • 50.
  • 51. XPCOM Cross Platform Component Object Model
  • 52. Is a concept that binds together
  • 53. Platform independent framework for component development
  • 55. Functionality offered by these components
  • 56. ・ Platform independent framework for component development ・Components developed based on this framework ・ Functionality offered by these components
  • 57. XPCOM example nsIFile::create( in unsigned long type, in unsigned long permissions ) ・Creates a file ・Has two parameters File type (File or Directory) Permission (UNIX-style) => Permission value is ignored depending on the environment
  • 59. 1 Can focus on development while ignoring language differences
  • 60. 2 Absorbs platform dependent differences Standardized API to handle multiple platforms →Simplifies Firefox development
  • 61. 3 Use the programming language that is most suited to the task at hand
  • 62. ・JavaScript calls XPCOM components written in C++ ・C++ calls XPCOM components written in JavaScript ・Java calls XPCOM components written in C++ ...
  • 63. Take advantage of programming language traits and divide tasks
  • 64. Each component is a black box
  • 66. ・ speed is necessary If ・ the platform is If directly accessed Use C++
  • 67. Development Need to Platform Execution Complexity Compile dependency Speed JavaScript Simple No Low Slow C++ Complex Yes High Fast
  • 68. JavaScript and XPCOM
  • 70. XPConnect Allows XPCOM to be accessed from JavaScript
  • 71. Example: Create a temporary folder by calling XPCOM from JavaScript
  • 72. const nsILocalFile = Components.interfaces.nsILocalFile; var file = Components.classes['@mozilla.org/file/local;1'] .createInstance(nsILocalFile); file.initWithPath('C:'); file.append('temp'); if (!file.exists()) { file.create(nsILocalFile.DIRECTORY_TYPE, 0755); }
  • 74. It is cross-platform (This is it)
  • 75. Summary Applicatio Presentati Conditional Specialized tasks n Logic on tasks Regular C++, C++, COM .NET C++, etc. Framework app etc. etc. JavaScript ActiveX CGI Web app HTML CSS Jscript script Firefox XUL CSS JavaScript XPCOM
  • 77. Role of each technology in Firefox Defines presentation Controls all parts Builds architectural framework Black box for specialized tasks
  • 78.
  • 80. Conditional Specialized Logic Presentation tasks tasks Firefox XUL CSS JavaScript XPCOM Adobe AIR HTML CSS JavaScript Flash
  • 81. Capable Platform Platform of flashy Standard compatibility dependency tasks Machine code High High High - Java Low Low High Open Flash/AIR Low Low High Closed Silverlight ? Low High Closed XUL Modestly high Low Slight Open Not flashy but it is solid
  • 82.
  • 83. Issues with developing XUL based applications
  • 84. There are no WYSIWYG development environments
  • 85. Lack of documentation (Source code is the documentation)
  • 87. Only a text editor is needed for development